Skip to content

Commit 0c25f85

Browse files
[RISCV] Add sifive-p470 processor (#102022)
This is an OOO core that has a vector unit. For more information see https://www.sifive.com/cores/performance-p450-470. Use the existing P400 scheduler model. This model is missing accurate vector scheduling support, but it will be added in a follow up patch. Other tunings can come in future patches too.
1 parent e3778a5 commit 0c25f85

File tree

4 files changed

+78
-7
lines changed

4 files changed

+78
-7
lines changed

clang/test/Driver/riscv-cpus.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,54 @@
304304
// MCPU-SIFIVE-P450-SAME: "-target-feature" "+zbs"
305305
// MCPU-SIFIVE-P450-SAME: "-target-abi" "lp64d"
306306

307+
// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-p470 | FileCheck -check-prefix=MCPU-SIFIVE-P470 %s
308+
// MCPU-SIFIVE-P470: "-target-cpu" "sifive-p470"
309+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+m"
310+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+a"
311+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+f"
312+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+d"
313+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+c"
314+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+v"
315+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zic64b"
316+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zicbom"
317+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zicbop"
318+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zicboz"
319+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+ziccamoa"
320+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+ziccif"
321+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zicclsm"
322+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+ziccrse"
323+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zicsr"
324+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zifencei"
325+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zihintntl"
326+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zihintpause"
327+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zihpm"
328+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zmmul"
329+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+za64rs"
330+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zfhmin"
331+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zba"
332+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zbb"
333+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zbs"
334+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvbb"
335+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvbc"
336+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zve32f"
337+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zve32x"
338+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zve64d"
339+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zve64f"
340+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zve64x"
341+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvkg"
342+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvkn"
343+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvknc"
344+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvkned"
345+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvkng"
346+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvknhb"
347+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvks"
348+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvksc"
349+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvksed"
350+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvksg"
351+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvksh"
352+
// MCPU-SIFIVE-P470-SAME: "-target-feature" "+zvkt"
353+
// MCPU-SIFIVE-P470-SAME: "-target-abi" "lp64d"
354+
307355
// RUN: %clang -target riscv64 -### -c %s 2>&1 -mcpu=sifive-p670 | FileCheck -check-prefix=MCPU-SIFIVE-P670 %s
308356
// MCPU-SIFIVE-P670: "-target-cpu" "sifive-p670"
309357
// MCPU-SIFIVE-P670-SAME: "-target-feature" "+m"

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@
8585

8686
// RUN: not %clang_cc1 -triple riscv64 -target-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix RISCV64
8787
// RISCV64: error: unknown target CPU 'not-a-cpu'
88-
// RISCV64-NEXT: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-p450, sifive-p670, sifive-s21, sifive-s51, sifive-s54, sifive-s76, sifive-u54, sifive-u74, sifive-x280, spacemit-x60, syntacore-scr3-rv64, syntacore-scr4-rv64, veyron-v1, xiangshan-nanhu{{$}}
88+
// RISCV64-NEXT: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-p450, sifive-p470, sifive-p670, sifive-s21, sifive-s51, sifive-s54, sifive-s76, sifive-u54, sifive-u74, sifive-x280, spacemit-x60, syntacore-scr3-rv64, syntacore-scr4-rv64, veyron-v1, xiangshan-nanhu{{$}}
8989

9090
// RUN: not %clang_cc1 -triple riscv32 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV32
9191
// TUNE-RISCV32: error: unknown target CPU 'not-a-cpu'
9292
// TUNE-RISCV32-NEXT: note: valid target CPU values are: generic-rv32, rocket-rv32, sifive-e20, sifive-e21, sifive-e24, sifive-e31, sifive-e34, sifive-e76, syntacore-scr1-base, syntacore-scr1-max, syntacore-scr3-rv32, syntacore-scr4-rv32, generic, rocket, sifive-7-series{{$}}
9393

9494
// RUN: not %clang_cc1 -triple riscv64 -tune-cpu not-a-cpu -fsyntax-only %s 2>&1 | FileCheck %s --check-prefix TUNE-RISCV64
9595
// TUNE-RISCV64: error: unknown target CPU 'not-a-cpu'
96-
// TUNE-RISCV64-NEXT: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-p450, sifive-p670, sifive-s21, sifive-s51, sifive-s54, sifive-s76, sifive-u54, sifive-u74, sifive-x280, spacemit-x60, syntacore-scr3-rv64, syntacore-scr4-rv64, veyron-v1, xiangshan-nanhu, generic, rocket, sifive-7-series{{$}}
96+
// TUNE-RISCV64-NEXT: note: valid target CPU values are: generic-rv64, rocket-rv64, sifive-p450, sifive-p470, sifive-p670, sifive-s21, sifive-s51, sifive-s54, sifive-s76, sifive-u54, sifive-u74, sifive-x280, spacemit-x60, syntacore-scr3-rv64, syntacore-scr4-rv64, veyron-v1, xiangshan-nanhu, generic, rocket, sifive-7-series{{$}}
97+

llvm/docs/ReleaseNotes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ Changes to the RISC-V Backend
107107
the required alignment space with a sequence of `0x0` bytes (the requested
108108
fill value) rather than NOPs.
109109
* Added Syntacore SCR4 CPUs: ``-mcpu=syntacore-scr4-rv32/64``
110+
* ``-mcpu=sifive-p470`` was added.
110111

111112
Changes to the WebAssembly Backend
112113
----------------------------------

llvm/lib/Target/RISCV/RISCVProcessors.td

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,12 @@ def SIFIVE_X280 : RISCVProcessorModel<"sifive-x280", SiFive7Model,
239239
FeatureStdExtZbb],
240240
SiFiveX280TuneFeatures>;
241241

