Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 1 | ; Test all condition-code masks that are relevant for signed integer |
Richard Sandiford | 0fb90ab | 2013-05-28 10:41:11 +0000 | [diff] [blame] | 2 | ; comparisons, in cases where a separate branch is better than COMPARE |
| 3 | ; AND BRANCH. |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 4 | ; |
| 5 | ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s |
| 6 | |
| 7 | define void @f1(i32 *%src, i32 %target) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 8 | ; CHECK-LABEL: f1: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 9 | ; CHECK: .cfi_startproc |
| 10 | ; CHECK: .L[[LABEL:.*]]: |
| 11 | ; CHECK: c %r3, 0(%r2) |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 12 | ; CHECK-NEXT: je .L[[LABEL]] |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 13 | br label %loop |
| 14 | loop: |
Ulrich Weigand | 9dd23b8 | 2018-07-20 12:12:10 +0000 | [diff] [blame] | 15 | %val = load volatile i32, i32 *%src |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 16 | %cond = icmp eq i32 %target, %val |
| 17 | br i1 %cond, label %loop, label %exit |
| 18 | exit: |
| 19 | ret void |
| 20 | } |
| 21 | |
| 22 | define void @f2(i32 *%src, i32 %target) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 23 | ; CHECK-LABEL: f2: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 24 | ; CHECK: .cfi_startproc |
| 25 | ; CHECK: .L[[LABEL:.*]]: |
| 26 | ; CHECK: c %r3, 0(%r2) |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 27 | ; CHECK-NEXT: jlh .L[[LABEL]] |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 28 | br label %loop |
| 29 | loop: |
Ulrich Weigand | 9dd23b8 | 2018-07-20 12:12:10 +0000 | [diff] [blame] | 30 | %val = load volatile i32, i32 *%src |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 31 | %cond = icmp ne i32 %target, %val |
| 32 | br i1 %cond, label %loop, label %exit |
| 33 | exit: |
| 34 | ret void |
| 35 | } |
| 36 | |
| 37 | define void @f3(i32 *%src, i32 %target) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 38 | ; CHECK-LABEL: f3: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 39 | ; CHECK: .cfi_startproc |
| 40 | ; CHECK: .L[[LABEL:.*]]: |
| 41 | ; CHECK: c %r3, 0(%r2) |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 42 | ; CHECK-NEXT: jle .L[[LABEL]] |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 43 | br label %loop |
| 44 | loop: |
Ulrich Weigand | 9dd23b8 | 2018-07-20 12:12:10 +0000 | [diff] [blame] | 45 | %val = load volatile i32, i32 *%src |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 46 | %cond = icmp sle i32 %target, %val |
| 47 | br i1 %cond, label %loop, label %exit |
| 48 | exit: |
| 49 | ret void |
| 50 | } |
| 51 | |
| 52 | define void @f4(i32 *%src, i32 %target) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 53 | ; CHECK-LABEL: f4: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 54 | ; CHECK: .cfi_startproc |
| 55 | ; CHECK: .L[[LABEL:.*]]: |
| 56 | ; CHECK: c %r3, 0(%r2) |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 57 | ; CHECK-NEXT: jl .L[[LABEL]] |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 58 | br label %loop |
| 59 | loop: |
Ulrich Weigand | 9dd23b8 | 2018-07-20 12:12:10 +0000 | [diff] [blame] | 60 | %val = load volatile i32, i32 *%src |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 61 | %cond = icmp slt i32 %target, %val |
| 62 | br i1 %cond, label %loop, label %exit |
| 63 | exit: |
| 64 | ret void |
| 65 | } |
| 66 | |
| 67 | define void @f5(i32 *%src, i32 %target) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 68 | ; CHECK-LABEL: f5: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 69 | ; CHECK: .cfi_startproc |
| 70 | ; CHECK: .L[[LABEL:.*]]: |
| 71 | ; CHECK: c %r3, 0(%r2) |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 72 | ; CHECK-NEXT: jh .L[[LABEL]] |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 73 | br label %loop |
| 74 | loop: |
Ulrich Weigand | 9dd23b8 | 2018-07-20 12:12:10 +0000 | [diff] [blame] | 75 | %val = load volatile i32, i32 *%src |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 76 | %cond = icmp sgt i32 %target, %val |
| 77 | br i1 %cond, label %loop, label %exit |
| 78 | exit: |
| 79 | ret void |
| 80 | } |
| 81 | |
| 82 | define void @f6(i32 *%src, i32 %target) { |
Stephen Lin | d24ab20 | 2013-07-14 06:24:09 +0000 | [diff] [blame] | 83 | ; CHECK-LABEL: f6: |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 84 | ; CHECK: .cfi_startproc |
| 85 | ; CHECK: .L[[LABEL:.*]]: |
| 86 | ; CHECK: c %r3, 0(%r2) |
Richard Sandiford | 586f417 | 2013-05-21 08:53:17 +0000 | [diff] [blame] | 87 | ; CHECK-NEXT: jhe .L[[LABEL]] |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 88 | br label %loop |
| 89 | loop: |
Ulrich Weigand | 9dd23b8 | 2018-07-20 12:12:10 +0000 | [diff] [blame] | 90 | %val = load volatile i32, i32 *%src |
Ulrich Weigand | 9e3577f | 2013-05-06 16:17:29 +0000 | [diff] [blame] | 91 | %cond = icmp sge i32 %target, %val |
| 92 | br i1 %cond, label %loop, label %exit |
| 93 | exit: |
| 94 | ret void |
| 95 | } |