[llvm] [LoongArch] Load floating-point immediate using VLDI (PR #101923)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 8 19:06:02 PDT 2024
================
@@ -5573,14 +5573,31 @@ SDValue LoongArchTargetLowering::LowerReturn(
return DAG.getNode(LoongArchISD::RET, DL, MVT::Other, RetOps);
}
+bool LoongArchTargetLowering::isFPImmVLDILegal(const APFloat &Imm,
+ EVT VT) const {
+ if (!Subtarget.hasExtLSX())
+ return false;
+
+ uint64_t val = Imm.bitcastToAPInt().getZExtValue();
+ if (VT == MVT::f32) {
+ uint64_t masked = val & 0x7e07ffff;
+ return (masked == 0x3e000000 || masked == 0x40000000);
+ } else if (VT == MVT::f64) {
----------------
heiher wrote:
Done, Thanks.
https://github.com/llvm/llvm-project/pull/101923
More information about the llvm-commits
mailing list