[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">;
----------------
topperc wrote:
PAAS_HX, PASA_HX are missing.
https://github.com/llvm/llvm-project/pull/150379
More information about the cfe-commits
mailing list