[llvm] [Xtensa] Implement Xtensa Floating Point Option. (PR #136086)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 22 05:22:38 PDT 2025
================
@@ -815,6 +898,21 @@ SDValue XtensaTargetLowering::LowerImmediate(SDValue Op,
return Op;
}
+SDValue XtensaTargetLowering::LowerImmediateFP(SDValue Op,
+ SelectionDAG &DAG) const {
+ const ConstantFPSDNode *CN = cast<ConstantFPSDNode>(Op);
+ SDLoc DL(CN);
+ APFloat apval = CN->getValueAPF();
+ int64_t value = llvm::bit_cast<uint32_t>(CN->getValueAPF().convertToFloat());
+ if (Op.getValueType() == MVT::f32) {
+ Type *Ty = Type::getInt32Ty(*DAG.getContext());
+ Constant *CV = ConstantInt::get(Ty, value);
+ SDValue CP = DAG.getConstantPool(CV, MVT::i32);
+ return DAG.getNode(ISD::BITCAST, DL, MVT::f32, CP);
----------------
arsenm wrote:
This usage of ConstantPool looks broken, it gives a pointer that you're supposed to load the value from. How can you interpret the pointer value as an FP type?
https://github.com/llvm/llvm-project/pull/136086
More information about the llvm-commits
mailing list