RISC-V: Add basic support for the vector extension
Subsystems (2)
PATCH 1/1 RISC-V: Add basic support for the vector extension
From: Conor Dooley <[email protected]>
I've started hitting this in CI while testing Andy's vector enablement series. I'm not entirely sure if there is more to do here, other than squeezing in the duplicate of what has been done for other extensions.
---
This is based on top of patches already on the sparse list, adding support for some multi-letter extensions for RISC-V:
https://lore.kernel.org/linux-sparse/[email protected]/
https://lore.kernel.org/linux-sparse/[email protected]/
--- target-riscv.c | 4 ++++ 1 file changed, 4 insertions(+)
target-riscv.c +4 -0
@@ -21,6 +21,7 @@#define RISCV_ZIFENCEI (1 << 11)#define RISCV_ZICBOM (1 << 12)#define RISCV_ZIHINTPAUSE (1 << 13) +#define RISCV_VECTOR (1 << 14)static unsigned int riscv_flags;
@@ -41,6 +42,7 @@ static void parse_march_riscv(const char *arg) { "f", RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR }, { "d", RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR }, { "c", RISCV_COMP }, + { "v", RISCV_VECTOR }, { "_zicsr", RISCV_ZICSR }, { "_zifencei", RISCV_ZIFENCEI }, { "_zicbom", RISCV_ZICBOM },
@@ -147,6 +149,8 @@ static void predefine_riscv(const struct target *self)predefine ("__riscv_zicbom" ,1 ,"1" );if (riscv_flags &RISCV_ZIHINTPAUSE )predefine ("__riscv_zihintpause" ,1 ,"1" ); +if (riscv_flags &RISCV_VECTOR ) +predefine ("__riscv_vector" ,1 ,"1" );if (cmodel)predefine_strong ("__riscv_cmodel_%s" , cmodel);
Signature · 1 line
2.39.2
Palmer Dabbelt
maintainerQuoted 42 lines · Conor Dooley
From: Conor Dooley <[email protected]>
I've started hitting this in CI while testing Andy's vector enablement series. I'm not entirely sure if there is more to do here, other than squeezing in the duplicate of what has been done for other extensions.
Signed-off-by Conor Dooley <[email protected]>---
This is based on top of patches already on the sparse list, adding support for some multi-letter extensions for RISC-V:
https://lore.kernel.org/linux-sparse/[email protected]/
https://lore.kernel.org/linux-sparse/[email protected]/--- target-riscv.c | 4 ++++ 1 file changed, 4 insertions(+)target-riscv.c +2
-0@@ -21,6 +21,7 @@#define RISCV_ZIFENCEI (1 << 11)#define RISCV_ZICBOM (1 << 12)#define RISCV_ZIHINTPAUSE (1 << 13) +#define RISCV_VECTOR (1 << 14)static unsigned int riscv_flags;@@ -41,6 +42,7 @@ static void parse_march_riscv(const char *arg) { "f", RISCV_FLOAT|RISCV_FDIV|RISCV_ZICSR }, { "d", RISCV_DOUBLE|RISCV_FDIV|RISCV_ZICSR }, { "c", RISCV_COMP }, + { "v", RISCV_VECTOR }, { "_zicsr", RISCV_ZICSR }, { "_zifencei", RISCV_ZIFENCEI }, { "_zicbom", RISCV_ZICBOM },
target-riscv.c static void predefine_riscv(const struct target *self) · line 153
Quoted 5 lines
target-riscv.c +2
-0@@ -147,6 +149,8 @@ static void predefine_riscv(const struct target *self)predefine ("__riscv_zicbom" ,1 ,"1" );if (riscv_flags &RISCV_ZIHINTPAUSE )predefine ("__riscv_zihintpause" ,1 ,"1" ); +if (riscv_flags &RISCV_VECTOR ) +predefine ("__riscv_vector" ,1 ,"1" );
V adds a bunch of V-subset extensions. I don't think we need to faithfully handle those, but we should at least set the right element type and length fields for V as code might depend on those.
Quoted 3 lines
target-riscv.c +0
-0if (cmodel)predefine_strong ("__riscv_cmodel_%s" , cmodel);