[llvm] 741b04b - [RISCV] Only enable GPR<->FPR32 bitconvert isel patterns on RV32. NFCI

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 5 16:15:37 PST 2020


Author: Craig Topper
Date: 2020-11-05T16:15:25-08:00
New Revision: 741b04b0b7912611a8a5b7e74462e87b8930a116

URL: https://github.com/llvm/llvm-project/commit/741b04b0b7912611a8a5b7e74462e87b8930a116
DIFF: https://github.com/llvm/llvm-project/commit/741b04b0b7912611a8a5b7e74462e87b8930a116.diff

LOG: [RISCV] Only enable GPR<->FPR32 bitconvert isel patterns on RV32. NFCI

Bitconvert requires the bitwidth to match on both sides. On RV64
the GPR size is i64 so bitconvert between f32 isn't possible. The
node should never be generated so the pattern won't ever match, but
moving the patterns under IsRV32 makes it more obviously impossible.
It also moves it to a similar location to the patterns for the
custom nodes we use for RV64.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInstrInfoF.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td
index c03d08d752a6..d466069ab2a1 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td
@@ -303,10 +303,6 @@ def : Pat<(f32 (fpimm0)), (FMV_W_X X0)>;
 
 /// Float conversion operations
 
-// Moves (no conversion)
-def : Pat<(bitconvert GPR:$rs1), (FMV_W_X GPR:$rs1)>;
-def : Pat<(bitconvert FPR32:$rs1), (FMV_X_W FPR32:$rs1)>;
-
 // [u]int32<->float conversion patterns must be gated on IsRV32 or IsRV64, so
 // are defined later.
 
@@ -393,6 +389,9 @@ defm : StPat<store, FSW, FPR32>;
 } // Predicates = [HasStdExtF]
 
 let Predicates = [HasStdExtF, IsRV32] in {
+def : Pat<(bitconvert GPR:$rs1), (FMV_W_X GPR:$rs1)>;
+def : Pat<(bitconvert FPR32:$rs1), (FMV_X_W FPR32:$rs1)>;
+
 // float->[u]int. Round-to-zero must be used.
 def : Pat<(fp_to_sint FPR32:$rs1), (FCVT_W_S $rs1, 0b001)>;
 def : Pat<(fp_to_uint FPR32:$rs1), (FCVT_WU_S $rs1, 0b001)>;


        


More information about the llvm-commits mailing list