1 # RUN: llc -march=hexagon -run-pass hexagon-bit-simplify -o - %s | FileCheck %s
4 @g0 = global i32 0, align 4
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 }
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
23 tracksRegLiveness: true
26 %0:intregs = A2_tfrsi 0
27 %2:intregs = A4_rcmpeqi killed %0, 0
29 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
39 tracksRegLiveness: true
42 %0:intregs = A2_tfrsi 128
43 %2:intregs = A4_rcmpeqi killed %0, 0
45 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
55 tracksRegLiveness: true
58 %0:intregs = A2_tfrsi 0
59 %2:intregs = A4_rcmpneqi killed %0, 0
61 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
71 tracksRegLiveness: true
74 %0:intregs = A2_tfrsi 1024
75 %2:intregs = A4_rcmpneqi killed %0, 0
77 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
89 tracksRegLiveness: true
93 %0:predregs = COPY $p0
94 %1:intregs = C2_muxii %0, 1, 0
95 %2:intregs = A4_rcmpeqi killed %1, 0
97 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
108 tracksRegLiveness: true
112 %0:predregs = COPY $p0
113 %1:intregs = C2_muxii %0, 0, 1
114 %2:intregs = A4_rcmpeqi killed %1, 0
116 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
126 tracksRegLiveness: true
130 %0:predregs = COPY $p0
131 %1:intregs = C2_muxii %0, 1, 2
132 %2:intregs = A4_rcmpneqi killed %1, 0
134 PS_jmpret $r31, implicit-def dead $pc, implicit $r0
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
144 tracksRegLiveness: true
148 %0:predregs = COPY $p0
149 %1:intregs = C2_muxii %0, @g0, 2
150 %2:intregs = A4_rcmpneqi killed %1, 0
152 PS_jmpret $r31, implicit-def dead $pc, implicit $r0