[PATCH] D137241: [X86] Add ExpandLargeFpConvert Pass and enable for X86
Freddy, Ye via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 29 04:20:14 PST 2022
FreddyYe added inline comments.
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:75
+/// %sub16 = sub nuw nsw i64 150, %shr
+/// %shr17 = lshr i64 %or, %sub16
+/// %mul = mul nsw i64 %shr17, %conv
----------------
LuoYuanke wrote:
> It seems we just truncate the value. Is it because it is rounded to zero?
Yes, this is default behavior that codes like `(int)3.14` outputs 3 no matter what current rounding mode is. LLVM langref also defines so for fptosi: https://llvm.org/docs/LangRef.html#id269
================
Comment at: llvm/lib/CodeGen/ExpandLargeFpConvert.cpp:102
+ Value *a1 = nullptr;
+ if (FPMantissaWidth == 10) {
+ if (FPToI->getOpcode() == Instruction::FPToUI) {
----------------
LuoYuanke wrote:
> Maybe more readable with `FloatVal->getType()->isHalfTy()`.
Good idea.
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