Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Target/LoongArch/LoongArchFloat64InstrInfo.td
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | |||||
/// Loads | /// Loads | ||||
defm : LdPat<load, FLD_D, f64>; | defm : LdPat<load, FLD_D, f64>; | ||||
/// Stores | /// Stores | ||||
defm : StPat<store, FST_D, FPR64, f64>; | defm : StPat<store, FST_D, FPR64, f64>; | ||||
} // Predicates = [HasBasicD] | } // Predicates = [HasBasicD] | ||||
/// Floating point constants | |||||
let Predicates = [HasBasicD, IsLA64] in { | |||||
def : Pat<(f64 fpimm0), (MOVGR2FR_D R0)>; | |||||
def : Pat<(f64 fpimm0neg), (FNEG_D (MOVGR2FR_D R0))>; | |||||
def : Pat<(f64 fpimm1), (FFINT_D_L (MOVGR2FR_D (ADDI_D R0, 1)))>; | |||||
} // Predicates = [HasBasicD, IsLA64] | |||||
let Predicates = [HasBasicD, IsLA32] in { | |||||
def : Pat<(f64 fpimm0), (FCVT_D_S (MOVGR2FR_W R0))>; | |||||
def : Pat<(f64 fpimm0neg), (FCVT_D_S (FNEG_S (MOVGR2FR_W R0)))>; | |||||
xen0n: Are we better off handling this by just hard-coding the bit patterns then `movgr2fr.w` and… | |||||
gonglingqinAuthorUnsubmitted Thanks for the suggestion, I will change that. gonglingqin: Thanks for the suggestion, I will change that. | |||||
def : Pat<(f64 fpimm1), (FCVT_D_S (FFINT_S_W (MOVGR2FR_W (ADDI_W R0, 1))))>; | |||||
} // Predicates = [HasBasicD, IsLA32] |
Are we better off handling this by just hard-coding the bit patterns then movgr2fr.w and movgr2frh.w? I don't know the exact latencies for fcvt.d.s but plain moves should be a bit faster.