[llvm] [RISCV] Fix more boundary cases in immediate selection for Zdinx load/store on RV32. (PR #105874)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 25 00:27:15 PDT 2024


================
@@ -2705,7 +2735,7 @@ bool RISCVDAGToDAGISel::SelectAddrRegImm(SDValue Addr, SDValue &Base,
     // Handle immediates in the range [-4096,-2049] or [2048, 4094]. We can use
     // an ADDI for part of the offset and fold the rest into the load/store.
     // This mirrors the AddiPair PatFrag in RISCVInstrInfo.td.
-    if (isInt<12>(CVal / 2) && isInt<12>(CVal - CVal / 2)) {
+    if (CVal >= -4096 && CVal < (4094 - RV32ZdinxRange)) {
----------------
dtcxzyw wrote:

```suggestion
    if (CVal >= -4096 && CVal <= (4094 - RV32ZdinxRange)) {
```


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


More information about the llvm-commits mailing list