Skip to content

Commit 6f6dc9c

Browse files
authored
[RISCV] Implement Feature Bits for B, E, H (#143436)
As defined in riscv-non-isa/riscv-c-api-doc#109.
1 parent 4904913 commit 6f6dc9c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

compiler-rt/lib/builtins/cpu_model/riscv.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,18 @@ struct {
2424
// TODO: Maybe generate a header from tablegen then include it.
2525
#define A_GROUPID 0
2626
#define A_BITMASK (1ULL << 0)
27+
#define B_GROUPID 0
28+
#define B_BITMASK (1ULL << 1)
2729
#define C_GROUPID 0
2830
#define C_BITMASK (1ULL << 2)
2931
#define D_GROUPID 0
3032
#define D_BITMASK (1ULL << 3)
33+
#define E_GROUPID 0
34+
#define E_BITMASK (1ULL << 4)
3135
#define F_GROUPID 0
3236
#define F_BITMASK (1ULL << 5)
37+
#define H_GROUPID 0
38+
#define H_BITMASK (1ULL << 7)
3339
#define I_GROUPID 0
3440
#define I_BITMASK (1ULL << 8)
3541
#define M_GROUPID 0

llvm/lib/Target/RISCV/RISCVFeatures.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ def FeatureStdExtI
7575
RISCVExtensionBitmask<0, 8>;
7676

7777
def FeatureStdExtE
78-
: RISCVExtension<2, 0, "Embedded Instruction Set with 16 GPRs">;
78+
: RISCVExtension<2, 0, "Embedded Instruction Set with 16 GPRs">,
79+
RISCVExtensionBitmask<0, 4>;
7980

8081
def FeatureStdExtZic64b
8182
: RISCVExtension<1, 0, "Cache Block Size Is 64 Bytes">;
@@ -510,7 +511,8 @@ def HasStdExtZbs : Predicate<"Subtarget->hasStdExtZbs()">,
510511

511512
def FeatureStdExtB
512513
: RISCVExtension<1, 0, "the collection of the Zba, Zbb, Zbs extensions",
513-
[FeatureStdExtZba, FeatureStdExtZbb, FeatureStdExtZbs]>;
514+
[FeatureStdExtZba, FeatureStdExtZbb, FeatureStdExtZbs]>,
515+
RISCVExtensionBitmask<0, 1>;
514516

515517
def FeatureStdExtZbkb
516518
: RISCVExtension<1, 0, "Bitmanip instructions for Cryptography">,
@@ -887,8 +889,8 @@ def HasVInstructionsFullMultiply : Predicate<"Subtarget->hasVInstructionsFullMul
887889

888890
// Hypervisor Extensions
889891

890-
def FeatureStdExtH : RISCVExtension<1, 0, "Hypervisor">;
891-
892+
def FeatureStdExtH : RISCVExtension<1, 0, "Hypervisor">,
893+
RISCVExtensionBitmask<0, 7>;
892894
def HasStdExtH : Predicate<"Subtarget->hasStdExtH()">,
893895
AssemblerPredicate<(all_of FeatureStdExtH),
894896
"'H' (Hypervisor)">;

0 commit comments

Comments
 (0)