Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 ; Tests for conditional branch instructions | |
| 2 | |
| 3 ; RUN: %if --need=allow_dump --need=target_MIPS32 --command %p2i --filetype=asm \ | |
|
John
2016/05/19 14:59:59
80-col
Jim Stichnoth
2016/05/19 15:03:41
80-col
| |
| 4 ; RUN: --target mips32 -i %s --args -O2 --skip-unimplemented \ | |
| 5 ; RUN: -allow-externally-defined-symbols \ | |
| 6 ; RUN: | %if --need=allow_dump --need=target_MIPS32 --command FileCheck %s \ | |
| 7 ; RUN: --check-prefix=MIPS32 | |
| 8 | |
| 9 define internal i32 @cond_br_eq(i32 %arg1, i32 %arg2) { | |
| 10 entry: | |
| 11 %cmp1 = icmp eq i32 %arg1, %arg2 | |
| 12 br i1 %cmp1, label %branch1, label %branch2 | |
| 13 branch1: | |
| 14 ret i32 1 | |
| 15 branch2: | |
| 16 ret i32 2 | |
| 17 } | |
| 18 ; MIPS32-LABEL: cond_br_eq | |
| 19 ; MIPS32: bne $a0, $a1, .Lcond_br_eq$branch2 | |
|
Jim Stichnoth
2016/05/19 15:03:41
I think you also need tests where branch folding i
| |
| 20 | |
| 21 define internal i32 @cond_br_ne(i32 %arg1, i32 %arg2) { | |
| 22 entry: | |
| 23 %cmp1 = icmp ne i32 %arg1, %arg2 | |
| 24 br i1 %cmp1, label %branch1, label %branch2 | |
| 25 branch1: | |
| 26 ret i32 1 | |
| 27 branch2: | |
| 28 ret i32 2 | |
| 29 } | |
| 30 ; MIPS32-LABEL: cond_br_ne | |
| 31 ; MIPS32: beq $a0, $a1, .Lcond_br_ne$branch2 | |
| 32 | |
| 33 define internal i32 @cond_br_slt(i32 %arg1, i32 %arg2) { | |
| 34 entry: | |
| 35 %cmp1 = icmp slt i32 %arg1, %arg2 | |
| 36 br i1 %cmp1, label %branch1, label %branch2 | |
| 37 branch1: | |
| 38 ret i32 1 | |
| 39 branch2: | |
| 40 ret i32 2 | |
| 41 } | |
| 42 ; MIPS32-LABEL: cond_br_slt | |
| 43 ; MIPS32: slt $a0, $a0, $a1 | |
| 44 ; MIPS32: beqz $a0, .Lcond_br_slt$branch2 | |
| 45 | |
| 46 define internal i32 @cond_br_sle(i32 %arg1, i32 %arg2) { | |
| 47 entry: | |
| 48 %cmp1 = icmp sle i32 %arg1, %arg2 | |
| 49 br i1 %cmp1, label %branch1, label %branch2 | |
| 50 branch1: | |
| 51 ret i32 1 | |
| 52 branch2: | |
| 53 ret i32 2 | |
| 54 } | |
| 55 ; MIPS32-LABEL: cond_br_sle | |
| 56 ; MIPS32: slt $a1, $a1, $a0 | |
| 57 ; MIPS32: bnez $a1, .Lcond_br_sle$branch2 | |
| 58 | |
| 59 define internal i32 @cond_br_sgt(i32 %arg1, i32 %arg2) { | |
| 60 entry: | |
| 61 %cmp1 = icmp sgt i32 %arg1, %arg2 | |
| 62 br i1 %cmp1, label %branch1, label %branch2 | |
| 63 branch1: | |
| 64 ret i32 1 | |
| 65 branch2: | |
| 66 ret i32 2 | |
| 67 } | |
| 68 ; MIPS32-LABEL: cond_br_sgt | |
| 69 ; MIPS32: slt $a1, $a1, $a0 | |
| 70 ; MIPS32: beqz $a1, .Lcond_br_sgt$branch2 | |
| 71 | |
| 72 define internal i32 @cond_br_sge(i32 %arg1, i32 %arg2) { | |
| 73 entry: | |
| 74 %cmp1 = icmp sge i32 %arg1, %arg2 | |
| 75 br i1 %cmp1, label %branch1, label %branch2 | |
| 76 branch1: | |
| 77 ret i32 1 | |
| 78 branch2: | |
| 79 ret i32 2 | |
| 80 } | |
| 81 ; MIPS32-LABEL: cond_br_sge | |
| 82 ; MIPS32: slt $a0, $a0, $a1 | |
| 83 ; MIPS32: bnez $a0, .Lcond_br_sge$branch2 | |
| 84 | |
| 85 define internal i32 @cond_br_ugt(i32 %arg1, i32 %arg2) { | |
| 86 entry: | |
| 87 %cmp1 = icmp ugt i32 %arg1, %arg2 | |
| 88 br i1 %cmp1, label %branch1, label %branch2 | |
| 89 branch1: | |
| 90 ret i32 1 | |
| 91 branch2: | |
| 92 ret i32 2 | |
| 93 } | |
| 94 ; MIPS32-LABEL: cond_br_ugt | |
| 95 ; MIPS32: sltu $a1, $a1, $a0 | |
| 96 ; MIPS32: beqz $a1, .Lcond_br_ugt$branch2 | |
| 97 | |
| 98 define internal i32 @cond_br_uge(i32 %arg1, i32 %arg2) { | |
| 99 entry: | |
| 100 %cmp1 = icmp uge i32 %arg1, %arg2 | |
| 101 br i1 %cmp1, label %branch1, label %branch2 | |
| 102 branch1: | |
| 103 ret i32 1 | |
| 104 branch2: | |
| 105 ret i32 2 | |
| 106 } | |
| 107 ; MIPS32-LABEL: cond_br_uge | |
| 108 ; MIPS32: sltu $a0, $a0, $a1 | |
| 109 ; MIPS32: bnez $a0, .Lcond_br_uge$branch2 | |
| 110 | |
| 111 define internal i32 @cond_br_ult(i32 %arg1, i32 %arg2) { | |
| 112 entry: | |
| 113 %cmp1 = icmp ult i32 %arg1, %arg2 | |
| 114 br i1 %cmp1, label %branch1, label %branch2 | |
| 115 branch1: | |
| 116 ret i32 1 | |
| 117 branch2: | |
| 118 ret i32 2 | |
| 119 } | |
| 120 ; MIPS32-LABEL: cond_br_ult | |
| 121 ; MIPS32: sltu $a0, $a0, $a1 | |
| 122 ; MIPS32: beqz $a0, .Lcond_br_ult$branch2 | |
| 123 | |
| 124 define internal i32 @cond_br_ule(i32 %arg1, i32 %arg2) { | |
| 125 entry: | |
| 126 %cmp1 = icmp ule i32 %arg1, %arg2 | |
| 127 br i1 %cmp1, label %branch1, label %branch2 | |
| 128 branch1: | |
| 129 ret i32 1 | |
| 130 branch2: | |
| 131 ret i32 2 | |
| 132 } | |
| 133 ; MIPS32-LABEL: cond_br_ule | |
| 134 ; MIPS32: sltu $a1, $a1, $a0 | |
| 135 ; MIPS32: bnez $a1, .Lcond_br_ule$branch2 | |
| OLD | NEW |