[clang] [llvm] [RISCV] Add Qualcomm uC Xqcia (Arithmetic) extension (PR #118113)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 29 10:04:48 PST 2024
================
@@ -72,3 +84,27 @@ let Predicates = [HasVendorXqcisls, IsRV32], DecoderNamespace = "Xqcisls" in {
def QC_SRH : QCIStore_ScaleIdx<0b1110, "qc.srh">;
def QC_SRW : QCIStore_ScaleIdx<0b1111, "qc.srw">;
} // Predicates = [HasVendorXqcisls, IsRV32], DecoderNamespace = "Xqcisls"
+
+let Predicates = [HasVendorXqcia, IsRV32], DecoderNamespace = "Xqcia" in {
+let hasSideEffects = 0, mayLoad = 0, mayStore = 0 in {
+ def QC_SLASAT : QCIRVInstRR<0b01010, GPRNoX0, "qc.slasat">;
+ def QC_SLLSAT : QCIRVInstRR<0b01100, GPRNoX0, "qc.sllsat">;
+ def QC_ADDSAT : QCIRVInstRR<0b01110, GPRNoX0, "qc.addsat">;
+ def QC_ADDUSAT : QCIRVInstRR<0b01111, GPRNoX0, "qc.addusat">;
+ def QC_SUBSAT : QCIRVInstRR<0b10000, GPRNoX0, "qc.subsat">;
+ def QC_SUBUSAT : QCIRVInstRR<0b10001, GPRNoX0, "qc.subusat">;
+
+ def QC_WRAP : QCIRVInstRR<0b10010, GPR, "qc.wrap">;
+ def QC_WRAPI : RVInstI<0b000, OPC_CUSTOM_0, (outs GPRNoX0:$rd),
+ (ins GPRNoX0:$rs1, uimm11:$imm11), "qc.wrapi",
+ "$rd, $rs1, $imm11"> {
+ bits<11> imm11;
+
+ let imm12 = {0b0, imm11};
+ }
+
+ def QC_NORM : QCIRVInstR<0b0111, "qc.norm">;
+ def QC_NORMU : QCIRVInstR<0b1000, "qc.normu">;
----------------
topperc wrote:
I have a question about the semantics of qc.normu in the spec
```
XReg clz = (xlen() - 1) - $signed(highest_set_bit(X[rs1]));
XReg exp = (X[rs1] << clz);
XReg mnt = (-clz);
X[rd] = {mnt[23:0], exp[7:0]};
```
Are the assignments of `mnt` and `exp` swapped? Unless I'm misunderstanding, I would expect `exp` to be based only on `clz` and `mnt` to be baed on `(X[rs1] << clz)`.
Also the assignment of `X[rd] = {mnt[23:0], exp[7:0]};` seems like it should be taking the upper 24 bits of `mnt` not the lower 24 bits? But maybe I've misunderstood?
https://github.com/llvm/llvm-project/pull/118113
More information about the cfe-commits
mailing list