Skip to content

Commit 6cd4b50

Browse files
committed
[RISCV] Add SiFive core S51
Add SiFive core s51 as rv64imac RocketModel Reviewed-By: MaskRay, evandro Differential Revision: https://reviews.llvm.org/D108886
1 parent a42380c commit 6cd4b50

File tree

5 files changed

+18
-3
lines changed

5 files changed

+18
-3
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ Deprecated Compiler Flags
7171
Modified Compiler Flags
7272
-----------------------
7373

74-
- ...
74+
- Support has been added for the following processors (``-mcpu`` identifiers in parentheses):
75+
76+
- RISC-V SiFive S51 (``sifive-s51``).
7577

7678
Removed Compiler Flags
7779
-------------------------

clang/test/Driver/riscv-cpus.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@
4545
// RUN: %clang -target riscv64 -### -c %s 2>&1 -mtune=sifive-7-series | FileCheck -check-prefix=MTUNE-SIFIVE7-SERIES-64 %s
4646
// MTUNE-SIFIVE7-SERIES-64: "-tune-cpu" "sifive-7-rv64"
4747

48+
// mcpu with mabi option
49+
// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-s51 -mabi=lp64 | FileCheck -check-prefix=MCPU-ABI-SIFIVE-S51 %s
50+
// MCPU-ABI-SIFIVE-S51: "-nostdsysteminc" "-target-cpu" "sifive-s51"
51+
// MCPU-ABI-SIFIVE-S51: "-target-feature" "+m" "-target-feature" "+a"
52+
// MCPU-ABI-SIFIVE-S51: "-target-feature" "+c" "-target-feature" "+64bit"
53+
// MCPU-ABI-SIFIVE-S51: "-target-abi" "lp64"
54+
4855
// mcpu with default march
4956
// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-u54 | FileCheck -check-prefix=MCPU-SIFIVE-U54 %s
5057
// MCPU-SIFIVE-U54: "-nostdsysteminc" "-target-cpu" "sifive-u54"

clang/test/Misc/target-invalid-cpu-note.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,12 +196,12 @@
196196

197197
// RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64
198198
// RISCV64: error: unknown target CPU 'not-a-cpu'
199-
// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-7-rv64, sifive-u54, sifive-u74
199+
// RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74
200200

201201
// RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
202202
// TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
203203
// TUNE-RISCV32: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-7-rv32, sifive-e31, sifive-e76, generic, rocket, sifive-7-series
204204

205205
// RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
206206
// TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
207-
// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-7-rv64, sifive-u54, sifive-u74, generic, rocket, sifive-7-series
207+
// TUNE-RISCV64: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-7-rv64, sifive-s51, sifive-u54, sifive-u74, generic, rocket, sifive-7-series

llvm/include/llvm/Support/RISCVTargetParser.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ PROC(ROCKET_RV64, {"rocket-rv64"}, FK_64BIT, {""})
2020
PROC(SIFIVE_732, {"sifive-7-rv32"}, FK_NONE, {""})
2121
PROC(SIFIVE_764, {"sifive-7-rv64"}, FK_64BIT, {""})
2222
PROC(SIFIVE_E31, {"sifive-e31"}, FK_NONE, {"rv32imac"})
23+
PROC(SIFIVE_S51, {"sifive-s51"}, FK_64BIT, {"rv64imac"})
2324
PROC(SIFIVE_U54, {"sifive-u54"}, FK_64BIT, {"rv64gc"})
2425
PROC(SIFIVE_E76, {"sifive-e76"}, FK_NONE, {"rv32imafc"})
2526
PROC(SIFIVE_U74, {"sifive-u74"}, FK_64BIT, {"rv64gc"})

llvm/lib/Target/RISCV/RISCV.td

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@ def : ProcessorModel<"sifive-e31", RocketModel, [FeatureStdExtM,
254254
FeatureStdExtA,
255255
FeatureStdExtC]>;
256256

257+
def : ProcessorModel<"sifive-s51", RocketModel, [Feature64Bit,
258+
FeatureStdExtM,
259+
FeatureStdExtA,
260+
FeatureStdExtC]>;
261+
257262
def : ProcessorModel<"sifive-u54", RocketModel, [Feature64Bit,
258263
FeatureStdExtM,
259264
FeatureStdExtA,

0 commit comments

Comments
 (0)