diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoD.td b/llvm/lib/Target/RISCV/RISCVInstrInfoD.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoD.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoD.td @@ -76,7 +76,8 @@ Sched<[WriteFSqrt64, ReadFSqrt64]>; def : FPUnaryOpDynFrmAlias; -let SchedRW = [WriteFSGNJ64, ReadFSGNJ64, ReadFSGNJ64] in { +let SchedRW = [WriteFSGNJ64, ReadFSGNJ64, ReadFSGNJ64], + mayRaiseFPException = 0 in { def FSGNJ_D : FPALU_rr<0b0010001, 0b000, "fsgnj.d", FPR64>; def FSGNJN_D : FPALU_rr<0b0010001, 0b001, "fsgnjn.d", FPR64>; def FSGNJX_D : FPALU_rr<0b0010001, 0b010, "fsgnjx.d", FPR64>; @@ -100,6 +101,7 @@ def FLE_D : FPCmp_rr<0b1010001, 0b000, "fle.d", FPR64>; } +let mayRaiseFPException = 0 in def FCLASS_D : FPUnaryOp_r<0b1110001, 0b00000, 0b001, GPR, FPR64, "fclass.d">, Sched<[WriteFClass64, ReadFClass64]>; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoF.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoF.td @@ -59,7 +59,7 @@ // Instruction class templates //===----------------------------------------------------------------------===// -let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1 in class FPFMA_rrr_frm funct2, string opcodestr, RegisterClass rty> : RVInstR4Frm; -let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1 in class FPALU_rr funct7, bits<3> funct3, string opcodestr, RegisterClass rty> : RVInstR; -let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1 in class FPALU_rr_frm funct7, string opcodestr, RegisterClass rty> : RVInstRFrm; -let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1 in class FPUnaryOp_r funct7, bits<5> rs2val, bits<3> funct3, RegisterClass rdty, RegisterClass rs1ty, string opcodestr> : RVInstR funct7, bits<5> rs2val, RegisterClass rdty, RegisterClass rs1ty, string opcodestr> : RVInstRFrm; -let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in +let hasSideEffects = 0, mayLoad = 0, mayStore = 0, mayRaiseFPException = 1 in class FPCmp_rr funct7, bits<3> funct3, string opcodestr, RegisterClass rty> : RVInstR; def : FPUnaryOpDynFrmAlias; -let SchedRW = [WriteFSGNJ32, ReadFSGNJ32, ReadFSGNJ32] in { +let SchedRW = [WriteFSGNJ32, ReadFSGNJ32, ReadFSGNJ32], + mayRaiseFPException = 0 in { def FSGNJ_S : FPALU_rr<0b0010000, 0b000, "fsgnj.s", FPR32>; def FSGNJN_S : FPALU_rr<0b0010000, 0b001, "fsgnjn.s", FPR32>; def FSGNJX_S : FPALU_rr<0b0010000, 0b010, "fsgnjx.s", FPR32>; @@ -194,6 +195,7 @@ def FLE_S : FPCmp_rr<0b1010000, 0b000, "fle.s", FPR32>; } +let mayRaiseFPException = 0 in def FCLASS_S : FPUnaryOp_r<0b1110000, 0b00000, 0b001, GPR, FPR32, "fclass.s">, Sched<[WriteFClass32, ReadFClass32]>; diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td --- a/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZfh.td @@ -79,7 +79,8 @@ Sched<[WriteFSqrt16, ReadFSqrt16]>; def : FPUnaryOpDynFrmAlias; -let SchedRW = [WriteFSGNJ16, ReadFSGNJ16, ReadFSGNJ16] in { +let SchedRW = [WriteFSGNJ16, ReadFSGNJ16, ReadFSGNJ16], + mayRaiseFPException = 0 in { def FSGNJ_H : FPALU_rr<0b0010010, 0b000, "fsgnj.h", FPR16>; def FSGNJN_H : FPALU_rr<0b0010010, 0b001, "fsgnjn.h", FPR16>; def FSGNJX_H : FPALU_rr<0b0010010, 0b010, "fsgnjx.h", FPR16>; @@ -130,6 +131,7 @@ def FLE_H : FPCmp_rr<0b1010010, 0b000, "fle.h", FPR16>; } +let mayRaiseFPException = 0 in def FCLASS_H : FPUnaryOp_r<0b1110010, 0b00000, 0b001, GPR, FPR16, "fclass.h">, Sched<[WriteFClass16, ReadFClass16]>; } // Predicates = [HasStdExtZfh]