1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=riscv64 -run-pass=legalizer %s -o - \
8 ; CHECK-LABEL: name: sub_i8
9 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
10 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
11 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
12 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
13 ; CHECK-NEXT: PseudoRET implicit $x10
16 %2:_(s8) = G_TRUNC %0(s64)
17 %3:_(s8) = G_TRUNC %1(s64)
18 %4:_(s8) = G_SUB %2, %3
19 %5:_(s64) = G_ANYEXT %4(s8)
21 PseudoRET implicit $x10
28 ; CHECK-LABEL: name: sub_i15
29 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
30 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
31 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
32 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
33 ; CHECK-NEXT: PseudoRET implicit $x10
36 %2:_(s15) = G_TRUNC %0(s64)
37 %3:_(s15) = G_TRUNC %1(s64)
38 %4:_(s15) = G_SUB %2, %3
39 %5:_(s64) = G_ANYEXT %4(s15)
41 PseudoRET implicit $x10
48 ; CHECK-LABEL: name: sub_i16
49 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
50 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
51 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
52 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
53 ; CHECK-NEXT: PseudoRET implicit $x10
56 %2:_(s16) = G_TRUNC %0(s64)
57 %3:_(s16) = G_TRUNC %1(s64)
58 %4:_(s16) = G_SUB %2, %3
59 %5:_(s64) = G_ANYEXT %4(s16)
61 PseudoRET implicit $x10
68 ; CHECK-LABEL: name: sub_i32
69 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
70 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
71 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
72 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
73 ; CHECK-NEXT: PseudoRET implicit $x10
76 %2:_(s32) = G_TRUNC %0(s64)
77 %3:_(s32) = G_TRUNC %1(s64)
78 %4:_(s32) = G_SUB %2, %3
79 %5:_(s64) = G_ANYEXT %4(s32)
81 PseudoRET implicit $x10
88 ; CHECK-LABEL: name: sub_i64
89 ; CHECK: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
90 ; CHECK-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
91 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB [[COPY]], [[COPY1]]
92 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
93 ; CHECK-NEXT: PseudoRET implicit $x10
96 %2:_(s64) = G_SUB %0, %1
98 PseudoRET implicit $x10
105 ; CHECK-LABEL: name: sub_i72
106 ; CHECK: %x00:_(s64) = COPY $x10
107 ; CHECK-NEXT: %x01:_(s64) = COPY $x11
108 ; CHECK-NEXT: %y00:_(s64) = COPY $x12
109 ; CHECK-NEXT: %y01:_(s64) = COPY $x13
110 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %x00, %y00
111 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %x00(s64), %y00
112 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB %x01, %y01
113 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP]]
114 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
115 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
116 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
117 %x00:_(s64) = COPY $x10
118 %x01:_(s64) = COPY $x11
119 %y00:_(s64) = COPY $x12
120 %y01:_(s64) = COPY $x13
121 %x0:_(s128) = G_MERGE_VALUES %x00(s64), %x01
122 %y0:_(s128) = G_MERGE_VALUES %y00(s64), %y01
123 %x:_(s72) = G_TRUNC %x0(s128)
124 %y:_(s72) = G_TRUNC %y0(s128)
125 %z:_(s72) = G_SUB %x, %y
126 %z0:_(s128) = G_ANYEXT %z(s72)
127 %z00:_(s64), %z01:_(s64) = G_UNMERGE_VALUES %z0(s128)
128 $x10 = COPY %z00(s64)
129 $x11 = COPY %z01(s64)
130 PseudoRET implicit $x10, implicit $x11
137 ; CHECK-LABEL: name: sub_i128
138 ; CHECK: %lo1:_(s64) = COPY $x10
139 ; CHECK-NEXT: %hi1:_(s64) = COPY $x11
140 ; CHECK-NEXT: %lo2:_(s64) = COPY $x12
141 ; CHECK-NEXT: %hi2:_(s64) = COPY $x13
142 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %lo1, %lo2
143 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %lo1(s64), %lo2
144 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB %hi1, %hi2
145 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP]]
146 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
147 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
148 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11
149 %lo1:_(s64) = COPY $x10
150 %hi1:_(s64) = COPY $x11
151 %lo2:_(s64) = COPY $x12
152 %hi2:_(s64) = COPY $x13
153 %x1:_(s128) = G_MERGE_VALUES %lo1(s64), %hi1(s64)
154 %x2:_(s128) = G_MERGE_VALUES %lo2(s64), %hi2(s64)
155 %y:_(s128) = G_SUB %x1, %x2
156 %loy:_(s64), %hiy:_(s64) = G_UNMERGE_VALUES %y(s128)
157 $x10 = COPY %loy(s64)
158 $x11 = COPY %hiy(s64)
159 PseudoRET implicit $x10, implicit $x11
166 ; CHECK-LABEL: name: sub_i192
167 ; CHECK: %lo1:_(s64) = COPY $x10
168 ; CHECK-NEXT: %mid1:_(s64) = COPY $x11
169 ; CHECK-NEXT: %hi1:_(s64) = COPY $x12
170 ; CHECK-NEXT: %lo2:_(s64) = COPY $x13
171 ; CHECK-NEXT: %mid2:_(s64) = COPY $x14
172 ; CHECK-NEXT: %hi2:_(s64) = COPY $x15
173 ; CHECK-NEXT: [[SUB:%[0-9]+]]:_(s64) = G_SUB %lo1, %lo2
174 ; CHECK-NEXT: [[ICMP:%[0-9]+]]:_(s64) = G_ICMP intpred(ult), %lo1(s64), %lo2
175 ; CHECK-NEXT: [[SUB1:%[0-9]+]]:_(s64) = G_SUB %mid1, %mid2
176 ; CHECK-NEXT: [[ICMP1:%[0-9]+]]:_(s64) = G_ICMP intpred(ugt), [[SUB1]](s64), %mid1
177 ; CHECK-NEXT: [[SUB2:%[0-9]+]]:_(s64) = G_SUB [[SUB1]], [[ICMP]]
178 ; CHECK-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 0
179 ; CHECK-NEXT: [[ICMP2:%[0-9]+]]:_(s64) = G_ICMP intpred(eq), [[SUB1]](s64), [[C]]
180 ; CHECK-NEXT: [[AND:%[0-9]+]]:_(s64) = G_AND [[ICMP2]], [[ICMP]]
181 ; CHECK-NEXT: [[OR:%[0-9]+]]:_(s64) = G_OR [[ICMP1]], [[AND]]
182 ; CHECK-NEXT: [[SUB3:%[0-9]+]]:_(s64) = G_SUB %hi1, %hi2
183 ; CHECK-NEXT: [[SUB4:%[0-9]+]]:_(s64) = G_SUB [[SUB3]], [[OR]]
184 ; CHECK-NEXT: $x10 = COPY [[SUB]](s64)
185 ; CHECK-NEXT: $x11 = COPY [[SUB2]](s64)
186 ; CHECK-NEXT: $x12 = COPY [[SUB4]](s64)
187 ; CHECK-NEXT: PseudoRET implicit $x10, implicit $x11, implicit $x12
188 %lo1:_(s64) = COPY $x10
189 %mid1:_(s64) = COPY $x11
190 %hi1:_(s64) = COPY $x12
191 %lo2:_(s64) = COPY $x13
192 %mid2:_(s64) = COPY $x14
193 %hi2:_(s64) = COPY $x15
194 %x1:_(s192) = G_MERGE_VALUES %lo1(s64), %mid1(s64), %hi1(s64)
195 %x2:_(s192) = G_MERGE_VALUES %lo2(s64), %mid2(s64), %hi2(s64)
196 %y:_(s192) = G_SUB %x1, %x2
197 %lo:_(s64), %mid:_(s64), %hi:_(s64) = G_UNMERGE_VALUES %y(s192)
199 $x11 = COPY %mid(s64)
201 PseudoRET implicit $x10, implicit $x11, implicit $x12