1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -S -mtriple=x86_64-- -expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
3 ; RUN: opt -S -mtriple=x86_64-- -passes=expand-large-div-rem -expand-div-rem-bits 128 < %s | FileCheck %s
5 define <2 x i129> @sdiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
6 ; CHECK-LABEL: define <2 x i129> @sdiv129(
7 ; CHECK-SAME: <2 x i129> [[A:%.*]], <2 x i129> [[B:%.*]]) #[[ATTR0:[0-9]+]] {
8 ; CHECK-NEXT: _udiv-special-cases_udiv-special-cases:
9 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i129> [[A]], i64 0
10 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i129> [[B]], i64 0
11 ; CHECK-NEXT: [[TMP2:%.*]] = freeze i129 [[TMP0]]
12 ; CHECK-NEXT: [[TMP3:%.*]] = freeze i129 [[TMP1]]
13 ; CHECK-NEXT: [[TMP4:%.*]] = ashr i129 [[TMP2]], 128
14 ; CHECK-NEXT: [[TMP5:%.*]] = ashr i129 [[TMP3]], 128
15 ; CHECK-NEXT: [[TMP6:%.*]] = xor i129 [[TMP4]], [[TMP2]]
16 ; CHECK-NEXT: [[TMP7:%.*]] = sub i129 [[TMP6]], [[TMP4]]
17 ; CHECK-NEXT: [[TMP8:%.*]] = xor i129 [[TMP5]], [[TMP3]]
18 ; CHECK-NEXT: [[TMP9:%.*]] = sub i129 [[TMP8]], [[TMP5]]
19 ; CHECK-NEXT: [[TMP10:%.*]] = xor i129 [[TMP5]], [[TMP4]]
20 ; CHECK-NEXT: [[TMP11:%.*]] = freeze i129 [[TMP9]]
21 ; CHECK-NEXT: [[TMP12:%.*]] = freeze i129 [[TMP7]]
22 ; CHECK-NEXT: [[TMP13:%.*]] = icmp eq i129 [[TMP11]], 0
23 ; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i129 [[TMP12]], 0
24 ; CHECK-NEXT: [[TMP15:%.*]] = or i1 [[TMP13]], [[TMP14]]
25 ; CHECK-NEXT: [[TMP16:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP11]], i1 true)
26 ; CHECK-NEXT: [[TMP17:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP12]], i1 true)
27 ; CHECK-NEXT: [[TMP18:%.*]] = sub i129 [[TMP16]], [[TMP17]]
28 ; CHECK-NEXT: [[TMP19:%.*]] = icmp ugt i129 [[TMP18]], 128
29 ; CHECK-NEXT: [[TMP20:%.*]] = select i1 [[TMP15]], i1 true, i1 [[TMP19]]
30 ; CHECK-NEXT: [[TMP21:%.*]] = icmp eq i129 [[TMP18]], 128
31 ; CHECK-NEXT: [[TMP22:%.*]] = select i1 [[TMP20]], i129 0, i129 [[TMP12]]
32 ; CHECK-NEXT: [[TMP23:%.*]] = select i1 [[TMP20]], i1 true, i1 [[TMP21]]
33 ; CHECK-NEXT: br i1 [[TMP23]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
34 ; CHECK: udiv-loop-exit2:
35 ; CHECK-NEXT: [[TMP24:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP39:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
36 ; CHECK-NEXT: [[TMP25:%.*]] = phi i129 [ [[TMP48:%.*]], [[UDIV_BB15]] ], [ [[TMP36:%.*]], [[UDIV_DO_WHILE3]] ]
37 ; CHECK-NEXT: [[TMP26:%.*]] = shl i129 [[TMP25]], 1
38 ; CHECK-NEXT: [[TMP27:%.*]] = or i129 [[TMP24]], [[TMP26]]
39 ; CHECK-NEXT: br label [[UDIV_END1]]
40 ; CHECK: udiv-do-while3:
41 ; CHECK-NEXT: [[TMP28:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER4:%.*]] ], [ [[TMP39]], [[UDIV_DO_WHILE3]] ]
42 ; CHECK-NEXT: [[TMP29:%.*]] = phi i129 [ [[TMP46:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP42:%.*]], [[UDIV_DO_WHILE3]] ]
43 ; CHECK-NEXT: [[TMP30:%.*]] = phi i129 [ [[TMP44:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP41:%.*]], [[UDIV_DO_WHILE3]] ]
44 ; CHECK-NEXT: [[TMP31:%.*]] = phi i129 [ [[TMP48]], [[UDIV_PREHEADER4]] ], [ [[TMP36]], [[UDIV_DO_WHILE3]] ]
45 ; CHECK-NEXT: [[TMP32:%.*]] = shl i129 [[TMP30]], 1
46 ; CHECK-NEXT: [[TMP33:%.*]] = lshr i129 [[TMP31]], 128
47 ; CHECK-NEXT: [[TMP34:%.*]] = or i129 [[TMP32]], [[TMP33]]
48 ; CHECK-NEXT: [[TMP35:%.*]] = shl i129 [[TMP31]], 1
49 ; CHECK-NEXT: [[TMP36]] = or i129 [[TMP28]], [[TMP35]]
50 ; CHECK-NEXT: [[TMP37:%.*]] = sub i129 [[TMP45:%.*]], [[TMP34]]
51 ; CHECK-NEXT: [[TMP38:%.*]] = ashr i129 [[TMP37]], 128
52 ; CHECK-NEXT: [[TMP39]] = and i129 [[TMP38]], 1
53 ; CHECK-NEXT: [[TMP40:%.*]] = and i129 [[TMP38]], [[TMP11]]
54 ; CHECK-NEXT: [[TMP41]] = sub i129 [[TMP34]], [[TMP40]]
55 ; CHECK-NEXT: [[TMP42]] = add i129 [[TMP29]], -1
56 ; CHECK-NEXT: [[TMP43:%.*]] = icmp eq i129 [[TMP42]], 0
57 ; CHECK-NEXT: br i1 [[TMP43]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
58 ; CHECK: udiv-preheader4:
59 ; CHECK-NEXT: [[TMP44]] = lshr i129 [[TMP12]], [[TMP46]]
60 ; CHECK-NEXT: [[TMP45]] = add i129 [[TMP11]], -1
61 ; CHECK-NEXT: br label [[UDIV_DO_WHILE3]]
63 ; CHECK-NEXT: [[TMP46]] = add i129 [[TMP18]], 1
64 ; CHECK-NEXT: [[TMP47:%.*]] = sub i129 128, [[TMP18]]
65 ; CHECK-NEXT: [[TMP48]] = shl i129 [[TMP12]], [[TMP47]]
66 ; CHECK-NEXT: [[TMP49:%.*]] = icmp eq i129 [[TMP46]], 0
67 ; CHECK-NEXT: br i1 [[TMP49]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
69 ; CHECK-NEXT: [[TMP50:%.*]] = phi i129 [ [[TMP27]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP22]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
70 ; CHECK-NEXT: [[TMP51:%.*]] = xor i129 [[TMP50]], [[TMP10]]
71 ; CHECK-NEXT: [[TMP52:%.*]] = sub i129 [[TMP51]], [[TMP10]]
72 ; CHECK-NEXT: [[TMP53:%.*]] = insertelement <2 x i129> poison, i129 [[TMP52]], i64 0
73 ; CHECK-NEXT: [[TMP54:%.*]] = extractelement <2 x i129> [[A]], i64 1
74 ; CHECK-NEXT: [[TMP55:%.*]] = extractelement <2 x i129> [[B]], i64 1
75 ; CHECK-NEXT: [[TMP56:%.*]] = freeze i129 [[TMP54]]
76 ; CHECK-NEXT: [[TMP57:%.*]] = freeze i129 [[TMP55]]
77 ; CHECK-NEXT: [[TMP58:%.*]] = ashr i129 [[TMP56]], 128
78 ; CHECK-NEXT: [[TMP59:%.*]] = ashr i129 [[TMP57]], 128
79 ; CHECK-NEXT: [[TMP60:%.*]] = xor i129 [[TMP58]], [[TMP56]]
80 ; CHECK-NEXT: [[TMP61:%.*]] = sub i129 [[TMP60]], [[TMP58]]
81 ; CHECK-NEXT: [[TMP62:%.*]] = xor i129 [[TMP59]], [[TMP57]]
82 ; CHECK-NEXT: [[TMP63:%.*]] = sub i129 [[TMP62]], [[TMP59]]
83 ; CHECK-NEXT: [[TMP64:%.*]] = xor i129 [[TMP59]], [[TMP58]]
84 ; CHECK-NEXT: [[TMP65:%.*]] = freeze i129 [[TMP63]]
85 ; CHECK-NEXT: [[TMP66:%.*]] = freeze i129 [[TMP61]]
86 ; CHECK-NEXT: [[TMP67:%.*]] = icmp eq i129 [[TMP65]], 0
87 ; CHECK-NEXT: [[TMP68:%.*]] = icmp eq i129 [[TMP66]], 0
88 ; CHECK-NEXT: [[TMP69:%.*]] = or i1 [[TMP67]], [[TMP68]]
89 ; CHECK-NEXT: [[TMP70:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP65]], i1 true)
90 ; CHECK-NEXT: [[TMP71:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP66]], i1 true)
91 ; CHECK-NEXT: [[TMP72:%.*]] = sub i129 [[TMP70]], [[TMP71]]
92 ; CHECK-NEXT: [[TMP73:%.*]] = icmp ugt i129 [[TMP72]], 128
93 ; CHECK-NEXT: [[TMP74:%.*]] = select i1 [[TMP69]], i1 true, i1 [[TMP73]]
94 ; CHECK-NEXT: [[TMP75:%.*]] = icmp eq i129 [[TMP72]], 128
95 ; CHECK-NEXT: [[TMP76:%.*]] = select i1 [[TMP74]], i129 0, i129 [[TMP66]]
96 ; CHECK-NEXT: [[TMP77:%.*]] = select i1 [[TMP74]], i1 true, i1 [[TMP75]]
97 ; CHECK-NEXT: br i1 [[TMP77]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
98 ; CHECK: udiv-loop-exit:
99 ; CHECK-NEXT: [[TMP78:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP93:%.*]], [[UDIV_DO_WHILE:%.*]] ]
100 ; CHECK-NEXT: [[TMP79:%.*]] = phi i129 [ [[TMP102:%.*]], [[UDIV_BB1]] ], [ [[TMP90:%.*]], [[UDIV_DO_WHILE]] ]
101 ; CHECK-NEXT: [[TMP80:%.*]] = shl i129 [[TMP79]], 1
102 ; CHECK-NEXT: [[TMP81:%.*]] = or i129 [[TMP78]], [[TMP80]]
103 ; CHECK-NEXT: br label [[UDIV_END]]
104 ; CHECK: udiv-do-while:
105 ; CHECK-NEXT: [[TMP82:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER:%.*]] ], [ [[TMP93]], [[UDIV_DO_WHILE]] ]
106 ; CHECK-NEXT: [[TMP83:%.*]] = phi i129 [ [[TMP100:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP96:%.*]], [[UDIV_DO_WHILE]] ]
107 ; CHECK-NEXT: [[TMP84:%.*]] = phi i129 [ [[TMP98:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP95:%.*]], [[UDIV_DO_WHILE]] ]
108 ; CHECK-NEXT: [[TMP85:%.*]] = phi i129 [ [[TMP102]], [[UDIV_PREHEADER]] ], [ [[TMP90]], [[UDIV_DO_WHILE]] ]
109 ; CHECK-NEXT: [[TMP86:%.*]] = shl i129 [[TMP84]], 1
110 ; CHECK-NEXT: [[TMP87:%.*]] = lshr i129 [[TMP85]], 128
111 ; CHECK-NEXT: [[TMP88:%.*]] = or i129 [[TMP86]], [[TMP87]]
112 ; CHECK-NEXT: [[TMP89:%.*]] = shl i129 [[TMP85]], 1
113 ; CHECK-NEXT: [[TMP90]] = or i129 [[TMP82]], [[TMP89]]
114 ; CHECK-NEXT: [[TMP91:%.*]] = sub i129 [[TMP99:%.*]], [[TMP88]]
115 ; CHECK-NEXT: [[TMP92:%.*]] = ashr i129 [[TMP91]], 128
116 ; CHECK-NEXT: [[TMP93]] = and i129 [[TMP92]], 1
117 ; CHECK-NEXT: [[TMP94:%.*]] = and i129 [[TMP92]], [[TMP65]]
118 ; CHECK-NEXT: [[TMP95]] = sub i129 [[TMP88]], [[TMP94]]
119 ; CHECK-NEXT: [[TMP96]] = add i129 [[TMP83]], -1
120 ; CHECK-NEXT: [[TMP97:%.*]] = icmp eq i129 [[TMP96]], 0
121 ; CHECK-NEXT: br i1 [[TMP97]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
122 ; CHECK: udiv-preheader:
123 ; CHECK-NEXT: [[TMP98]] = lshr i129 [[TMP66]], [[TMP100]]
124 ; CHECK-NEXT: [[TMP99]] = add i129 [[TMP65]], -1
125 ; CHECK-NEXT: br label [[UDIV_DO_WHILE]]
127 ; CHECK-NEXT: [[TMP100]] = add i129 [[TMP72]], 1
128 ; CHECK-NEXT: [[TMP101:%.*]] = sub i129 128, [[TMP72]]
129 ; CHECK-NEXT: [[TMP102]] = shl i129 [[TMP66]], [[TMP101]]
130 ; CHECK-NEXT: [[TMP103:%.*]] = icmp eq i129 [[TMP100]], 0
131 ; CHECK-NEXT: br i1 [[TMP103]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
133 ; CHECK-NEXT: [[TMP104:%.*]] = phi i129 [ [[TMP81]], [[UDIV_LOOP_EXIT]] ], [ [[TMP76]], [[UDIV_END1]] ]
134 ; CHECK-NEXT: [[TMP105:%.*]] = xor i129 [[TMP104]], [[TMP64]]
135 ; CHECK-NEXT: [[TMP106:%.*]] = sub i129 [[TMP105]], [[TMP64]]
136 ; CHECK-NEXT: [[TMP107:%.*]] = insertelement <2 x i129> [[TMP53]], i129 [[TMP106]], i64 1
137 ; CHECK-NEXT: ret <2 x i129> [[TMP107]]
139 %res = sdiv <2 x i129> %a, %b
143 define <2 x i129> @udiv129(<2 x i129> %a, <2 x i129> %b) nounwind {
144 ; CHECK-LABEL: define <2 x i129> @udiv129(
145 ; CHECK-SAME: <2 x i129> [[A:%.*]], <2 x i129> [[B:%.*]]) #[[ATTR0]] {
146 ; CHECK-NEXT: _udiv-special-cases_udiv-special-cases:
147 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i129> [[A]], i64 0
148 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i129> [[B]], i64 0
149 ; CHECK-NEXT: [[TMP2:%.*]] = freeze i129 [[TMP1]]
150 ; CHECK-NEXT: [[TMP3:%.*]] = freeze i129 [[TMP0]]
151 ; CHECK-NEXT: [[TMP4:%.*]] = icmp eq i129 [[TMP2]], 0
152 ; CHECK-NEXT: [[TMP5:%.*]] = icmp eq i129 [[TMP3]], 0
153 ; CHECK-NEXT: [[TMP6:%.*]] = or i1 [[TMP4]], [[TMP5]]
154 ; CHECK-NEXT: [[TMP7:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP2]], i1 true)
155 ; CHECK-NEXT: [[TMP8:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP3]], i1 true)
156 ; CHECK-NEXT: [[TMP9:%.*]] = sub i129 [[TMP7]], [[TMP8]]
157 ; CHECK-NEXT: [[TMP10:%.*]] = icmp ugt i129 [[TMP9]], 128
158 ; CHECK-NEXT: [[TMP11:%.*]] = select i1 [[TMP6]], i1 true, i1 [[TMP10]]
159 ; CHECK-NEXT: [[TMP12:%.*]] = icmp eq i129 [[TMP9]], 128
160 ; CHECK-NEXT: [[TMP13:%.*]] = select i1 [[TMP11]], i129 0, i129 [[TMP3]]
161 ; CHECK-NEXT: [[TMP14:%.*]] = select i1 [[TMP11]], i1 true, i1 [[TMP12]]
162 ; CHECK-NEXT: br i1 [[TMP14]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
163 ; CHECK: udiv-loop-exit2:
164 ; CHECK-NEXT: [[TMP15:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP30:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
165 ; CHECK-NEXT: [[TMP16:%.*]] = phi i129 [ [[TMP39:%.*]], [[UDIV_BB15]] ], [ [[TMP27:%.*]], [[UDIV_DO_WHILE3]] ]
166 ; CHECK-NEXT: [[TMP17:%.*]] = shl i129 [[TMP16]], 1
167 ; CHECK-NEXT: [[TMP18:%.*]] = or i129 [[TMP15]], [[TMP17]]
168 ; CHECK-NEXT: br label [[UDIV_END1]]
169 ; CHECK: udiv-do-while3:
170 ; CHECK-NEXT: [[TMP19:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER4:%.*]] ], [ [[TMP30]], [[UDIV_DO_WHILE3]] ]
171 ; CHECK-NEXT: [[TMP20:%.*]] = phi i129 [ [[TMP37:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP33:%.*]], [[UDIV_DO_WHILE3]] ]
172 ; CHECK-NEXT: [[TMP21:%.*]] = phi i129 [ [[TMP35:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP32:%.*]], [[UDIV_DO_WHILE3]] ]
173 ; CHECK-NEXT: [[TMP22:%.*]] = phi i129 [ [[TMP39]], [[UDIV_PREHEADER4]] ], [ [[TMP27]], [[UDIV_DO_WHILE3]] ]
174 ; CHECK-NEXT: [[TMP23:%.*]] = shl i129 [[TMP21]], 1
175 ; CHECK-NEXT: [[TMP24:%.*]] = lshr i129 [[TMP22]], 128
176 ; CHECK-NEXT: [[TMP25:%.*]] = or i129 [[TMP23]], [[TMP24]]
177 ; CHECK-NEXT: [[TMP26:%.*]] = shl i129 [[TMP22]], 1
178 ; CHECK-NEXT: [[TMP27]] = or i129 [[TMP19]], [[TMP26]]
179 ; CHECK-NEXT: [[TMP28:%.*]] = sub i129 [[TMP36:%.*]], [[TMP25]]
180 ; CHECK-NEXT: [[TMP29:%.*]] = ashr i129 [[TMP28]], 128
181 ; CHECK-NEXT: [[TMP30]] = and i129 [[TMP29]], 1
182 ; CHECK-NEXT: [[TMP31:%.*]] = and i129 [[TMP29]], [[TMP2]]
183 ; CHECK-NEXT: [[TMP32]] = sub i129 [[TMP25]], [[TMP31]]
184 ; CHECK-NEXT: [[TMP33]] = add i129 [[TMP20]], -1
185 ; CHECK-NEXT: [[TMP34:%.*]] = icmp eq i129 [[TMP33]], 0
186 ; CHECK-NEXT: br i1 [[TMP34]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
187 ; CHECK: udiv-preheader4:
188 ; CHECK-NEXT: [[TMP35]] = lshr i129 [[TMP3]], [[TMP37]]
189 ; CHECK-NEXT: [[TMP36]] = add i129 [[TMP2]], -1
190 ; CHECK-NEXT: br label [[UDIV_DO_WHILE3]]
192 ; CHECK-NEXT: [[TMP37]] = add i129 [[TMP9]], 1
193 ; CHECK-NEXT: [[TMP38:%.*]] = sub i129 128, [[TMP9]]
194 ; CHECK-NEXT: [[TMP39]] = shl i129 [[TMP3]], [[TMP38]]
195 ; CHECK-NEXT: [[TMP40:%.*]] = icmp eq i129 [[TMP37]], 0
196 ; CHECK-NEXT: br i1 [[TMP40]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
198 ; CHECK-NEXT: [[TMP41:%.*]] = phi i129 [ [[TMP18]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP13]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
199 ; CHECK-NEXT: [[TMP42:%.*]] = insertelement <2 x i129> poison, i129 [[TMP41]], i64 0
200 ; CHECK-NEXT: [[TMP43:%.*]] = extractelement <2 x i129> [[A]], i64 1
201 ; CHECK-NEXT: [[TMP44:%.*]] = extractelement <2 x i129> [[B]], i64 1
202 ; CHECK-NEXT: [[TMP45:%.*]] = freeze i129 [[TMP44]]
203 ; CHECK-NEXT: [[TMP46:%.*]] = freeze i129 [[TMP43]]
204 ; CHECK-NEXT: [[TMP47:%.*]] = icmp eq i129 [[TMP45]], 0
205 ; CHECK-NEXT: [[TMP48:%.*]] = icmp eq i129 [[TMP46]], 0
206 ; CHECK-NEXT: [[TMP49:%.*]] = or i1 [[TMP47]], [[TMP48]]
207 ; CHECK-NEXT: [[TMP50:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP45]], i1 true)
208 ; CHECK-NEXT: [[TMP51:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP46]], i1 true)
209 ; CHECK-NEXT: [[TMP52:%.*]] = sub i129 [[TMP50]], [[TMP51]]
210 ; CHECK-NEXT: [[TMP53:%.*]] = icmp ugt i129 [[TMP52]], 128
211 ; CHECK-NEXT: [[TMP54:%.*]] = select i1 [[TMP49]], i1 true, i1 [[TMP53]]
212 ; CHECK-NEXT: [[TMP55:%.*]] = icmp eq i129 [[TMP52]], 128
213 ; CHECK-NEXT: [[TMP56:%.*]] = select i1 [[TMP54]], i129 0, i129 [[TMP46]]
214 ; CHECK-NEXT: [[TMP57:%.*]] = select i1 [[TMP54]], i1 true, i1 [[TMP55]]
215 ; CHECK-NEXT: br i1 [[TMP57]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
216 ; CHECK: udiv-loop-exit:
217 ; CHECK-NEXT: [[TMP58:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP73:%.*]], [[UDIV_DO_WHILE:%.*]] ]
218 ; CHECK-NEXT: [[TMP59:%.*]] = phi i129 [ [[TMP82:%.*]], [[UDIV_BB1]] ], [ [[TMP70:%.*]], [[UDIV_DO_WHILE]] ]
219 ; CHECK-NEXT: [[TMP60:%.*]] = shl i129 [[TMP59]], 1
220 ; CHECK-NEXT: [[TMP61:%.*]] = or i129 [[TMP58]], [[TMP60]]
221 ; CHECK-NEXT: br label [[UDIV_END]]
222 ; CHECK: udiv-do-while:
223 ; CHECK-NEXT: [[TMP62:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER:%.*]] ], [ [[TMP73]], [[UDIV_DO_WHILE]] ]
224 ; CHECK-NEXT: [[TMP63:%.*]] = phi i129 [ [[TMP80:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP76:%.*]], [[UDIV_DO_WHILE]] ]
225 ; CHECK-NEXT: [[TMP64:%.*]] = phi i129 [ [[TMP78:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP75:%.*]], [[UDIV_DO_WHILE]] ]
226 ; CHECK-NEXT: [[TMP65:%.*]] = phi i129 [ [[TMP82]], [[UDIV_PREHEADER]] ], [ [[TMP70]], [[UDIV_DO_WHILE]] ]
227 ; CHECK-NEXT: [[TMP66:%.*]] = shl i129 [[TMP64]], 1
228 ; CHECK-NEXT: [[TMP67:%.*]] = lshr i129 [[TMP65]], 128
229 ; CHECK-NEXT: [[TMP68:%.*]] = or i129 [[TMP66]], [[TMP67]]
230 ; CHECK-NEXT: [[TMP69:%.*]] = shl i129 [[TMP65]], 1
231 ; CHECK-NEXT: [[TMP70]] = or i129 [[TMP62]], [[TMP69]]
232 ; CHECK-NEXT: [[TMP71:%.*]] = sub i129 [[TMP79:%.*]], [[TMP68]]
233 ; CHECK-NEXT: [[TMP72:%.*]] = ashr i129 [[TMP71]], 128
234 ; CHECK-NEXT: [[TMP73]] = and i129 [[TMP72]], 1
235 ; CHECK-NEXT: [[TMP74:%.*]] = and i129 [[TMP72]], [[TMP45]]
236 ; CHECK-NEXT: [[TMP75]] = sub i129 [[TMP68]], [[TMP74]]
237 ; CHECK-NEXT: [[TMP76]] = add i129 [[TMP63]], -1
238 ; CHECK-NEXT: [[TMP77:%.*]] = icmp eq i129 [[TMP76]], 0
239 ; CHECK-NEXT: br i1 [[TMP77]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
240 ; CHECK: udiv-preheader:
241 ; CHECK-NEXT: [[TMP78]] = lshr i129 [[TMP46]], [[TMP80]]
242 ; CHECK-NEXT: [[TMP79]] = add i129 [[TMP45]], -1
243 ; CHECK-NEXT: br label [[UDIV_DO_WHILE]]
245 ; CHECK-NEXT: [[TMP80]] = add i129 [[TMP52]], 1
246 ; CHECK-NEXT: [[TMP81:%.*]] = sub i129 128, [[TMP52]]
247 ; CHECK-NEXT: [[TMP82]] = shl i129 [[TMP46]], [[TMP81]]
248 ; CHECK-NEXT: [[TMP83:%.*]] = icmp eq i129 [[TMP80]], 0
249 ; CHECK-NEXT: br i1 [[TMP83]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
251 ; CHECK-NEXT: [[TMP84:%.*]] = phi i129 [ [[TMP61]], [[UDIV_LOOP_EXIT]] ], [ [[TMP56]], [[UDIV_END1]] ]
252 ; CHECK-NEXT: [[TMP85:%.*]] = insertelement <2 x i129> [[TMP42]], i129 [[TMP84]], i64 1
253 ; CHECK-NEXT: ret <2 x i129> [[TMP85]]
255 %res = udiv <2 x i129> %a, %b
259 define <2 x i129> @srem129(<2 x i129> %a, <2 x i129> %b) nounwind {
260 ; CHECK-LABEL: define <2 x i129> @srem129(
261 ; CHECK-SAME: <2 x i129> [[A:%.*]], <2 x i129> [[B:%.*]]) #[[ATTR0]] {
262 ; CHECK-NEXT: _udiv-special-cases_udiv-special-cases:
263 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i129> [[A]], i64 0
264 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i129> [[B]], i64 0
265 ; CHECK-NEXT: [[TMP2:%.*]] = freeze i129 [[TMP0]]
266 ; CHECK-NEXT: [[TMP3:%.*]] = freeze i129 [[TMP1]]
267 ; CHECK-NEXT: [[TMP4:%.*]] = ashr i129 [[TMP2]], 128
268 ; CHECK-NEXT: [[TMP5:%.*]] = ashr i129 [[TMP3]], 128
269 ; CHECK-NEXT: [[TMP6:%.*]] = xor i129 [[TMP2]], [[TMP4]]
270 ; CHECK-NEXT: [[TMP7:%.*]] = xor i129 [[TMP3]], [[TMP5]]
271 ; CHECK-NEXT: [[TMP8:%.*]] = sub i129 [[TMP6]], [[TMP4]]
272 ; CHECK-NEXT: [[TMP9:%.*]] = sub i129 [[TMP7]], [[TMP5]]
273 ; CHECK-NEXT: [[TMP10:%.*]] = freeze i129 [[TMP8]]
274 ; CHECK-NEXT: [[TMP11:%.*]] = freeze i129 [[TMP9]]
275 ; CHECK-NEXT: [[TMP12:%.*]] = freeze i129 [[TMP11]]
276 ; CHECK-NEXT: [[TMP13:%.*]] = freeze i129 [[TMP10]]
277 ; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i129 [[TMP12]], 0
278 ; CHECK-NEXT: [[TMP15:%.*]] = icmp eq i129 [[TMP13]], 0
279 ; CHECK-NEXT: [[TMP16:%.*]] = or i1 [[TMP14]], [[TMP15]]
280 ; CHECK-NEXT: [[TMP17:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP12]], i1 true)
281 ; CHECK-NEXT: [[TMP18:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP13]], i1 true)
282 ; CHECK-NEXT: [[TMP19:%.*]] = sub i129 [[TMP17]], [[TMP18]]
283 ; CHECK-NEXT: [[TMP20:%.*]] = icmp ugt i129 [[TMP19]], 128
284 ; CHECK-NEXT: [[TMP21:%.*]] = select i1 [[TMP16]], i1 true, i1 [[TMP20]]
285 ; CHECK-NEXT: [[TMP22:%.*]] = icmp eq i129 [[TMP19]], 128
286 ; CHECK-NEXT: [[TMP23:%.*]] = select i1 [[TMP21]], i129 0, i129 [[TMP13]]
287 ; CHECK-NEXT: [[TMP24:%.*]] = select i1 [[TMP21]], i1 true, i1 [[TMP22]]
288 ; CHECK-NEXT: br i1 [[TMP24]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
289 ; CHECK: udiv-loop-exit2:
290 ; CHECK-NEXT: [[TMP25:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP40:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
291 ; CHECK-NEXT: [[TMP26:%.*]] = phi i129 [ [[TMP49:%.*]], [[UDIV_BB15]] ], [ [[TMP37:%.*]], [[UDIV_DO_WHILE3]] ]
292 ; CHECK-NEXT: [[TMP27:%.*]] = shl i129 [[TMP26]], 1
293 ; CHECK-NEXT: [[TMP28:%.*]] = or i129 [[TMP25]], [[TMP27]]
294 ; CHECK-NEXT: br label [[UDIV_END1]]
295 ; CHECK: udiv-do-while3:
296 ; CHECK-NEXT: [[TMP29:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER4:%.*]] ], [ [[TMP40]], [[UDIV_DO_WHILE3]] ]
297 ; CHECK-NEXT: [[TMP30:%.*]] = phi i129 [ [[TMP47:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP43:%.*]], [[UDIV_DO_WHILE3]] ]
298 ; CHECK-NEXT: [[TMP31:%.*]] = phi i129 [ [[TMP45:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP42:%.*]], [[UDIV_DO_WHILE3]] ]
299 ; CHECK-NEXT: [[TMP32:%.*]] = phi i129 [ [[TMP49]], [[UDIV_PREHEADER4]] ], [ [[TMP37]], [[UDIV_DO_WHILE3]] ]
300 ; CHECK-NEXT: [[TMP33:%.*]] = shl i129 [[TMP31]], 1
301 ; CHECK-NEXT: [[TMP34:%.*]] = lshr i129 [[TMP32]], 128
302 ; CHECK-NEXT: [[TMP35:%.*]] = or i129 [[TMP33]], [[TMP34]]
303 ; CHECK-NEXT: [[TMP36:%.*]] = shl i129 [[TMP32]], 1
304 ; CHECK-NEXT: [[TMP37]] = or i129 [[TMP29]], [[TMP36]]
305 ; CHECK-NEXT: [[TMP38:%.*]] = sub i129 [[TMP46:%.*]], [[TMP35]]
306 ; CHECK-NEXT: [[TMP39:%.*]] = ashr i129 [[TMP38]], 128
307 ; CHECK-NEXT: [[TMP40]] = and i129 [[TMP39]], 1
308 ; CHECK-NEXT: [[TMP41:%.*]] = and i129 [[TMP39]], [[TMP12]]
309 ; CHECK-NEXT: [[TMP42]] = sub i129 [[TMP35]], [[TMP41]]
310 ; CHECK-NEXT: [[TMP43]] = add i129 [[TMP30]], -1
311 ; CHECK-NEXT: [[TMP44:%.*]] = icmp eq i129 [[TMP43]], 0
312 ; CHECK-NEXT: br i1 [[TMP44]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
313 ; CHECK: udiv-preheader4:
314 ; CHECK-NEXT: [[TMP45]] = lshr i129 [[TMP13]], [[TMP47]]
315 ; CHECK-NEXT: [[TMP46]] = add i129 [[TMP12]], -1
316 ; CHECK-NEXT: br label [[UDIV_DO_WHILE3]]
318 ; CHECK-NEXT: [[TMP47]] = add i129 [[TMP19]], 1
319 ; CHECK-NEXT: [[TMP48:%.*]] = sub i129 128, [[TMP19]]
320 ; CHECK-NEXT: [[TMP49]] = shl i129 [[TMP13]], [[TMP48]]
321 ; CHECK-NEXT: [[TMP50:%.*]] = icmp eq i129 [[TMP47]], 0
322 ; CHECK-NEXT: br i1 [[TMP50]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
324 ; CHECK-NEXT: [[TMP51:%.*]] = phi i129 [ [[TMP28]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP23]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
325 ; CHECK-NEXT: [[TMP52:%.*]] = mul i129 [[TMP11]], [[TMP51]]
326 ; CHECK-NEXT: [[TMP53:%.*]] = sub i129 [[TMP10]], [[TMP52]]
327 ; CHECK-NEXT: [[TMP54:%.*]] = xor i129 [[TMP53]], [[TMP4]]
328 ; CHECK-NEXT: [[TMP55:%.*]] = sub i129 [[TMP54]], [[TMP4]]
329 ; CHECK-NEXT: [[TMP56:%.*]] = insertelement <2 x i129> poison, i129 [[TMP55]], i64 0
330 ; CHECK-NEXT: [[TMP57:%.*]] = extractelement <2 x i129> [[A]], i64 1
331 ; CHECK-NEXT: [[TMP58:%.*]] = extractelement <2 x i129> [[B]], i64 1
332 ; CHECK-NEXT: [[TMP59:%.*]] = freeze i129 [[TMP57]]
333 ; CHECK-NEXT: [[TMP60:%.*]] = freeze i129 [[TMP58]]
334 ; CHECK-NEXT: [[TMP61:%.*]] = ashr i129 [[TMP59]], 128
335 ; CHECK-NEXT: [[TMP62:%.*]] = ashr i129 [[TMP60]], 128
336 ; CHECK-NEXT: [[TMP63:%.*]] = xor i129 [[TMP59]], [[TMP61]]
337 ; CHECK-NEXT: [[TMP64:%.*]] = xor i129 [[TMP60]], [[TMP62]]
338 ; CHECK-NEXT: [[TMP65:%.*]] = sub i129 [[TMP63]], [[TMP61]]
339 ; CHECK-NEXT: [[TMP66:%.*]] = sub i129 [[TMP64]], [[TMP62]]
340 ; CHECK-NEXT: [[TMP67:%.*]] = freeze i129 [[TMP65]]
341 ; CHECK-NEXT: [[TMP68:%.*]] = freeze i129 [[TMP66]]
342 ; CHECK-NEXT: [[TMP69:%.*]] = freeze i129 [[TMP68]]
343 ; CHECK-NEXT: [[TMP70:%.*]] = freeze i129 [[TMP67]]
344 ; CHECK-NEXT: [[TMP71:%.*]] = icmp eq i129 [[TMP69]], 0
345 ; CHECK-NEXT: [[TMP72:%.*]] = icmp eq i129 [[TMP70]], 0
346 ; CHECK-NEXT: [[TMP73:%.*]] = or i1 [[TMP71]], [[TMP72]]
347 ; CHECK-NEXT: [[TMP74:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP69]], i1 true)
348 ; CHECK-NEXT: [[TMP75:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP70]], i1 true)
349 ; CHECK-NEXT: [[TMP76:%.*]] = sub i129 [[TMP74]], [[TMP75]]
350 ; CHECK-NEXT: [[TMP77:%.*]] = icmp ugt i129 [[TMP76]], 128
351 ; CHECK-NEXT: [[TMP78:%.*]] = select i1 [[TMP73]], i1 true, i1 [[TMP77]]
352 ; CHECK-NEXT: [[TMP79:%.*]] = icmp eq i129 [[TMP76]], 128
353 ; CHECK-NEXT: [[TMP80:%.*]] = select i1 [[TMP78]], i129 0, i129 [[TMP70]]
354 ; CHECK-NEXT: [[TMP81:%.*]] = select i1 [[TMP78]], i1 true, i1 [[TMP79]]
355 ; CHECK-NEXT: br i1 [[TMP81]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
356 ; CHECK: udiv-loop-exit:
357 ; CHECK-NEXT: [[TMP82:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP97:%.*]], [[UDIV_DO_WHILE:%.*]] ]
358 ; CHECK-NEXT: [[TMP83:%.*]] = phi i129 [ [[TMP106:%.*]], [[UDIV_BB1]] ], [ [[TMP94:%.*]], [[UDIV_DO_WHILE]] ]
359 ; CHECK-NEXT: [[TMP84:%.*]] = shl i129 [[TMP83]], 1
360 ; CHECK-NEXT: [[TMP85:%.*]] = or i129 [[TMP82]], [[TMP84]]
361 ; CHECK-NEXT: br label [[UDIV_END]]
362 ; CHECK: udiv-do-while:
363 ; CHECK-NEXT: [[TMP86:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER:%.*]] ], [ [[TMP97]], [[UDIV_DO_WHILE]] ]
364 ; CHECK-NEXT: [[TMP87:%.*]] = phi i129 [ [[TMP104:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP100:%.*]], [[UDIV_DO_WHILE]] ]
365 ; CHECK-NEXT: [[TMP88:%.*]] = phi i129 [ [[TMP102:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP99:%.*]], [[UDIV_DO_WHILE]] ]
366 ; CHECK-NEXT: [[TMP89:%.*]] = phi i129 [ [[TMP106]], [[UDIV_PREHEADER]] ], [ [[TMP94]], [[UDIV_DO_WHILE]] ]
367 ; CHECK-NEXT: [[TMP90:%.*]] = shl i129 [[TMP88]], 1
368 ; CHECK-NEXT: [[TMP91:%.*]] = lshr i129 [[TMP89]], 128
369 ; CHECK-NEXT: [[TMP92:%.*]] = or i129 [[TMP90]], [[TMP91]]
370 ; CHECK-NEXT: [[TMP93:%.*]] = shl i129 [[TMP89]], 1
371 ; CHECK-NEXT: [[TMP94]] = or i129 [[TMP86]], [[TMP93]]
372 ; CHECK-NEXT: [[TMP95:%.*]] = sub i129 [[TMP103:%.*]], [[TMP92]]
373 ; CHECK-NEXT: [[TMP96:%.*]] = ashr i129 [[TMP95]], 128
374 ; CHECK-NEXT: [[TMP97]] = and i129 [[TMP96]], 1
375 ; CHECK-NEXT: [[TMP98:%.*]] = and i129 [[TMP96]], [[TMP69]]
376 ; CHECK-NEXT: [[TMP99]] = sub i129 [[TMP92]], [[TMP98]]
377 ; CHECK-NEXT: [[TMP100]] = add i129 [[TMP87]], -1
378 ; CHECK-NEXT: [[TMP101:%.*]] = icmp eq i129 [[TMP100]], 0
379 ; CHECK-NEXT: br i1 [[TMP101]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
380 ; CHECK: udiv-preheader:
381 ; CHECK-NEXT: [[TMP102]] = lshr i129 [[TMP70]], [[TMP104]]
382 ; CHECK-NEXT: [[TMP103]] = add i129 [[TMP69]], -1
383 ; CHECK-NEXT: br label [[UDIV_DO_WHILE]]
385 ; CHECK-NEXT: [[TMP104]] = add i129 [[TMP76]], 1
386 ; CHECK-NEXT: [[TMP105:%.*]] = sub i129 128, [[TMP76]]
387 ; CHECK-NEXT: [[TMP106]] = shl i129 [[TMP70]], [[TMP105]]
388 ; CHECK-NEXT: [[TMP107:%.*]] = icmp eq i129 [[TMP104]], 0
389 ; CHECK-NEXT: br i1 [[TMP107]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
391 ; CHECK-NEXT: [[TMP108:%.*]] = phi i129 [ [[TMP85]], [[UDIV_LOOP_EXIT]] ], [ [[TMP80]], [[UDIV_END1]] ]
392 ; CHECK-NEXT: [[TMP109:%.*]] = mul i129 [[TMP68]], [[TMP108]]
393 ; CHECK-NEXT: [[TMP110:%.*]] = sub i129 [[TMP67]], [[TMP109]]
394 ; CHECK-NEXT: [[TMP111:%.*]] = xor i129 [[TMP110]], [[TMP61]]
395 ; CHECK-NEXT: [[TMP112:%.*]] = sub i129 [[TMP111]], [[TMP61]]
396 ; CHECK-NEXT: [[TMP113:%.*]] = insertelement <2 x i129> [[TMP56]], i129 [[TMP112]], i64 1
397 ; CHECK-NEXT: ret <2 x i129> [[TMP113]]
399 %res = srem <2 x i129> %a, %b
403 define <2 x i129> @urem129(<2 x i129> %a, <2 x i129> %b) nounwind {
404 ; CHECK-LABEL: define <2 x i129> @urem129(
405 ; CHECK-SAME: <2 x i129> [[A:%.*]], <2 x i129> [[B:%.*]]) #[[ATTR0]] {
406 ; CHECK-NEXT: _udiv-special-cases_udiv-special-cases:
407 ; CHECK-NEXT: [[TMP0:%.*]] = extractelement <2 x i129> [[A]], i64 0
408 ; CHECK-NEXT: [[TMP1:%.*]] = extractelement <2 x i129> [[B]], i64 0
409 ; CHECK-NEXT: [[TMP2:%.*]] = freeze i129 [[TMP0]]
410 ; CHECK-NEXT: [[TMP3:%.*]] = freeze i129 [[TMP1]]
411 ; CHECK-NEXT: [[TMP4:%.*]] = freeze i129 [[TMP3]]
412 ; CHECK-NEXT: [[TMP5:%.*]] = freeze i129 [[TMP2]]
413 ; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i129 [[TMP4]], 0
414 ; CHECK-NEXT: [[TMP7:%.*]] = icmp eq i129 [[TMP5]], 0
415 ; CHECK-NEXT: [[TMP8:%.*]] = or i1 [[TMP6]], [[TMP7]]
416 ; CHECK-NEXT: [[TMP9:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP4]], i1 true)
417 ; CHECK-NEXT: [[TMP10:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP5]], i1 true)
418 ; CHECK-NEXT: [[TMP11:%.*]] = sub i129 [[TMP9]], [[TMP10]]
419 ; CHECK-NEXT: [[TMP12:%.*]] = icmp ugt i129 [[TMP11]], 128
420 ; CHECK-NEXT: [[TMP13:%.*]] = select i1 [[TMP8]], i1 true, i1 [[TMP12]]
421 ; CHECK-NEXT: [[TMP14:%.*]] = icmp eq i129 [[TMP11]], 128
422 ; CHECK-NEXT: [[TMP15:%.*]] = select i1 [[TMP13]], i129 0, i129 [[TMP5]]
423 ; CHECK-NEXT: [[TMP16:%.*]] = select i1 [[TMP13]], i1 true, i1 [[TMP14]]
424 ; CHECK-NEXT: br i1 [[TMP16]], label [[UDIV_END1:%.*]], label [[UDIV_BB15:%.*]]
425 ; CHECK: udiv-loop-exit2:
426 ; CHECK-NEXT: [[TMP17:%.*]] = phi i129 [ 0, [[UDIV_BB15]] ], [ [[TMP32:%.*]], [[UDIV_DO_WHILE3:%.*]] ]
427 ; CHECK-NEXT: [[TMP18:%.*]] = phi i129 [ [[TMP41:%.*]], [[UDIV_BB15]] ], [ [[TMP29:%.*]], [[UDIV_DO_WHILE3]] ]
428 ; CHECK-NEXT: [[TMP19:%.*]] = shl i129 [[TMP18]], 1
429 ; CHECK-NEXT: [[TMP20:%.*]] = or i129 [[TMP17]], [[TMP19]]
430 ; CHECK-NEXT: br label [[UDIV_END1]]
431 ; CHECK: udiv-do-while3:
432 ; CHECK-NEXT: [[TMP21:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER4:%.*]] ], [ [[TMP32]], [[UDIV_DO_WHILE3]] ]
433 ; CHECK-NEXT: [[TMP22:%.*]] = phi i129 [ [[TMP39:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP35:%.*]], [[UDIV_DO_WHILE3]] ]
434 ; CHECK-NEXT: [[TMP23:%.*]] = phi i129 [ [[TMP37:%.*]], [[UDIV_PREHEADER4]] ], [ [[TMP34:%.*]], [[UDIV_DO_WHILE3]] ]
435 ; CHECK-NEXT: [[TMP24:%.*]] = phi i129 [ [[TMP41]], [[UDIV_PREHEADER4]] ], [ [[TMP29]], [[UDIV_DO_WHILE3]] ]
436 ; CHECK-NEXT: [[TMP25:%.*]] = shl i129 [[TMP23]], 1
437 ; CHECK-NEXT: [[TMP26:%.*]] = lshr i129 [[TMP24]], 128
438 ; CHECK-NEXT: [[TMP27:%.*]] = or i129 [[TMP25]], [[TMP26]]
439 ; CHECK-NEXT: [[TMP28:%.*]] = shl i129 [[TMP24]], 1
440 ; CHECK-NEXT: [[TMP29]] = or i129 [[TMP21]], [[TMP28]]
441 ; CHECK-NEXT: [[TMP30:%.*]] = sub i129 [[TMP38:%.*]], [[TMP27]]
442 ; CHECK-NEXT: [[TMP31:%.*]] = ashr i129 [[TMP30]], 128
443 ; CHECK-NEXT: [[TMP32]] = and i129 [[TMP31]], 1
444 ; CHECK-NEXT: [[TMP33:%.*]] = and i129 [[TMP31]], [[TMP4]]
445 ; CHECK-NEXT: [[TMP34]] = sub i129 [[TMP27]], [[TMP33]]
446 ; CHECK-NEXT: [[TMP35]] = add i129 [[TMP22]], -1
447 ; CHECK-NEXT: [[TMP36:%.*]] = icmp eq i129 [[TMP35]], 0
448 ; CHECK-NEXT: br i1 [[TMP36]], label [[UDIV_LOOP_EXIT2:%.*]], label [[UDIV_DO_WHILE3]]
449 ; CHECK: udiv-preheader4:
450 ; CHECK-NEXT: [[TMP37]] = lshr i129 [[TMP5]], [[TMP39]]
451 ; CHECK-NEXT: [[TMP38]] = add i129 [[TMP4]], -1
452 ; CHECK-NEXT: br label [[UDIV_DO_WHILE3]]
454 ; CHECK-NEXT: [[TMP39]] = add i129 [[TMP11]], 1
455 ; CHECK-NEXT: [[TMP40:%.*]] = sub i129 128, [[TMP11]]
456 ; CHECK-NEXT: [[TMP41]] = shl i129 [[TMP5]], [[TMP40]]
457 ; CHECK-NEXT: [[TMP42:%.*]] = icmp eq i129 [[TMP39]], 0
458 ; CHECK-NEXT: br i1 [[TMP42]], label [[UDIV_LOOP_EXIT2]], label [[UDIV_PREHEADER4]]
460 ; CHECK-NEXT: [[TMP43:%.*]] = phi i129 [ [[TMP20]], [[UDIV_LOOP_EXIT2]] ], [ [[TMP15]], [[_UDIV_SPECIAL_CASES_UDIV_SPECIAL_CASES:%.*]] ]
461 ; CHECK-NEXT: [[TMP44:%.*]] = mul i129 [[TMP3]], [[TMP43]]
462 ; CHECK-NEXT: [[TMP45:%.*]] = sub i129 [[TMP2]], [[TMP44]]
463 ; CHECK-NEXT: [[TMP46:%.*]] = insertelement <2 x i129> poison, i129 [[TMP45]], i64 0
464 ; CHECK-NEXT: [[TMP47:%.*]] = extractelement <2 x i129> [[A]], i64 1
465 ; CHECK-NEXT: [[TMP48:%.*]] = extractelement <2 x i129> [[B]], i64 1
466 ; CHECK-NEXT: [[TMP49:%.*]] = freeze i129 [[TMP47]]
467 ; CHECK-NEXT: [[TMP50:%.*]] = freeze i129 [[TMP48]]
468 ; CHECK-NEXT: [[TMP51:%.*]] = freeze i129 [[TMP50]]
469 ; CHECK-NEXT: [[TMP52:%.*]] = freeze i129 [[TMP49]]
470 ; CHECK-NEXT: [[TMP53:%.*]] = icmp eq i129 [[TMP51]], 0
471 ; CHECK-NEXT: [[TMP54:%.*]] = icmp eq i129 [[TMP52]], 0
472 ; CHECK-NEXT: [[TMP55:%.*]] = or i1 [[TMP53]], [[TMP54]]
473 ; CHECK-NEXT: [[TMP56:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP51]], i1 true)
474 ; CHECK-NEXT: [[TMP57:%.*]] = call i129 @llvm.ctlz.i129(i129 [[TMP52]], i1 true)
475 ; CHECK-NEXT: [[TMP58:%.*]] = sub i129 [[TMP56]], [[TMP57]]
476 ; CHECK-NEXT: [[TMP59:%.*]] = icmp ugt i129 [[TMP58]], 128
477 ; CHECK-NEXT: [[TMP60:%.*]] = select i1 [[TMP55]], i1 true, i1 [[TMP59]]
478 ; CHECK-NEXT: [[TMP61:%.*]] = icmp eq i129 [[TMP58]], 128
479 ; CHECK-NEXT: [[TMP62:%.*]] = select i1 [[TMP60]], i129 0, i129 [[TMP52]]
480 ; CHECK-NEXT: [[TMP63:%.*]] = select i1 [[TMP60]], i1 true, i1 [[TMP61]]
481 ; CHECK-NEXT: br i1 [[TMP63]], label [[UDIV_END:%.*]], label [[UDIV_BB1:%.*]]
482 ; CHECK: udiv-loop-exit:
483 ; CHECK-NEXT: [[TMP64:%.*]] = phi i129 [ 0, [[UDIV_BB1]] ], [ [[TMP79:%.*]], [[UDIV_DO_WHILE:%.*]] ]
484 ; CHECK-NEXT: [[TMP65:%.*]] = phi i129 [ [[TMP88:%.*]], [[UDIV_BB1]] ], [ [[TMP76:%.*]], [[UDIV_DO_WHILE]] ]
485 ; CHECK-NEXT: [[TMP66:%.*]] = shl i129 [[TMP65]], 1
486 ; CHECK-NEXT: [[TMP67:%.*]] = or i129 [[TMP64]], [[TMP66]]
487 ; CHECK-NEXT: br label [[UDIV_END]]
488 ; CHECK: udiv-do-while:
489 ; CHECK-NEXT: [[TMP68:%.*]] = phi i129 [ 0, [[UDIV_PREHEADER:%.*]] ], [ [[TMP79]], [[UDIV_DO_WHILE]] ]
490 ; CHECK-NEXT: [[TMP69:%.*]] = phi i129 [ [[TMP86:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP82:%.*]], [[UDIV_DO_WHILE]] ]
491 ; CHECK-NEXT: [[TMP70:%.*]] = phi i129 [ [[TMP84:%.*]], [[UDIV_PREHEADER]] ], [ [[TMP81:%.*]], [[UDIV_DO_WHILE]] ]
492 ; CHECK-NEXT: [[TMP71:%.*]] = phi i129 [ [[TMP88]], [[UDIV_PREHEADER]] ], [ [[TMP76]], [[UDIV_DO_WHILE]] ]
493 ; CHECK-NEXT: [[TMP72:%.*]] = shl i129 [[TMP70]], 1
494 ; CHECK-NEXT: [[TMP73:%.*]] = lshr i129 [[TMP71]], 128
495 ; CHECK-NEXT: [[TMP74:%.*]] = or i129 [[TMP72]], [[TMP73]]
496 ; CHECK-NEXT: [[TMP75:%.*]] = shl i129 [[TMP71]], 1
497 ; CHECK-NEXT: [[TMP76]] = or i129 [[TMP68]], [[TMP75]]
498 ; CHECK-NEXT: [[TMP77:%.*]] = sub i129 [[TMP85:%.*]], [[TMP74]]
499 ; CHECK-NEXT: [[TMP78:%.*]] = ashr i129 [[TMP77]], 128
500 ; CHECK-NEXT: [[TMP79]] = and i129 [[TMP78]], 1
501 ; CHECK-NEXT: [[TMP80:%.*]] = and i129 [[TMP78]], [[TMP51]]
502 ; CHECK-NEXT: [[TMP81]] = sub i129 [[TMP74]], [[TMP80]]
503 ; CHECK-NEXT: [[TMP82]] = add i129 [[TMP69]], -1
504 ; CHECK-NEXT: [[TMP83:%.*]] = icmp eq i129 [[TMP82]], 0
505 ; CHECK-NEXT: br i1 [[TMP83]], label [[UDIV_LOOP_EXIT:%.*]], label [[UDIV_DO_WHILE]]
506 ; CHECK: udiv-preheader:
507 ; CHECK-NEXT: [[TMP84]] = lshr i129 [[TMP52]], [[TMP86]]
508 ; CHECK-NEXT: [[TMP85]] = add i129 [[TMP51]], -1
509 ; CHECK-NEXT: br label [[UDIV_DO_WHILE]]
511 ; CHECK-NEXT: [[TMP86]] = add i129 [[TMP58]], 1
512 ; CHECK-NEXT: [[TMP87:%.*]] = sub i129 128, [[TMP58]]
513 ; CHECK-NEXT: [[TMP88]] = shl i129 [[TMP52]], [[TMP87]]
514 ; CHECK-NEXT: [[TMP89:%.*]] = icmp eq i129 [[TMP86]], 0
515 ; CHECK-NEXT: br i1 [[TMP89]], label [[UDIV_LOOP_EXIT]], label [[UDIV_PREHEADER]]
517 ; CHECK-NEXT: [[TMP90:%.*]] = phi i129 [ [[TMP67]], [[UDIV_LOOP_EXIT]] ], [ [[TMP62]], [[UDIV_END1]] ]
518 ; CHECK-NEXT: [[TMP91:%.*]] = mul i129 [[TMP50]], [[TMP90]]
519 ; CHECK-NEXT: [[TMP92:%.*]] = sub i129 [[TMP49]], [[TMP91]]
520 ; CHECK-NEXT: [[TMP93:%.*]] = insertelement <2 x i129> [[TMP46]], i129 [[TMP92]], i64 1
521 ; CHECK-NEXT: ret <2 x i129> [[TMP93]]
523 %res = urem <2 x i129> %a, %b
528 define <vscale x 2 x i129> @sdiv129_scalable(<vscale x 2 x i129> %a, <vscale x 2 x i129> %b) nounwind {
529 ; CHECK-LABEL: define <vscale x 2 x i129> @sdiv129_scalable(
530 ; CHECK-SAME: <vscale x 2 x i129> [[A:%.*]], <vscale x 2 x i129> [[B:%.*]]) #[[ATTR0]] {
531 ; CHECK-NEXT: [[RES:%.*]] = sdiv <vscale x 2 x i129> [[A]], [[B]]
532 ; CHECK-NEXT: ret <vscale x 2 x i129> [[RES]]
534 %res = sdiv <vscale x 2 x i129> %a, %b
535 ret <vscale x 2 x i129> %res