Debian Codegraph @

llvm/test/CodeGen/RISCV/GlobalISel/legalizer/legalize-sub-rv32.mir

raw
1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv32 -run-pass=legalizer %s -o - \
3 # RUN: | FileCheck %s
4 ---
5 name: sub_i7
6 body: |
7 bb.0.entry:
8 ; CHECK-LABEL: name: sub_i7
9 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
11 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
12 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
13 ; CHECK-NEXT: PseudoRET implicit $x10
14 %0:_(s32) = COPY $x10
15 %1:_(s32) = COPY $x11
16 %2:_(s7) = G_TRUNC %0(s32)
17 %3:_(s7) = G_TRUNC %1(s32)
18 %4:_(s7) = G_SUB %2, %3
19 %5:_(s32) = G_ANYEXT %4(s7)
20 $x10 = COPY %5(s32)
21 PseudoRET implicit $x10
22
23 ...
24 ---
25 name: sub_i8
26 body: |
27 bb.0.entry:
28 ; CHECK-LABEL: name: sub_i8
29 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
30 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
31 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
32 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
33 ; CHECK-NEXT: PseudoRET implicit $x10
34 %0:_(s32) = COPY $x10
35 %1:_(s32) = COPY $x11
36 %2:_(s8) = G_TRUNC %0(s32)
37 %3:_(s8) = G_TRUNC %1(s32)
38 %4:_(s8) = G_SUB %2, %3
39 %5:_(s32) = G_ANYEXT %4(s8)
40 $x10 = COPY %5(s32)
41 PseudoRET implicit $x10
42
43 ...
44 ---
45 name: sub_i16
46 body: |
47 bb.0.entry:
48 ; CHECK-LABEL: name: sub_i16
49 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
50 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
51 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
52 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
53 ; CHECK-NEXT: PseudoRET implicit $x10
54 %0:_(s32) = COPY $x10
55 %1:_(s32) = COPY $x11
56 %2:_(s16) = G_TRUNC %0(s32)
57 %3:_(s16) = G_TRUNC %1(s32)
58 %4:_(s16) = G_SUB %2, %3
59 %5:_(s32) = G_ANYEXT %4(s16)
60 $x10 = COPY %5(s32)
61 PseudoRET implicit $x10
62
63 ...
64 ---
65 name: sub_i32
66 body: |
67 bb.0.entry:
68 ; CHECK-LABEL: name: sub_i32
69 ; CHECK: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
70 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
71 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB [[COPY]], [[COPY1]]
72 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
73 ; CHECK-NEXT: PseudoRET implicit $x10
74 %0:_(s32) = COPY $x10
75 %1:_(s32) = COPY $x11
76 %2:_(s32) = G_SUB %0, %1
77 $x10 = COPY %2(s32)
78 PseudoRET implicit $x10
79
80 ...
81 ---
82 name: sub_i48
83 body: |
84 bb.0.entry:
85 ; CHECK-LABEL: name: sub_i48
86 ; CHECK: %xlo:_(s32) = COPY $x10
87 ; CHECK-NEXT: %xhi:_(s32) = COPY $x11
88 ; CHECK-NEXT: %ylo:_(s32) = COPY $x12
89 ; CHECK-NEXT: %yhi:_(s32) = COPY $x13
90 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %xlo, %ylo
91 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %xlo(s32), %ylo
92 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB %xhi, %yhi
93 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]]
94 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
95 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s32)
96 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
97 %xlo:_(s32) = COPY $x10
98 %xhi:_(s32) = COPY $x11
99 %ylo:_(s32) = COPY $x12
100 %yhi:_(s32) = COPY $x13
101 %x0:_(s64) = G_MERGE_VALUES %xlo(s32), %xhi(s32)
102 %y0:_(s64) = G_MERGE_VALUES %ylo(s32), %yhi(s32)
103 %x:_(s48) = G_TRUNC %x0(s64)
104 %y:_(s48) = G_TRUNC %y0(s64)
105 %z:_(s48) = G_SUB %x, %y
106 %z0:_(s64) = G_ANYEXT %z(s48)
107 %zlo:_(s32), %zhi:_(s32) = G_UNMERGE_VALUES %z0(s64)
108 $x10 = COPY %zlo(s32)
109 $x11 = COPY %zhi(s32)
110 PseudoRET implicit $x10, implicit $x11
111
112 ...
113 ---
114 name: sub_i64
115 body: |
116 bb.0.entry:
117 ; CHECK-LABEL: name: sub_i64
118 ; CHECK: %lo1:_(s32) = COPY $x10
119 ; CHECK-NEXT: %hi1:_(s32) = COPY $x11
120 ; CHECK-NEXT: %lo2:_(s32) = COPY $x12
121 ; CHECK-NEXT: %hi2:_(s32) = COPY $x13
122 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %lo1, %lo2
123 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo1(s32), %lo2
124 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB %hi1, %hi2
125 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]]
126 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
127 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s32)
128 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
129 %lo1:_(s32) = COPY $x10
130 %hi1:_(s32) = COPY $x11
131 %lo2:_(s32) = COPY $x12
132 %hi2:_(s32) = COPY $x13
133 %x1:_(s64) = G_MERGE_VALUES %lo1(s32), %hi1(s32)
134 %x2:_(s64) = G_MERGE_VALUES %lo2(s32), %hi2(s32)
135 %y:_(s64) = G_SUB %x1, %x2
136 %loy:_(s32), %hiy:_(s32) = G_UNMERGE_VALUES %y(s64)
137 $x10 = COPY %loy(s32)
138 $x11 = COPY %hiy(s32)
139 PseudoRET implicit $x10, implicit $x11
140
141 ...
142 ---
143 name: sub_i96
144 body: |
145 bb.0.entry:
146 ; CHECK-LABEL: name: sub_i96
147 ; CHECK: %lo1:_(s32) = COPY $x10
148 ; CHECK-NEXT: %mid1:_(s32) = COPY $x11
149 ; CHECK-NEXT: %hi1:_(s32) = COPY $x12
150 ; CHECK-NEXT: %lo2:_(s32) = COPY $x13
151 ; CHECK-NEXT: %mid2:_(s32) = COPY $x14
152 ; CHECK-NEXT: %hi2:_(s32) = COPY $x15
153 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s32) = G_SUB %lo1, %lo2
154 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s32) = G_ICMP intpred(ult), %lo1(s32), %lo2
155 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s32) = G_SUB %mid1, %mid2
156 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s32) = G_ICMP intpred(ugt), [[SUB1]](s32), %mid1
157 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s32) = G_SUB [[SUB1]], [[ICMP]]
158 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 0
159 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s32) = G_ICMP intpred(eq), [[SUB1]](s32), [[C]]
160 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s32) = G_AND [[ICMP2]], [[ICMP]]
161 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s32) = G_OR [[ICMP1]], [[AND]]
162 ; CHECK-NEXT: [[SUB3:%[0-9]+]]:_(s32) = G_SUB %hi1, %hi2
163 ; CHECK-NEXT: [[SUB4:%[0-9]+]]:_(s32) = G_SUB [[SUB3]], [[OR]]
164 ; CHECK-NEXT: $x10 = COPY [[SUB]](s32)
165 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s32)
166 ; CHECK-NEXT: $x12 = COPY [[SUB4]](s32)
167 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
168 %lo1:_(s32) = COPY $x10
169 %mid1:_(s32) = COPY $x11
170 %hi1:_(s32) = COPY $x12
171 %lo2:_(s32) = COPY $x13
172 %mid2:_(s32) = COPY $x14
173 %hi2:_(s32) = COPY $x15
174 %x1:_(s96) = G_MERGE_VALUES %lo1(s32), %mid1(s32), %hi1(s32)
175 %x2:_(s96) = G_MERGE_VALUES %lo2(s32), %mid2(s32), %hi2(s32)
176 %y:_(s96) = G_SUB %x1, %x2
177 %lo:_(s32), %mid:_(s32), %hi:_(s32) = G_UNMERGE_VALUES %y(s96)
178 $x10 = COPY %lo(s32)
179 $x11 = COPY %mid(s32)
180 $x12 = COPY %hi(s32)
181 PseudoRET implicit $x10, implicit $x11, implicit $x12
182
183 ...