diff options
Diffstat (limited to 'test/CodeGen/SystemZ/int-cmp-37.ll')
-rw-r--r-- | test/CodeGen/SystemZ/int-cmp-37.ll | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/test/CodeGen/SystemZ/int-cmp-37.ll b/test/CodeGen/SystemZ/int-cmp-37.ll index aebd1f610d27..8095ed173012 100644 --- a/test/CodeGen/SystemZ/int-cmp-37.ll +++ b/test/CodeGen/SystemZ/int-cmp-37.ll @@ -4,12 +4,13 @@ ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s @g = global i16 1 +@h = global i16 1, align 1, section "foo" ; Check unsigned comparison. define i32 @f1(i32 %src1) { -; CHECK: f1: +; CHECK-LABEL: f1: ; CHECK: clhrl %r2, g -; CHECK-NEXT: j{{g?}}l +; CHECK-NEXT: jl ; CHECK: br %r14 entry: %val = load i16 *@g @@ -26,7 +27,7 @@ exit: ; Check signed comparison. define i32 @f2(i32 %src1) { -; CHECK: f2: +; CHECK-LABEL: f2: ; CHECK-NOT: clhrl ; CHECK: br %r14 entry: @@ -44,9 +45,9 @@ exit: ; Check equality. define i32 @f3(i32 %src1) { -; CHECK: f3: +; CHECK-LABEL: f3: ; CHECK: clhrl %r2, g -; CHECK-NEXT: j{{g?}}e +; CHECK-NEXT: je ; CHECK: br %r14 entry: %val = load i16 *@g @@ -63,9 +64,9 @@ exit: ; Check inequality. define i32 @f4(i32 %src1) { -; CHECK: f4: +; CHECK-LABEL: f4: ; CHECK: clhrl %r2, g -; CHECK-NEXT: j{{g?}}lh +; CHECK-NEXT: jlh ; CHECK: br %r14 entry: %val = load i16 *@g @@ -79,3 +80,42 @@ exit: %res = phi i32 [ %src1, %entry ], [ %mul, %mulb ] ret i32 %res } + +; Repeat f1 with an unaligned address. +define i32 @f5(i32 %src1) { +; CHECK-LABEL: f5: +; CHECK: lgrl [[REG:%r[0-5]]], h@GOT +; CHECK: llh [[VAL:%r[0-5]]], 0([[REG]]) +; CHECK: clrjl %r2, [[VAL]], +; CHECK: br %r14 +entry: + %val = load i16 *@h, align 1 + %src2 = zext i16 %val to i32 + %cond = icmp ult i32 %src1, %src2 + br i1 %cond, label %exit, label %mulb +mulb: + %mul = mul i32 %src1, %src1 + br label %exit +exit: + %res = phi i32 [ %src1, %entry ], [ %mul, %mulb ] + ret i32 %res +} + +; Check the comparison can be reversed if that allows CLHRL to be used. +define i32 @f6(i32 %src2) { +; CHECK-LABEL: f6: +; CHECK: clhrl %r2, g +; CHECK-NEXT: jh {{\.L.*}} +; CHECK: br %r14 +entry: + %val = load i16 *@g + %src1 = zext i16 %val to i32 + %cond = icmp ult i32 %src1, %src2 + br i1 %cond, label %exit, label %mulb +mulb: + %mul = mul i32 %src2, %src2 + br label %exit +exit: + %res = phi i32 [ %src2, %entry ], [ %mul, %mulb ] + ret i32 %res +} |