@@ -101,11 +101,6 @@ class FRemExpander {
101
101
ExTy (B.getInt32Ty()), Bits(ConstantInt::get(ExTy, Bits)),
102
102
One(ConstantInt::get(ExTy, 1 )), Signbit(Signbit) {};
103
103
104
- Value *createLdexp (Value *Base, Value *Exp, const Twine &Name) const {
105
- return B.CreateIntrinsic (Intrinsic::ldexp, {ComputeFpTy, B.getInt32Ty ()},
106
- {Base, Exp}, {}, Name);
107
- }
108
-
109
104
Value *createRcp (Value *V, const Twine &Name) const {
110
105
return B.CreateFDiv (ConstantFP::get (ComputeFpTy, 1.0 ), V, Name);
111
106
}
@@ -121,8 +116,7 @@ class FRemExpander {
121
116
// ax = clt ? axp : ax;
122
117
Value *Q = B.CreateUnaryIntrinsic (Intrinsic::rint, B.CreateFMul (Ax, Ayinv),
123
118
{}, " q" );
124
- Value *AxUpdate = B.CreateIntrinsic (Intrinsic::fma, {ComputeFpTy},
125
- {B.CreateFNeg (Q), Ay, Ax}, {}, " ax" );
119
+ Value *AxUpdate = B.CreateFMA (B.CreateFNeg (Q), Ay, Ax, {}, " ax" );
126
120
Value *Clt = B.CreateFCmp (CmpInst::FCMP_OLT, AxUpdate,
127
121
ConstantFP::get (ComputeFpTy, 0.0 ), " clt" );
128
122
Value *Axp = B.CreateFAdd (AxUpdate, Ay, " axp" );
@@ -148,7 +142,7 @@ class FRemExpander {
148
142
Value *Exp = B.CreateExtractValue (Frexp, {1 });
149
143
150
144
Exp = B.CreateSub (Exp, One, ExName);
151
- Value *Pow = createLdexp (Mant, NewExp, PowName);
145
+ Value *Pow = B. CreateLdexp (Mant, NewExp, {} , PowName);
152
146
153
147
return {Pow, Exp};
154
148
}
@@ -197,7 +191,7 @@ class FRemExpander {
197
191
AxPhi->addIncoming (Ax, PreheaderBB);
198
192
199
193
Value *AxPhiUpdate = buildUpdateAx (AxPhi, Ay, Ayinv);
200
- AxPhiUpdate = createLdexp (AxPhiUpdate, Bits, " ax_update" );
194
+ AxPhiUpdate = B. CreateLdexp (AxPhiUpdate, Bits, {} , " ax_update" );
201
195
AxPhi->addIncoming (AxPhiUpdate, LoopBB);
202
196
NbIv->addIncoming (B.CreateSub (NbIv, Bits, " nb_update" ), LoopBB);
203
197
@@ -215,14 +209,14 @@ class FRemExpander {
215
209
NbExitPhi->addIncoming (NbIv, LoopBB);
216
210
NbExitPhi->addIncoming (Nb, PreheaderBB);
217
211
218
- Value *AxFinal = createLdexp (
219
- AxPhiExit, B.CreateAdd (B.CreateSub (NbExitPhi, Bits), One), " ax" );
212
+ Value *AxFinal = B. CreateLdexp (
213
+ AxPhiExit, B.CreateAdd (B.CreateSub (NbExitPhi, Bits), One), {}, " ax" );
220
214
AxFinal = buildUpdateAx (AxFinal, Ay, Ayinv);
221
215
222
216
// Build:
223
217
// ax = BUILTIN_FLDEXP_ComputeFpTy(ax, ey);
224
218
// ret = AS_FLOAT((AS_INT(x) & SIGNBIT_SP32) ^ AS_INT(ax));
225
- AxFinal = createLdexp (AxFinal, Ey, " ax" );
219
+ AxFinal = B. CreateLdexp (AxFinal, Ey, {} , " ax" );
226
220
227
221
Value *XAsInt = B.CreateBitCast (X, IntTy, " x_as_int" );
228
222
if (ComputeFpTy != X->getType ())
0 commit comments