[llvm] [X86] Lower mathlib call ldexp into scalef when avx512 is enabled (PR #69710)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 14 04:22:55 PST 2023
================
@@ -31814,6 +31820,45 @@ static StringRef getInstrStrFromOpNo(const SmallVectorImpl<StringRef> &AsmStrs,
return StringRef();
}
+static SDValue LowerFLDEXP(SDValue Op, SelectionDAG &DAG) {
+ SDValue X = Op.getOperand(0);
+ EVT XScalarTy = X.getValueType();
+ SDValue Exp = Op.getOperand(1);
+
+ SDLoc DL(Op);
+ EVT XVT, ExpVT;
+ SDValue IID;
+ switch (Op.getSimpleValueType().SimpleTy) {
+ default:
+ return SDValue();
+ case MVT::f16:
+ X = DAG.getNode(ISD::FP_EXTEND, DL, MVT::f32, X);
----------------
huhu233 wrote:
Hi, there may be risk of truncation, as the EXP operand of `FLDEXP` types `i32`, e.g., `@llvm.ldexp.f16.i32(half, i32)` ->`@llvm.x86.avx512fp16.mask.scalef.sh(<8 x half>, <8 x half>, <8 x half>`. I didn't know how to handle the issue elegantly, so I makde an extension here.
https://github.com/llvm/llvm-project/pull/69710
More information about the llvm-commits
mailing list