Skip to content

Commit b4fb2fd

Browse files
committed
Merge branch 'riscv-zicsr'
* riscv: add the Zicsr extension * riscv: add the Zifencei extension
2 parents fbdc046 + 76d40fa commit b4fb2fd

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

‎target-riscv.c‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#define RISCV_EMBD (1 << 9)
1717
#define RISCV_FPU (RISCV_FLOAT|RISCV_DOUBLE|RISCV_FDIV)
1818
#define RISCV_GENERIC (RISCV_MUL|RISCV_DIV|RISCV_ATOMIC|RISCV_FPU)
19+
#define RISCV_ZICSR (1 << 10)
20+
#define RISCV_ZIFENCEI (1 << 11)
1921

2022
static unsigned int riscv_flags;
2123

@@ -33,8 +35,8 @@ static void parse_march_riscv(const char *arg)
3335
}, extensions[] = {
3436
{ "m", RISCV_MUL|RISCV_DIV },
3537
{ "a", RISCV_ATOMIC },
36-
{ "f", RISCV_FLOAT|RISCV_FDIV },
37-
{ "d", RISCV_DOUBLE|RISCV_FDIV },
38+
{ "f", RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR },
39+
{ "d", RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR },
3840
{ "g", RISCV_GENERIC },
3941
{ "q", 0 },
4042
{ "l", 0 },
@@ -47,6 +49,8 @@ static void parse_march_riscv(const char *arg)
4749
{ "n", 0 },
4850
{ "h", 0 },
4951
{ "s", 0 },
52+
{ "_zicsr", RISCV_ZICSR },
53+
{ "_zifencei", RISCV_ZIFENCEI },
5054
};
5155
int i;
5256

@@ -127,6 +131,10 @@ static void predefine_riscv(const struct target *self)
127131
predefine("__riscv_mul", 1, "1");
128132
if ((riscv_flags & RISCV_MUL) && (riscv_flags & RISCV_DIV))
129133
predefine("__riscv_muldiv", 1, "1");
134+
if (riscv_flags & RISCV_ZICSR)
135+
predefine("__riscv_zicsr", 1, "1");
136+
if (riscv_flags & RISCV_ZIFENCEI)
137+
predefine("__riscv_zifencei", 1, "1");
130138

131139
if (cmodel)
132140
predefine_strong("__riscv_cmodel_%s", cmodel);

0 commit comments

Comments
 (0)