1 # RUN: llc -march=hexagon -run-pass hexagon-bit-simplify -o - %s | FileCheck %s 2 3 --- | 4 @g0 = global i32 0, align 4 5 6 define i32 @f0() { ret i32 0 } 7 define i32 @f1() { ret i32 0 } 8 define i32 @f2() { ret i32 0 } 9 define i32 @f3() { ret i32 0 } 10 define i32 @f4() { ret i32 0 } 11 define i32 @f5() { ret i32 0 } 12 define i32 @f6() { ret i32 0 } 13 define i32 @f7() { ret i32 0 } 14 ... 15 16 # Case 0: is-zero with known zero register 17 # CHECK-LABEL: name: f0 18 # CHECK: %[[R00:[0-9]+]]:intregs = A2_tfrsi 1 19 # CHECK: $r0 = COPY %[[R00]] 20 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 21 22 name: f0 23 tracksRegLiveness: true 24 body: | 25 bb.0: 26 %0:intregs = A2_tfrsi 0 27 %2:intregs = A4_rcmpeqi killed %0, 0 28 $r0 = COPY %2 29 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 30 ... 31 32 # Case 1: is-zero with known non-zero register 33 # CHECK-LABEL: name: f1 34 # CHECK: %[[R10:[0-9]+]]:intregs = A2_tfrsi 0 35 # CHECK: $r0 = COPY %[[R10]] 36 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 37 38 name: f1 39 tracksRegLiveness: true 40 body: | 41 bb.0: 42 %0:intregs = A2_tfrsi 128 43 %2:intregs = A4_rcmpeqi killed %0, 0 44 $r0 = COPY %2 45 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 46 ... 47 48 # Case 2: is-not-zero with known zero register 49 # CHECK-LABEL: name: f2 50 # CHECK: %[[R20:[0-9]+]]:intregs = A2_tfrsi 0 51 # CHECK: $r0 = COPY %[[R20]] 52 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 53 54 name: f2 55 tracksRegLiveness: true 56 body: | 57 bb.0: 58 %0:intregs = A2_tfrsi 0 59 %2:intregs = A4_rcmpneqi killed %0, 0 60 $r0 = COPY %2 61 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 62 ... 63 64 # Case 3: is-not-zero with known non-zero register 65 # CHECK-LABEL: name: f3 66 # CHECK: %[[R30:[0-9]+]]:intregs = A2_tfrsi 1 67 # CHECK: $r0 = COPY %[[R30]] 68 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 69 70 name: f3 71 tracksRegLiveness: true 72 body: | 73 bb.0: 74 %0:intregs = A2_tfrsi 1024 75 %2:intregs = A4_rcmpneqi killed %0, 0 76 $r0 = COPY %2 77 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 78 ... 79 80 81 # Case 4: is-zero with mux(p, 1, 0) 82 # CHECK-LABEL: name: f4 83 # CHECK: %[[R40:[0-9]+]]:predregs = COPY $p0 84 # CHECK: %[[R41:[0-9]+]]:intregs = C2_muxii %[[R40]], 0, 1 85 # CHECK: $r0 = COPY %[[R41]] 86 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 87 88 name: f4 89 tracksRegLiveness: true 90 body: | 91 bb.0: 92 liveins: $p0 93 %0:predregs = COPY $p0 94 %1:intregs = C2_muxii %0, 1, 0 95 %2:intregs = A4_rcmpeqi killed %1, 0 96 $r0 = COPY %2 97 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 98 ... 99 100 # Case 5: is-zero with mux(p, 0, 1) 101 # CHECK-LABEL: name: f5 102 # CHECK: %[[R50:[0-9]+]]:predregs = COPY $p0 103 # CHECK: %[[R51:[0-9]+]]:intregs = C2_muxii %[[R50]], 1, 0 104 # CHECK: $r0 = COPY %[[R51]] 105 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 106 107 name: f5 108 tracksRegLiveness: true 109 body: | 110 bb.0: 111 liveins: $p0 112 %0:predregs = COPY $p0 113 %1:intregs = C2_muxii %0, 0, 1 114 %2:intregs = A4_rcmpeqi killed %1, 0 115 $r0 = COPY %2 116 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 117 ... 118 119 # Case 6: is-not-zero with mux(p, 1, 2) 120 # CHECK-LABEL: name: f6 121 # CHECK: %[[R60:[0-9]+]]:intregs = A2_tfrsi 1 122 # CHECK: $r0 = COPY %[[R60]] 123 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 124 125 name: f6 126 tracksRegLiveness: true 127 body: | 128 bb.0: 129 liveins: $p0 130 %0:predregs = COPY $p0 131 %1:intregs = C2_muxii %0, 1, 2 132 %2:intregs = A4_rcmpneqi killed %1, 0 133 $r0 = COPY %2 134 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 135 ... 136 137 # Case 7: is-not-zero with mux(p, @g0, 2) 138 # CHECK-LABEL: name: f7 139 # CHECK: %[[R70:[0-9]+]]:intregs = A2_tfrsi 1 140 # CHECK: $r0 = COPY %[[R70]] 141 # CHECK: PS_jmpret $r31, implicit-def dead $pc, implicit $r0 142 143 name: f7 144 tracksRegLiveness: true 145 body: | 146 bb.0: 147 liveins: $p0 148 %0:predregs = COPY $p0 149 %1:intregs = C2_muxii %0, @g0, 2 150 %2:intregs = A4_rcmpneqi killed %1, 0 151 $r0 = COPY %2 152 PS_jmpret $r31, implicit-def dead $pc, implicit $r0 153 ... 154 155