[clang] [llvm] [RISCV] Support Remaining P Extension Instructions for RV32/64 (PR #150379)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 15 08:21:11 PDT 2025
================
@@ -559,3 +559,204 @@ let Predicates = [HasStdExtP, IsRV64] in {
def PPACKT_W : RVPBinary_rr<0b0110, 0b01, 0b100, "ppackt.w">;
def PACKT_RV64 : RVPBinary_rr<0b0110, 0b11, 0b100, "packt">;
} // Predicates = [HasStdExtP, IsRV64]
+let Predicates = [HasStdExtP] in {
+ def PM2ADD_H : RVPBinary_rr<0b0000, 0b00, 0b101, "pm2add.h">;
+ def PM4ADD_B : RVPBinary_rr<0b0000, 0b10, 0b101, "pm4add.b">;
+ def PM2ADDA_H : RVPBinary_rr<0b0001, 0b00, 0b101, "pm2adda.h">;
+ def PM4ADDA_B : RVPBinary_rr<0b0001, 0b10, 0b101, "pm4adda.b">;
+ def PM2ADD_HX : RVPBinary_rr<0b0010, 0b00, 0b101, "pm2add.hx">;
+ def PM2ADDA_HX : RVPBinary_rr<0b0011, 0b00, 0b101, "pm2adda.hx">;
+
+ def PM2ADDU_H : RVPBinary_rr<0b0100, 0b00, 0b101, "pm2addu.h">;
+ def PM4ADDU_B : RVPBinary_rr<0b0100, 0b10, 0b101, "pm4addu.b">;
+ def PM2ADDAU_H : RVPBinary_rr<0b0101, 0b00, 0b101, "pm2addau.h">;
+ def PM4ADDAU_B : RVPBinary_rr<0b0101, 0b10, 0b101, "pm4addau.b">;
+ def PMQ2ADD_H : RVPBinary_rr<0b0110, 0b00, 0b101, "pmq2add.h">;
+ def PMQR2ADD_H : RVPBinary_rr<0b0110, 0b10, 0b101, "pmqr2add.h">;
+ def PMQ2ADDA_H : RVPBinary_rr<0b0111, 0b00, 0b101, "pmq2adda.h">;
+ def PMQR2ADDA_H : RVPBinary_rr<0b0111, 0b10, 0b101, "pmqr2adda.h">;
+
+ def PM2SUB_H : RVPBinary_rr<0b1000, 0b00, 0b101, "pm2sub.h">;
+ def PM2SADD_H : RVPBinary_rr<0b1000, 0b10, 0b101, "pm2sadd.h">;
+ def PM2SUBA_H : RVPBinary_rr<0b1001, 0b00, 0b101, "pm2suba.h">;
+ def PM2SUB_HX : RVPBinary_rr<0b1010, 0b00, 0b101, "pm2sub.hx">;
+ def PM2SADD_HX : RVPBinary_rr<0b1010, 0b10, 0b101, "pm2sadd.hx">;
+ def PM2SUBA_HX : RVPBinary_rr<0b1011, 0b00, 0b101, "pm2suba.hx">;
+
+ def PM2ADDSU_H : RVPBinary_rr<0b1100, 0b00, 0b101, "pm2addsu.h">;
+ def PM4ADDSU_B : RVPBinary_rr<0b1100, 0b10, 0b101, "pm4addsu.b">;
+ def PM2ADDASU_H : RVPBinary_rr<0b1101, 0b00, 0b101, "pm2addasu.h">;
+ def PM4ADDASU_B : RVPBinary_rr<0b1101, 0b10, 0b101, "pm4addasu.b">;
+} // Predicates = [HasStdExtP]
+let Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only" in {
+ def MQACC_H01 : RVPBinary_rr<0b1111, 0b00, 0b101, "mqacc.h01">;
+ def MQRACC_H01 : RVPBinary_rr<0b1111, 0b10, 0b101, "mqracc.h01">;
+} // // Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only"
+let Predicates = [HasStdExtP, IsRV64] in {
+ def PM2ADD_W : RVPBinary_rr<0b0000, 0b01, 0b101, "pm2add.w">;
+ def PM4ADD_H : RVPBinary_rr<0b0000, 0b11, 0b101, "pm4add.h">;
+ def PM2ADDA_W : RVPBinary_rr<0b0001, 0b01, 0b101, "pm2adda.w">;
+ def PM4ADDA_H : RVPBinary_rr<0b0001, 0b11, 0b101, "pm4adda.h">;
+ def PM2ADD_WX : RVPBinary_rr<0b0010, 0b01, 0b101, "pm2add.wx">;
+ def PM2ADDA_WX : RVPBinary_rr<0b0011, 0b01, 0b101, "pm2adda.wx">;
+
+ def PM2ADDU_W : RVPBinary_rr<0b0100, 0b01, 0b101, "pm2addu.w">;
+ def PM4ADDU_H : RVPBinary_rr<0b0100, 0b11, 0b101, "pm4addu.h">;
+ def PM2ADDAU_W : RVPBinary_rr<0b0101, 0b01, 0b101, "pm2addau.w">;
+ def PM4ADDAU_H : RVPBinary_rr<0b0101, 0b11, 0b101, "pm4addau.h">;
+ def PMQ2ADD_W : RVPBinary_rr<0b0110, 0b01, 0b101, "pmq2add.w">;
+ def PMQR2ADD_W : RVPBinary_rr<0b0110, 0b11, 0b101, "pmqr2add.w">;
+ def PMQ2ADDA_W : RVPBinary_rr<0b0111, 0b01, 0b101, "pmq2adda.w">;
+ def PMQR2ADDA_W : RVPBinary_rr<0b0111, 0b11, 0b101, "pmqr2adda.w">;
+
+ def PM2SUB_W : RVPBinary_rr<0b1000, 0b01, 0b101, "pm2sub.w">;
+ def PM2SUBA_W : RVPBinary_rr<0b1001, 0b01, 0b101, "pm2suba.w">;
+ def PM2SUB_WX : RVPBinary_rr<0b1010, 0b01, 0b101, "pm2sub.wx">;
+ def PM2SUBA_WX : RVPBinary_rr<0b1011, 0b01, 0b101, "pm2suba.wx">;
+
+ def PM2ADDSU_W : RVPBinary_rr<0b1100, 0b01, 0b101, "pm2addsu.w">;
+ def PM4ADDSU_H : RVPBinary_rr<0b1100, 0b11, 0b101, "pm4addsu.h">;
+ def PM2ADDASU_W : RVPBinary_rr<0b1101, 0b01, 0b101, "pm2addasu.w">;
+ def PM4ADDASU_H : RVPBinary_rr<0b1101, 0b11, 0b101, "pm4addasu.h">;
+
+ def PMQACC_W_H01 : RVPBinary_rr<0b1111, 0b00, 0b101, "pmqacc.w.h01">;
+ def MQACC_W01 : RVPBinary_rr<0b1111, 0b01, 0b101, "mqacc.w01">;
+ def PMQRACC_W_H01 : RVPBinary_rr<0b1111, 0b10, 0b101, "pmqracc.w.h01">;
+ def MQRACC_W01 : RVPBinary_rr<0b1111, 0b11, 0b101, "mqracc.w01">;
+} // Predicates = [HasStdExtP, IsRV64]
+let Predicates = [HasStdExtP] in {
+ def PAS_HX : RVPBinary_rr<0b0000, 0b00, 0b110, "pas.hx">;
+ def PSA_HX : RVPBinary_rr<0b0000, 0b10, 0b110, "psa.hx">;
+ def PSAS_HX : RVPBinary_rr<0b0010, 0b00, 0b110, "psas.hx">;
+ def PSSA_HX : RVPBinary_rr<0b0010, 0b10, 0b110, "pssa.hx">;
+
+ def PMSEQ_H : RVPBinary_rr<0b1000, 0b00, 0b110, "pmseq.h">;
+ def PMSEQ_B : RVPBinary_rr<0b1000, 0b10, 0b110, "pmseq.b">;
+ def PMSLT_H : RVPBinary_rr<0b1010, 0b00, 0b110, "pmslt.h">;
+ def PMSLT_B : RVPBinary_rr<0b1010, 0b10, 0b110, "pmslt.b">;
+ def PMSLTU_H : RVPBinary_rr<0b1011, 0b00, 0b110, "pmsltu.h">;
+ def PMSLTU_B : RVPBinary_rr<0b1011, 0b10, 0b110, "pmsltu.b">;
+
+ def PMIN_H : RVPBinary_rr<0b1100, 0b00, 0b110, "pmin.h">;
+ def PMIN_B : RVPBinary_rr<0b1100, 0b10, 0b110, "pmin.b">;
+ def PMINU_H : RVPBinary_rr<0b1101, 0b00, 0b110, "pminu.h">;
+ def PMINU_B : RVPBinary_rr<0b1101, 0b10, 0b110, "pminu.b">;
+ def PMAX_H : RVPBinary_rr<0b1110, 0b00, 0b110, "pmax.h">;
+ def PMAX_B : RVPBinary_rr<0b1110, 0b10, 0b110, "pmax.b">;
+ def PMAXU_H : RVPBinary_rr<0b1111, 0b00, 0b110, "pmaxu.h">;
+ def PMAXU_B : RVPBinary_rr<0b1111, 0b10, 0b110, "pmaxu.b">;
+} // Predicates = [HasStdExtP]
+let Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only" in {
+ def MSEQ : RVPBinary_rr<0b1000, 0b01, 0b110, "mseq">;
+ def MSLT : RVPBinary_rr<0b1010, 0b01, 0b110, "mslt">;
+ def MSLTU : RVPBinary_rr<0b1011, 0b01, 0b110, "msltu">;
+} // Predicates = [HasStdExtP, IsRV32], DecoderNamespace = "RV32Only"
+let Predicates = [HasStdExtP, IsRV64] in {
+ def PAS_WX : RVPBinary_rr<0b0000, 0b01, 0b110, "pas.wx">;
+ def PSA_WX : RVPBinary_rr<0b0000, 0b11, 0b110, "psa.wx">;
+ def PSAS_WX : RVPBinary_rr<0b0010, 0b01, 0b110, "psas.wx">;
+ def PSSA_WX : RVPBinary_rr<0b0010, 0b11, 0b110, "pssa.wx">;
+ def PAAS_WX : RVPBinary_rr<0b0011, 0b01, 0b110, "paas.wx">;
+ def PASA_WX : RVPBinary_rr<0b0011, 0b11, 0b110, "pasa.wx">;
+
+ def PMSEQ_W : RVPBinary_rr<0b1000, 0b01, 0b110, "pmseq.w">;
+ def PMSLT_W : RVPBinary_rr<0b1010, 0b01, 0b110, "pmslt.w">;
+ def PMSLTU_W : RVPBinary_rr<0b1011, 0b01, 0b110, "pmsltu.w">;
+
+ def PMIN_W : RVPBinary_rr<0b1100, 0b01, 0b110, "pmin.w">;
+ def PMINU_W : RVPBinary_rr<0b1101, 0b01, 0b110, "pminu.w">;
+ def PMAX_W : RVPBinary_rr<0b1110, 0b01, 0b110, "pmax.w">;
+ def PMAXU_W : RVPBinary_rr<0b1111, 0b01, 0b110, "pmaxu.w">;
+} // Predicates = [HasStdExtP, IsRV64]
+
+
+let Predicates = [HasStdExtP] in {
+ def PMULH_H : RVPBinary_rr<0b0000, 0b00, 0b111, "pmulh.h">;
+ def PMULHR_H : RVPBinary_rr<0b0000, 0b10, 0b111, "pmulhr.h">;
+ def PMHACC_H : RVPBinary_rr<0b0001, 0b00, 0b111, "pmhacc.h">;
+ def PMHRACC_H : RVPBinary_rr<0b0001, 0b10, 0b111, "pmhracc.h">;
+ def PMULHU_H : RVPBinary_rr<0b0010, 0b00, 0b111, "pmulhu.h">;
+ def PMULHRU_H : RVPBinary_rr<0b0010, 0b10, 0b111, "pmulhru.h">;
+ def PMHACCU_H : RVPBinary_rr<0b0011, 0b00, 0b111, "pmhaccu.h">;
+ def PMHRACCU_H : RVPBinary_rr<0b0011, 0b10, 0b111, "pmhraccu.h">;
+
+ def PMULH_H_B0 : RVPBinary_rr<0b0100, 0b00, 0b111, "pmulh.h.b0">;
+ def PMULHSU_H_B0 : RVPBinary_rr<0b0100, 0b10, 0b111, "pmulhsu.h.b0">;
+ def PMHACCU_H_B0 : RVPBinary_rr<0b0101, 0b00, 0b111, "pmhaccu.h.b0">;
+ def PMHACCSU_H_B0 : RVPBinary_rr<0b0101, 0b10, 0b111, "pmhaccsu.h.b0">;
+ def PMULH_H_B1 : RVPBinary_rr<0b0110, 0b00, 0b111, "pmulh.h.b1">;
+ def PMULHSU_H_B1 : RVPBinary_rr<0b0110, 0b10, 0b111, "pmulhsu.h.b1">;
+ def PMHACC_H_B1 : RVPBinary_rr<0b0111, 0b00, 0b111, "pmhacc.h.b1">;
+ def PMHACCSU_H_B1 : RVPBinary_rr<0b0111, 0b10, 0b111, "pmhaccsu.h.b1">;
+
+ def PMULHSU_H : RVPBinary_rr<0b1000, 0b00, 0b111, "pmulhsu.h">;
+ def PMULHRSU_H : RVPBinary_rr<0b1000, 0b10, 0b111, "pmulhrsu.h">;
+ def PMHACCSU_H : RVPBinary_rr<0b1001, 0b00, 0b111, "pmhaccsu.h">;
+ def PMHRACCSU_H : RVPBinary_rr<0b1001, 0b10, 0b111, "pmhraccsu.h">;
+ def PMULQ_H : RVPBinary_rr<0b1010, 0b00, 0b111, "pmulq.h">;
+ def PMULQR_H : RVPBinary_rr<0b1010, 0b10, 0b111, "pmulqr.h">;
+} // Predicates = [HasStdExtP]
+
----------------
topperc wrote:
Remove this blank line.
https://github.com/llvm/llvm-project/pull/150379
More information about the cfe-commits
mailing list