[PATCH] D137241: [X86] Add ExpandLargeFpConvert Pass and enable for X86
LuoYuanke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 05:43:32 PST 2022
LuoYuanke added inline comments.
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:145
+ Value *FloatVal0 = FloatVal;
+ if (FloatVal->getType()->getFPMantissaWidth() == 64)
+ FloatVal0 =
----------------
FloatVal->getType()->isX86_FP80Ty()?
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:150
+ Builder.CreateBitCast(FloatVal0, Builder.getIntNTy(FloatWidth));
+ Value *ARep = Builder.CreateZExt(ARep0, FPToI->getType());
+ Value *Tobool_not = Builder.CreateICmpSGT(
----------------
Do we assume the _BitInt size is larger than 128-bit?
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:151
+ Value *ARep = Builder.CreateZExt(ARep0, FPToI->getType());
+ Value *Tobool_not = Builder.CreateICmpSGT(
+ ARep0, ConstantInt::getSigned(Builder.getIntNTy(FloatWidth), -1));
----------------
ToBoolNot?
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:158
+ Builder.CreateLShr(ARep, Builder.getIntN(BitWidth, FPMantissaWidth));
+ Value *Exponent_with_bias = Builder.CreateAnd(
+ And, Builder.getIntN(BitWidth, (1u << ExponentWidth) - 1));
----------------
ExponentWithBias.
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:164
+ Exponent_with_bias,
+ Builder.getIntN(BitWidth, (1u << (ExponentWidth - 1)) - 1));
+ Builder.CreateCondBr(Cmp, End, IfEnd);
----------------
`1u << (ExponentWidth - 1)) - 1` expression is used several times. Maybe to set `Bias = 1u << (ExponentWidth - 1)) - 1` to be more readable.
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:179
+ Builder.SetInsertPoint(IfThen5);
+ Value *Neg_one = Builder.CreateSExt(
+ ConstantInt::getSigned(Builder.getInt32Ty(), -1), IntTy);
----------------
NegOne
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:181
+ ConstantInt::getSigned(Builder.getInt32Ty(), -1), IntTy);
+ Value *Neg_inf =
+ Builder.CreateShl(ConstantInt::getSigned(IntTy, 1),
----------------
NegInf
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:184
+ ConstantInt::getSigned(IntTy, BitWidth - 1));
+ Value *Pos_inf = Builder.CreateXor(Neg_one, Neg_inf, "inf_temp3");
+ Value *Cond8 = Builder.CreateSelect(Tobool_not, Pos_inf, Neg_inf, "cond8");
----------------
PosInf
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:218
+ Builder.SetInsertPoint(End, End->begin());
+ PHINode *Retval_0 = Builder.CreatePHI(FPToI->getType(), 4);
+
----------------
Retval0
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D137241/new/
https://reviews.llvm.org/D137241
More information about the llvm-commits
mailing list