This revision implements IR Intrinsic support for RISCV Scalar Crypto extension according to the specification of version 1.0
Co-author:@ksyx & @VincentWu & @lihongliang & @achieveartificialintelligence
Details
Diff Detail
Event Timeline
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 1254 | one space before ":"  | |
| llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
|---|---|---|
| 259 ↗ | (On Diff #381463) | This should be done in the else block where hasStdExtZbb() is handled. Zbp is for GREVI.  | 
| 2427 ↗ | (On Diff #381463) | This should not be needed with the other change.  | 
| llvm/lib/Target/RISCV/RISCVInstrInfoZk.td | ||
| 24 ↗ | (On Diff #381463) | This needs to be rebased on the current Zk patch.  | 
| 211 ↗ | (On Diff #381463) | There are no _K instructions in the most recent Zk patches. All Zb* related changes should be in RISCVInstrInfoZb.td  | 
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 116 | Capital Z  | |
| 117 | rev8 is the same as llvm.bswap.i32 or llvm.bswap.i64. We don't need an intrinsic for it.  | |
| 1371 | Capitalize Z in the comments.  | |
| llvm/lib/Target/RISCV/RISCVISelLowering.cpp | ||
| 282 ↗ | (On Diff #402875) | You want Zbkb in addition to Zbb here.  | 
| llvm/lib/Target/RISCV/RISCVInstrInfoZb.td | ||
| 892 ↗ | (On Diff #402875) | This should stay Zbp only.  | 
| 901 ↗ | (On Diff #402875) | This should stay Zbp only.  | 
| 1196 ↗ | (On Diff #402875) | We don't need int_riscv_rev8. We can use bswap  | 
| llvm/test/CodeGen/RISCV/rv32zbc-zbkc-intrinsic.ll | ||
| 5 ↗ | (On Diff #402875) | Can we use a single check-prefix?  | 
| llvm/test/CodeGen/RISCV/rv32zbp-zbkb.ll | ||
| 7 ↗ | (On Diff #402875) | Can we use one check-prefix for Zbp and Zbkb?  | 
| llvm/test/CodeGen/RISCV/rv64zbb-zbp-zbkb.ll | ||
| 9 ↗ | (On Diff #402875) | Can we use one check-prefix for Zbb, Zbp, and Zbkb?  | 
| llvm/test/CodeGen/RISCV/rv64zbc-zbkc-intrinsic.ll | ||
| 5 ↗ | (On Diff #402875) | Can we use a single check-prefix?  | 
| llvm/test/CodeGen/RISCV/rv64zbp-zbkb.ll | ||
| 7 ↗ | (On Diff #402875) | Can we use one check-prefix for Zbp and Zbkb?  | 
| llvm/test/CodeGen/RISCV/rv64zksed-intrinsic.ll | ||
| 13 ↗ | (On Diff #402875) | Something went wrong here  | 
| 29 ↗ | (On Diff #402875) | And here  | 
| llvm/lib/Target/RISCV/RISCV.td | ||
|---|---|---|
| 175 ↗ | (On Diff #403139) | The string for Zbb was recently updated. Please update to match.  | 
| llvm/test/CodeGen/RISCV/rv32zbb-zbp-zbkb.ll | ||
| 9 ↗ | (On Diff #403139) | Can we share a prefix for Zbb/Zbp/Zbkb?  | 
| llvm/test/CodeGen/RISCV/rv64zbb-zbp-zbkb.ll | ||
| 507 ↗ | (On Diff #403139) | This a bug that Zbp doesn't match Zbb. I'll fix it. You'll need to add Zbkb to RISCVTargetLowering::hasAndNotCompare in this patch.  | 
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 1370 | Why does this intrinsic have the Returned attribute?  | |
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 1370 | Maybe this is following the old 0.9.0 version that mixes the use of rs1/rd registers.  | |
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 1370 | I see, but that was still a mistake. The Returned property means that the *value* passed into the argument is the *value* that is returned. Even if rd/rs1 are the same register, the operation still changes the value in that register.  | |
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 1370 | Thanks for pointing out this as I may misunderstood this while implementing.  | |
| llvm/include/llvm/IR/IntrinsicsRISCV.td | ||
|---|---|---|
| 1370 | Thanks! I've committed in 352e19c.  | |
Capital Z