Skip to content

Commit a6de034

Browse files
authored
[RISCV] Combine 3 bit-manip extensions into B (#132858)
Like cryptography extensions like `Zk`, `B` (a combination of `Zba`, `Zbb` and `Zbs` extensions) can be useful if we handle this extension as a combination. If all `Zba`, `Zbb` and `Zbs` extensions are enabled, it also enables the `B` extension.
1 parent 5105ecc commit a6de034

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -878,8 +878,8 @@ void RISCVISAInfo::updateImplication() {
878878
}
879879

880880
static constexpr StringLiteral CombineIntoExts[] = {
881-
{"zk"}, {"zkn"}, {"zks"}, {"zvkn"}, {"zvknc"},
882-
{"zvkng"}, {"zvks"}, {"zvksc"}, {"zvksg"},
881+
{"b"}, {"zk"}, {"zkn"}, {"zks"}, {"zvkn"},
882+
{"zvknc"}, {"zvkng"}, {"zvks"}, {"zvksc"}, {"zvksg"},
883883
};
884884

885885
void RISCVISAInfo::updateCombination() {

llvm/test/CodeGen/RISCV/attributes.ll

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
; RUN: llc -mtriple=riscv32 -mattr=+m,+zmmul %s -o - | FileCheck --check-prefixes=CHECK,RV32MZMMUL %s
77
; RUN: llc -mtriple=riscv32 -mattr=+a %s -o - | FileCheck --check-prefixes=CHECK,RV32A %s
88
; RUN: llc -mtriple=riscv32 -mattr=+b %s -o - | FileCheck --check-prefixes=CHECK,RV32B %s
9+
; RUN: llc -mtriple=riscv32 -mattr=+zba,+zbb,+zbs %s -o - | FileCheck --check-prefixes=CHECK,RV32COMBINEINTOB %s
910
; RUN: llc -mtriple=riscv32 -mattr=+f %s -o - | FileCheck --check-prefixes=CHECK,RV32F %s
1011
; RUN: llc -mtriple=riscv32 -mattr=+d %s -o - | FileCheck --check-prefixes=CHECK,RV32D %s
1112
; RUN: llc -mtriple=riscv32 -mattr=+c %s -o - | FileCheck --check-prefixes=CHECK,RV32C %s
@@ -173,6 +174,7 @@
173174
; RUN: llc -mtriple=riscv64 -mattr=+a --riscv-abi-attributes %s -o - | FileCheck --check-prefixes=CHECK,RV64A,A6S %s
174175
; RUN: llc -mtriple=riscv64 -mattr=+a,experimental-zalasr --riscv-abi-attributes %s -o - | FileCheck --check-prefixes=CHECK,RV64ZALASRA,A7 %s
175176
; RUN: llc -mtriple=riscv64 -mattr=+b %s -o - | FileCheck --check-prefixes=CHECK,RV64B %s
177+
; RUN: llc -mtriple=riscv64 -mattr=+zba,+zbb,+zbs %s -o - | FileCheck --check-prefixes=CHECK,RV64COMBINEINTOB %s
176178
; RUN: llc -mtriple=riscv64 -mattr=+f %s -o - | FileCheck --check-prefixes=CHECK,RV64F %s
177179
; RUN: llc -mtriple=riscv64 -mattr=+d %s -o - | FileCheck --check-prefixes=CHECK,RV64D %s
178180
; RUN: llc -mtriple=riscv64 -mattr=+c %s -o - | FileCheck --check-prefixes=CHECK,RV64C %s
@@ -341,6 +343,7 @@
341343
; RV32MZMMUL: .attribute 5, "rv32i2p1_m2p0_zmmul1p0"
342344
; RV32A: .attribute 5, "rv32i2p1_a2p1_zaamo1p0_zalrsc1p0"
343345
; RV32B: .attribute 5, "rv32i2p1_b1p0_zba1p0_zbb1p0_zbs1p0"
346+
; RV32COMBINEINTOB: .attribute 5, "rv32i2p1_b1p0_zba1p0_zbb1p0_zbs1p0"
344347
; RV32F: .attribute 5, "rv32i2p1_f2p2_zicsr2p0"
345348
; RV32D: .attribute 5, "rv32i2p1_f2p2_d2p2_zicsr2p0"
346349
; RV32C: .attribute 5, "rv32i2p1_c2p0_zca1p0"
@@ -505,6 +508,7 @@
505508
; RV64MZMMUL: .attribute 5, "rv64i2p1_m2p0_zmmul1p0"
506509
; RV64A: .attribute 5, "rv64i2p1_a2p1_zaamo1p0_zalrsc1p0"
507510
; RV64B: .attribute 5, "rv64i2p1_b1p0_zba1p0_zbb1p0_zbs1p0"
511+
; RV64COMBINEINTOB: .attribute 5, "rv64i2p1_b1p0_zba1p0_zbb1p0_zbs1p0"
508512
; RV64F: .attribute 5, "rv64i2p1_f2p2_zicsr2p0"
509513
; RV64D: .attribute 5, "rv64i2p1_f2p2_d2p2_zicsr2p0"
510514
; RV64C: .attribute 5, "rv64i2p1_c2p0_zca1p0"

0 commit comments

Comments
 (0)