[PATCH] D142953: [RISCV] Don't use constantpool for floating-point value if the value can be easily constructed by integer sequence and a floating-point move.

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 31 16:50:42 PST 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:716
+  case ISD::ConstantFP: {
+    unsigned EltBitSize = VT.getScalarSizeInBits();
+    const APFloat &APF = cast<ConstantFPSDNode>(Node)->getValueAPF();
----------------
Drop `Scalar` from this. It's never a vector. Nor is it an `Elt`


================
Comment at: llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp:724
+      break;
+    assert((EltBitSize <= Subtarget->getXLen() || APF.isZero()) &&
+           "Cannot create a 64 bit floating-point immediate value for rv32");
----------------
Why is the isZero check needed? There was an early exit for positive zero so this could only be negative 0. But a negative 0 larger than xlen wouldn't be able to generate a correct constant.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D142953/new/

https://reviews.llvm.org/D142953



More information about the llvm-commits mailing list