1 //===-- RISCVProcessors.td - RISC-V Processors -------------*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 //===----------------------------------------------------------------------===//
10 // RISC-V processors supported.
11 //===----------------------------------------------------------------------===//
14 bits<8> PrefFunctionAlignment = 1;
15 bits<8> PrefLoopAlignment = 1;
17 // Information needed by LoopDataPrefetch.
18 bits<16> CacheLineSize = 0;
19 bits<16> PrefetchDistance = 0;
20 bits<16> MinPrefetchStride = 1;
21 bits<32> MaxPrefetchIterationsAhead = -1;
23 bits<32> MinimumJumpTableEntries = 5;
25 // Tail duplication threshold at -O3.
26 bits<32> TailDupAggressiveThreshold = 6;
28 bits<32> MaxStoresPerMemsetOptSize = 4;
29 bits<32> MaxStoresPerMemset = 8;
31 bits<32> MaxGluedStoresPerMemcpy = 0;
32 bits<32> MaxStoresPerMemcpyOptSize = 4;
33 bits<32> MaxStoresPerMemcpy = 8;
35 bits<32> MaxStoresPerMemmoveOptSize = 4;
36 bits<32> MaxStoresPerMemmove = 8;
38 bits<32> MaxLoadsPerMemcmpOptSize = 4;
39 bits<32> MaxLoadsPerMemcmp = 8;
42 def RISCVTuneInfoTable : GenericTable {
43 let FilterClass = "RISCVTuneInfo";
44 let CppTypeName = "RISCVTuneInfo";
45 let Fields = ["Name", "PrefFunctionAlignment", "PrefLoopAlignment",
46 "CacheLineSize", "PrefetchDistance", "MinPrefetchStride",
47 "MaxPrefetchIterationsAhead", "MinimumJumpTableEntries",
48 "TailDupAggressiveThreshold", "MaxStoresPerMemsetOptSize",
49 "MaxStoresPerMemset", "MaxGluedStoresPerMemcpy",
50 "MaxStoresPerMemcpyOptSize", "MaxStoresPerMemcpy",
51 "MaxStoresPerMemmoveOptSize", "MaxStoresPerMemmove",
52 "MaxLoadsPerMemcmpOptSize", "MaxLoadsPerMemcmp"];
55 def getRISCVTuneInfo : SearchIndex {
56 let Table = RISCVTuneInfoTable;
60 class GenericTuneInfo: RISCVTuneInfo;
62 class RISCVProcessorModel<string n,
64 list<SubtargetFeature> f,
65 list<SubtargetFeature> tunef = [],
66 string default_march = "">
67 : ProcessorModel<n, m, f, tunef> {
68 string DefaultMarch = default_march;
74 class RISCVTuneProcessorModel<string n,
76 list<SubtargetFeature> tunef = [],
77 list<SubtargetFeature> f = []>
78 : ProcessorModel<n, m, f,tunef>;
80 defvar GenericTuneFeatures = [TuneOptimizedNF2SegmentLoadStore];
82 def GENERIC_RV32 : RISCVProcessorModel<"generic-rv32",
88 def GENERIC_RV64 : RISCVProcessorModel<"generic-rv64",
94 // Support generic for compatibility with other targets. The triple will be used
95 // to change to the appropriate rv32/rv64 version.
96 def GENERIC : RISCVTuneProcessorModel<"generic", NoSchedModel>, GenericTuneInfo;
98 def ROCKET_RV32 : RISCVProcessorModel<"rocket-rv32",
102 FeatureStdExtZifencei,
103 FeatureStdExtZicsr]>;
104 def ROCKET_RV64 : RISCVProcessorModel<"rocket-rv64",
108 FeatureStdExtZifencei,
109 FeatureStdExtZicsr]>;
110 def ROCKET : RISCVTuneProcessorModel<"rocket",
113 defvar SiFive7TuneFeatures = [TuneSiFive7, TuneNoDefaultUnroll,
114 TuneShortForwardBranchOpt,
115 TunePostRAScheduler];
116 def SIFIVE_7 : RISCVTuneProcessorModel<"sifive-7-series",
117 SiFive7Model, SiFive7TuneFeatures>;
119 def SIFIVE_E20 : RISCVProcessorModel<"sifive-e20",
124 FeatureStdExtZifencei,
128 def SIFIVE_E21 : RISCVProcessorModel<"sifive-e21",
133 FeatureStdExtZifencei,
138 def SIFIVE_E24 : RISCVProcessorModel<"sifive-e24",
142 FeatureStdExtZifencei,
148 def SIFIVE_E31 : RISCVProcessorModel<"sifive-e31",
152 FeatureStdExtZifencei,
158 def SIFIVE_E34 : RISCVProcessorModel<"sifive-e34",
162 FeatureStdExtZifencei,
168 def SIFIVE_E76 : RISCVProcessorModel<"sifive-e76",
172 FeatureStdExtZifencei,
177 SiFive7TuneFeatures>;
179 def SIFIVE_S21 : RISCVProcessorModel<"sifive-s21",
184 FeatureStdExtZifencei,
189 def SIFIVE_S51 : RISCVProcessorModel<"sifive-s51",
194 FeatureStdExtZifencei,
199 def SIFIVE_S54 : RISCVProcessorModel<"sifive-s54",
203 FeatureStdExtZifencei,
210 def SIFIVE_S76 : RISCVProcessorModel<"sifive-s76",
214 FeatureStdExtZifencei,
220 FeatureStdExtZihintpause],
221 SiFive7TuneFeatures>;
223 def SIFIVE_U54 : RISCVProcessorModel<"sifive-u54",
227 FeatureStdExtZifencei,
234 def SIFIVE_U74 : RISCVProcessorModel<"sifive-u74",
238 FeatureStdExtZifencei,
244 SiFive7TuneFeatures>;
246 defvar SiFiveX280TuneFeatures = !listconcat(SiFive7TuneFeatures,
248 TuneOptimizedZeroStrideLoad,
249 TuneOptimizedNF2SegmentLoadStore]);
250 def SIFIVE_X280 : RISCVProcessorModel<"sifive-x280", SiFive7Model,
253 FeatureStdExtZifencei,
260 FeatureStdExtZvl512b,
265 SiFiveX280TuneFeatures>;
267 defvar SiFiveP400TuneFeatures = [TuneNoDefaultUnroll,
268 TuneConditionalCompressedMoveFusion,
271 TunePostRAScheduler];
273 def SIFIVE_P450 : RISCVProcessorModel<"sifive-p450", SiFiveP400Model,
274 !listconcat(RVA22U64Features,
275 [FeatureStdExtZifencei,
276 FeatureStdExtZihintntl,
277 FeatureUnalignedScalarMem,
278 FeatureUnalignedVectorMem]),
279 SiFiveP400TuneFeatures>;
281 def SIFIVE_P470 : RISCVProcessorModel<"sifive-p470", SiFiveP400Model,
282 !listconcat(RVA22U64Features,
284 FeatureStdExtZifencei,
285 FeatureStdExtZihintntl,
286 FeatureStdExtZvl128b,
292 FeatureVendorXSiFivecdiscarddlone,
293 FeatureVendorXSiFivecflushdlone,
294 FeatureUnalignedScalarMem,
295 FeatureUnalignedVectorMem]),
296 !listconcat(SiFiveP400TuneFeatures,
297 [TuneNoSinkSplatOperands,
298 TuneVXRMPipelineFlush])>;
301 def SIFIVE_P670 : RISCVProcessorModel<"sifive-p670", SiFiveP600Model,
302 !listconcat(RVA22U64Features,
304 FeatureStdExtZifencei,
305 FeatureStdExtZihintntl,
306 FeatureStdExtZvl128b,
312 FeatureUnalignedScalarMem,
313 FeatureUnalignedVectorMem]),
314 [TuneNoDefaultUnroll,
315 TuneConditionalCompressedMoveFusion,
318 TuneNoSinkSplatOperands,
319 TuneVXRMPipelineFlush,
320 TunePostRAScheduler]>;
322 def SYNTACORE_SCR1_BASE : RISCVProcessorModel<"syntacore-scr1-base",
327 FeatureStdExtZifencei,
329 [TuneNoDefaultUnroll]>;
331 def SYNTACORE_SCR1_MAX : RISCVProcessorModel<"syntacore-scr1-max",
336 FeatureStdExtZifencei,
339 [TuneNoDefaultUnroll]>;
341 def SYNTACORE_SCR3_RV32 : RISCVProcessorModel<"syntacore-scr3-rv32",
342 SyntacoreSCR3RV32Model,
346 FeatureStdExtZifencei,
349 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
351 def SYNTACORE_SCR3_RV64 : RISCVProcessorModel<"syntacore-scr3-rv64",
352 SyntacoreSCR3RV64Model,
356 FeatureStdExtZifencei,
360 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
362 def SYNTACORE_SCR4_RV32 : RISCVProcessorModel<"syntacore-scr4-rv32",
363 SyntacoreSCR4RV32Model,
367 FeatureStdExtZifencei,
372 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
374 def SYNTACORE_SCR4_RV64 : RISCVProcessorModel<"syntacore-scr4-rv64",
375 SyntacoreSCR4RV64Model,
379 FeatureStdExtZifencei,
385 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
387 def SYNTACORE_SCR5_RV32 : RISCVProcessorModel<"syntacore-scr5-rv32",
388 SyntacoreSCR5RV32Model,
392 FeatureStdExtZifencei,
398 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
400 def SYNTACORE_SCR5_RV64 : RISCVProcessorModel<"syntacore-scr5-rv64",
401 SyntacoreSCR5RV64Model,
405 FeatureStdExtZifencei,
411 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
413 def SYNTACORE_SCR7 : RISCVProcessorModel<"syntacore-scr7",
418 FeatureStdExtZifencei,
430 [TuneNoDefaultUnroll, TunePostRAScheduler]>;
432 def TENSTORRENT_ASCALON_D8 : RISCVProcessorModel<"tt-ascalon-d8",
434 !listconcat(RVA23S64Features,
437 FeatureStdExtSscofpmf,
438 FeatureStdExtSsstrict,
439 FeatureStdExtZfbfmin,
443 FeatureStdExtZvfbfmin,
444 FeatureStdExtZvfbfwma,
447 FeatureStdExtZvl256b,
448 FeatureUnalignedScalarMem,
449 FeatureUnalignedVectorMem]),
450 [TuneNoDefaultUnroll,
451 TuneOptimizedZeroStrideLoad,
452 TunePostRAScheduler]>;
454 def VENTANA_VEYRON_V1 : RISCVProcessorModel<"veyron-v1",
458 FeatureStdExtZifencei,
462 FeatureStdExtZihintpause,
475 FeatureVendorXVentanaCondOps],
481 TuneShiftedZExtWFusion,
483 let MVendorID = 0x61f;
484 let MArchID = 0x8000000000010000;
488 def XIANGSHAN_NANHU : RISCVProcessorModel<"xiangshan-nanhu",
493 FeatureStdExtZifencei,
506 FeatureStdExtSvinval,
508 FeatureStdExtZicboz],
509 [TuneNoDefaultUnroll,
512 TuneShiftedZExtWFusion]>;
514 def SPACEMIT_X60 : RISCVProcessorModel<"spacemit-x60",
516 !listconcat(RVA22S64Features,
518 FeatureStdExtSscofpmf,
520 FeatureStdExtSvnapot,
527 FeatureStdExtZvl256b,
528 FeatureUnalignedScalarMem]),
530 TuneOptimizedNF2SegmentLoadStore,
531 TuneOptimizedNF3SegmentLoadStore,
532 TuneOptimizedNF4SegmentLoadStore,
533 TuneVXRMPipelineFlush]> {
534 let MVendorID = 0x710;
535 let MArchID = 0x8000000058000001;
536 let MImpID = 0x1000000049772200;
539 def RP2350_HAZARD3 : RISCVProcessorModel<"rp2350-hazard3",
547 FeatureStdExtZifencei,