diff options
| author | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-09-18 09:56:40 +0000 |
|---|---|---|
| committer | Richard Sandiford <rsandifo@linux.vnet.ibm.com> | 2013-09-18 09:56:40 +0000 |
| commit | 93183ee78c5850cc475f537ca14dd0a83c009bbf (patch) | |
| tree | ac2d3378a8e73e7b26f3e3d53df6604e64cf2e0d /llvm/test/CodeGen/SystemZ/branch-10.ll | |
| parent | 36b2e5de3c3333507dd6d0cd4684859ce0cc010a (diff) | |
| download | bcm5719-llvm-93183ee78c5850cc475f537ca14dd0a83c009bbf.tar.gz bcm5719-llvm-93183ee78c5850cc475f537ca14dd0a83c009bbf.zip | |
[SystemZ] Add unsigned compare-and-branch instructions
For some reason I never got around to adding these at the same time as
the signed versions. No idea why.
I'm not sure whether this SystemZII::BranchC* stuff is useful, or whether
it should just be replaced with an "is normal" flag. I'll leave that
for later though.
There are some boundary conditions that can be tweaked, such as preferring
unsigned comparisons for equality with [128, 256), and "<= 255" over "< 256",
but again I'll leave those for a separate patch.
llvm-svn: 190930
Diffstat (limited to 'llvm/test/CodeGen/SystemZ/branch-10.ll')
| -rw-r--r-- | llvm/test/CodeGen/SystemZ/branch-10.ll | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/SystemZ/branch-10.ll b/llvm/test/CodeGen/SystemZ/branch-10.ll new file mode 100644 index 00000000000..ec6e759e8e7 --- /dev/null +++ b/llvm/test/CodeGen/SystemZ/branch-10.ll @@ -0,0 +1,62 @@ +; Test all condition-code masks that are relevant for CLGRJ. +; +; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s + +declare i64 @foo() +@g1 = global i16 0 + +define void @f1(i64 %target) { +; CHECK-LABEL: f1: +; CHECK: .cfi_def_cfa_offset +; CHECK: .L[[LABEL:.*]]: +; CHECK: clgrjle %r2, {{%r[0-9]+}}, .L[[LABEL]] + br label %loop +loop: + %val = call i64 @foo() + %cond = icmp ule i64 %val, %target + br i1 %cond, label %loop, label %exit +exit: + ret void +} + +define void @f2(i64 %target) { +; CHECK-LABEL: f2: +; CHECK: .cfi_def_cfa_offset +; CHECK: .L[[LABEL:.*]]: +; CHECK: clgrjl %r2, {{%r[0-9]+}}, .L[[LABEL]] + br label %loop +loop: + %val = call i64 @foo() + %cond = icmp ult i64 %val, %target + br i1 %cond, label %loop, label %exit +exit: + ret void +} + +define void @f3(i64 %target) { +; CHECK-LABEL: f3: +; CHECK: .cfi_def_cfa_offset +; CHECK: .L[[LABEL:.*]]: +; CHECK: clgrjh %r2, {{%r[0-9]+}}, .L[[LABEL]] + br label %loop +loop: + %val = call i64 @foo() + %cond = icmp ugt i64 %val, %target + br i1 %cond, label %loop, label %exit +exit: + ret void +} + +define void @f4(i64 %target) { +; CHECK-LABEL: f4: +; CHECK: .cfi_def_cfa_offset +; CHECK: .L[[LABEL:.*]]: +; CHECK: clgrjhe %r2, {{%r[0-9]+}}, .L[[LABEL]] + br label %loop +loop: + %val = call i64 @foo() + %cond = icmp uge i64 %val, %target + br i1 %cond, label %loop, label %exit +exit: + ret void +} |

