[llvm] [LoongArch] Load floating-point immediate using VLDI (PR #101923)

via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 4 22:55:34 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-loongarch

Author: hev (heiher)

<details>
<summary>Changes</summary>

This commit uses the VLDI instruction to load some common floating-point constants when the LSX feature is enabled.

---

Patch is 258.18 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/101923.diff


4 Files Affected:

- (modified) llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp (+18-1) 
- (modified) llvm/lib/Target/LoongArch/LoongArchISelLowering.h (+2) 
- (modified) llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td (+31) 
- (modified) llvm/test/CodeGen/LoongArch/float-imm-vldi.ll (+1282-4864) 


``````````diff
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
index bdbb7ab0f5139..44f3c1496344e 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp
@@ -5573,6 +5573,23 @@ 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) {
+    uint64_t masked = val & 0x7fc0ffffffffffff;
+    return (masked == 0x3fc0000000000000 || masked == 0x4000000000000000);
+  }
+
+  return false;
+}
+
 bool LoongArchTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
                                            bool ForCodeSize) const {
   // TODO: Maybe need more checks here after vector extension is supported.
@@ -5580,7 +5597,7 @@ bool LoongArchTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
     return false;
   if (VT == MVT::f64 && !Subtarget.hasBasicD())
     return false;
-  return (Imm.isZero() || Imm.isExactlyValue(+1.0));
+  return (Imm.isZero() || Imm.isExactlyValue(1.0) || isFPImmVLDILegal(Imm, VT));
 }
 
 bool LoongArchTargetLowering::isCheapToSpeculateCttz(Type *) const {
diff --git a/llvm/lib/Target/LoongArch/LoongArchISelLowering.h b/llvm/lib/Target/LoongArch/LoongArchISelLowering.h
index d834a5d8587fd..9723789e919b1 100644
--- a/llvm/lib/Target/LoongArch/LoongArchISelLowering.h
+++ b/llvm/lib/Target/LoongArch/LoongArchISelLowering.h
@@ -260,6 +260,8 @@ class LoongArchTargetLowering : public TargetLowering {
   bool shouldAlignPointerArgs(CallInst *CI, unsigned &MinSize,
                               Align &PrefAlign) const override;
 
+  bool isFPImmVLDILegal(const APFloat &Imm, EVT VT) const;
+
 private:
   /// Target-specific function used to lower LoongArch calling conventions.
   typedef bool LoongArchCCAssignFn(const DataLayout &DL, LoongArchABI::ABI ABI,
diff --git a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
index 0580683c3ce30..cac47e35afe25 100644
--- a/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
+++ b/llvm/lib/Target/LoongArch/LoongArchLSXInstrInfo.td
@@ -203,6 +203,29 @@ def to_valid_timm : SDNodeXForm<timm, [{
   return CurDAG->getTargetConstant(CN->getSExtValue(), SDLoc(N), Subtarget->getGRLenVT());
 }]>;
 
+// FP immediate of VLDI patterns.
+def f32imm_vldi : PatLeaf<(fpimm), [{
+  const auto &TLI =
+      *static_cast<const LoongArchTargetLowering*>(getTargetLowering());
+  return TLI.isFPImmVLDILegal(N->getValueAPF(), MVT::f32);
+}]>;
+def f64imm_vldi : PatLeaf<(fpimm), [{
+  const auto &TLI =
+      *static_cast<const LoongArchTargetLowering*>(getTargetLowering());
+  return TLI.isFPImmVLDILegal(N->getValueAPF(), MVT::f64);
+}]>;
+
+def to_f32imm_vldi : SDNodeXForm<fpimm, [{
+  uint64_t x = N->getValueAPF().bitcastToAPInt().getZExtValue();
+  x = (0b11011 << 8) | (((x >> 24) & 0xc0) ^ 0x40) | ((x >> 19) & 0x3f);
+  return CurDAG->getTargetConstant(SignExtend32<13>(x), SDLoc(N), MVT::i32);
+}]>;
+def to_f64imm_vldi : SDNodeXForm<fpimm, [{
+  uint64_t x = N->getValueAPF().bitcastToAPInt().getZExtValue();
+  x = (0b11100 << 8) | (((x >> 56) & 0xc0) ^ 0x40) | ((x >> 48) & 0x3f);
+  return CurDAG->getTargetConstant(SignExtend32<13>(x), SDLoc(N), MVT::i32);
+}]>;
+
 //===----------------------------------------------------------------------===//
 // Instruction class templates
 //===----------------------------------------------------------------------===//
@@ -663,7 +686,9 @@ def VMSKGEZ_B : LSX2R_VV<0x729c5000>;
 
 def VMSKNZ_B : LSX2R_VV<0x729c6000>;
 
+let isReMaterializable = 1, isAsCheapAsAMove = 1 in {
 def VLDI : LSX1RI13_VI<0x73e00000>;
+}
 
 def VAND_V : LSX3R_VVV<0x71260000>;
 def VOR_V : LSX3R_VVV<0x71268000>;
@@ -1910,6 +1935,12 @@ def : Pat<(v2i64 (fp_to_sint v2f64:$vj)), (VFTINTRZ_L_D v2f64:$vj)>;
 def : Pat<(v4i32 (fp_to_uint v4f32:$vj)), (VFTINTRZ_WU_S v4f32:$vj)>;
 def : Pat<(v2i64 (fp_to_uint v2f64:$vj)), (VFTINTRZ_LU_D v2f64:$vj)>;
 
+// Vector loads floating-point constants
+def : Pat<(f32 f32imm_vldi:$in),
+          (f32 (EXTRACT_SUBREG (VLDI (to_f32imm_vldi f32imm_vldi:$in)), sub_32))>;
+def : Pat<(f64 f64imm_vldi:$in),
+          (f64 (EXTRACT_SUBREG (VLDI (to_f64imm_vldi f64imm_vldi:$in)), sub_64))>;
+
 } // Predicates = [HasExtLSX]
 
 /// Intrinsic pattern
diff --git a/llvm/test/CodeGen/LoongArch/float-imm-vldi.ll b/llvm/test/CodeGen/LoongArch/float-imm-vldi.ll
index 0c6856bafd23d..551ab6ea44c66 100644
--- a/llvm/test/CodeGen/LoongArch/float-imm-vldi.ll
+++ b/llvm/test/CodeGen/LoongArch/float-imm-vldi.ll
@@ -1,6145 +1,2563 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc --mtriple=loongarch32 --mattr=+lsx < %s | FileCheck %s --check-prefix=LA32
-; RUN: llc --mtriple=loongarch64 --mattr=+lsx < %s | FileCheck %s --check-prefix=LA64
+; RUN: llc --mtriple=loongarch32 --mattr=+lsx < %s | FileCheck %s
+; RUN: llc --mtriple=loongarch64 --mattr=+lsx < %s | FileCheck %s
 
 define dso_local { float, double } @test1() {
-; LA32-LABEL: test1:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI0_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI0_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI0_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI0_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test1:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI0_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI0_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI0_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI0_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test1:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1280
+; CHECK-NEXT:    vldi $vr1, -1024
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.0000000000, double 2.0000000000 }
 }
 
 define dso_local { float, double } @test2() {
-; LA32-LABEL: test2:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI1_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI1_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI1_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI1_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test2:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI1_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI1_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI1_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI1_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test2:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1279
+; CHECK-NEXT:    vldi $vr1, -1023
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.1250000000, double 2.1250000000 }
 }
 
 define dso_local { float, double } @test3() {
-; LA32-LABEL: test3:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI2_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI2_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI2_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI2_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test3:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI2_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI2_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI2_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI2_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test3:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1278
+; CHECK-NEXT:    vldi $vr1, -1022
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.2500000000, double 2.2500000000 }
 }
 
 define dso_local { float, double } @test4() {
-; LA32-LABEL: test4:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI3_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI3_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI3_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI3_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test4:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI3_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI3_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI3_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI3_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test4:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1277
+; CHECK-NEXT:    vldi $vr1, -1021
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.3750000000, double 2.3750000000 }
 }
 
 define dso_local { float, double } @test5() {
-; LA32-LABEL: test5:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI4_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI4_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI4_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI4_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test5:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI4_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI4_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI4_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI4_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test5:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1276
+; CHECK-NEXT:    vldi $vr1, -1020
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.5000000000, double 2.5000000000 }
 }
 
 define dso_local { float, double } @test6() {
-; LA32-LABEL: test6:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI5_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI5_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI5_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI5_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test6:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI5_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI5_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI5_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI5_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test6:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1275
+; CHECK-NEXT:    vldi $vr1, -1019
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.6250000000, double 2.6250000000 }
 }
 
 define dso_local { float, double } @test7() {
-; LA32-LABEL: test7:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI6_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI6_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI6_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI6_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test7:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI6_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI6_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI6_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI6_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test7:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1274
+; CHECK-NEXT:    vldi $vr1, -1018
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.7500000000, double 2.7500000000 }
 }
 
 define dso_local { float, double } @test8() {
-; LA32-LABEL: test8:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI7_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI7_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI7_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI7_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test8:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI7_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI7_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI7_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI7_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test8:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1273
+; CHECK-NEXT:    vldi $vr1, -1017
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 2.8750000000, double 2.8750000000 }
 }
 
 define dso_local { float, double } @test9() {
-; LA32-LABEL: test9:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI8_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI8_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI8_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI8_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test9:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI8_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI8_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI8_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI8_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test9:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1272
+; CHECK-NEXT:    vldi $vr1, -1016
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.0000000000, double 3.0000000000 }
 }
 
 define dso_local { float, double } @test10() {
-; LA32-LABEL: test10:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI9_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI9_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI9_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI9_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test10:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI9_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI9_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI9_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI9_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test10:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1271
+; CHECK-NEXT:    vldi $vr1, -1015
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.1250000000, double 3.1250000000 }
 }
 
 define dso_local { float, double } @test11() {
-; LA32-LABEL: test11:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI10_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI10_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI10_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI10_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test11:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI10_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI10_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI10_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI10_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test11:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1270
+; CHECK-NEXT:    vldi $vr1, -1014
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.2500000000, double 3.2500000000 }
 }
 
 define dso_local { float, double } @test12() {
-; LA32-LABEL: test12:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI11_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI11_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI11_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI11_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test12:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI11_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI11_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI11_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI11_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test12:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1269
+; CHECK-NEXT:    vldi $vr1, -1013
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.3750000000, double 3.3750000000 }
 }
 
 define dso_local { float, double } @test13() {
-; LA32-LABEL: test13:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI12_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI12_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI12_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI12_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test13:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI12_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI12_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI12_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI12_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test13:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1268
+; CHECK-NEXT:    vldi $vr1, -1012
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.5000000000, double 3.5000000000 }
 }
 
 define dso_local { float, double } @test14() {
-; LA32-LABEL: test14:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI13_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI13_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI13_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI13_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test14:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI13_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI13_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI13_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI13_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test14:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1267
+; CHECK-NEXT:    vldi $vr1, -1011
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.6250000000, double 3.6250000000 }
 }
 
 define dso_local { float, double } @test15() {
-; LA32-LABEL: test15:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI14_0)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI14_0)
-; LA32-NEXT:    fld.s $fa0, $a0, 0
-; LA32-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI14_1)
-; LA32-NEXT:    addi.w $a0, $a0, %pc_lo12(.LCPI14_1)
-; LA32-NEXT:    fld.d $fa1, $a0, 0
-; LA32-NEXT:    ret
-;
-; LA64-LABEL: test15:
-; LA64:       # %bb.0: # %entry
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI14_0)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI14_0)
-; LA64-NEXT:    fld.s $fa0, $a0, 0
-; LA64-NEXT:    pcalau12i $a0, %pc_hi20(.LCPI14_1)
-; LA64-NEXT:    addi.d $a0, $a0, %pc_lo12(.LCPI14_1)
-; LA64-NEXT:    fld.d $fa1, $a0, 0
-; LA64-NEXT:    ret
+; CHECK-LABEL: test15:
+; CHECK:       # %bb.0: # %entry
+; CHECK-NEXT:    vldi $vr0, -1266
+; CHECK-NEXT:    vldi $vr1, -1010
+; CHECK-NEXT:    ret
 entry:
   ret { float, double } { float 3.7500000000, double 3.7500000000 }
 }
 
 define dso_local { float, double } @test16() {
-; LA32-LABEL: test16:
-; LA32:       # %bb.0: # %entry
-; LA32-NEXT:    pcal...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/101923


More information about the llvm-commits mailing list