242+
defvar SiFiveP400TuneFeatures = [TuneNoDefaultUnroll,
243+
TuneConditionalCompressedMoveFusion,
244+
TuneLUIADDIFusion,
245+
TuneAUIPCADDIFusion,
246+
FeaturePostRAScheduler];
247+
242248
def SIFIVE_P450 : RISCVProcessorModel<"sifive-p450", SiFiveP400Model,
243249
[Feature64Bit,
244250
FeatureStdExtI,
@@ -266,11 +272,26 @@ def SIFIVE_P450 : RISCVProcessorModel<"sifive-p450", SiFiveP400Model,
266272
FeatureStdExtZfhmin,
267273
FeatureUnalignedScalarMem,
268274
FeatureUnalignedVectorMem],
269-
[TuneNoDefaultUnroll,
270-
TuneConditionalCompressedMoveFusion,
271-
TuneLUIADDIFusion,
272-
TuneAUIPCADDIFusion,
273-
FeaturePostRAScheduler]>;
275+
SiFiveP400TuneFeatures>;
276+
277+
def SIFIVE_P470 : RISCVProcessorModel<"sifive-p470", SiFiveP400Model,
278+
!listconcat(RVA22U64Features,
279+
[FeatureStdExtV,
280+
FeatureStdExtZifencei,
281+
FeatureStdExtZihintntl,
282+
FeatureStdExtZvl128b,
283+
FeatureStdExtZvbb,
284+
FeatureStdExtZvknc,
285+
FeatureStdExtZvkng,
286+
FeatureStdExtZvksc,
287+
FeatureStdExtZvksg,
288+
FeatureVendorXSiFivecdiscarddlone,
289+
FeatureVendorXSiFivecflushdlone,
290+
FeatureUnalignedScalarMem,
291+
FeatureUnalignedVectorMem]),
292+
!listconcat(SiFiveP400TuneFeatures,
293+
[TuneNoSinkSplatOperands])>;
294+
274295

275296
def SIFIVE_P670 : RISCVProcessorModel<"sifive-p670", SiFiveP600Model,
276297
[Feature64Bit,

0 commit comments

Comments
 (0)