106c3fb27SDimitry Andric//===-- RISCVFeatures.td - RISC-V Features and Extensions --*- tablegen -*-===// 2bdd1243dSDimitry Andric// 3bdd1243dSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4bdd1243dSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5bdd1243dSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6bdd1243dSDimitry Andric// 7bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 8bdd1243dSDimitry Andric 9bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 10bdd1243dSDimitry Andric// RISC-V subtarget features and instruction predicates. 11bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 12bdd1243dSDimitry Andric 13*0fca6ea1SDimitry Andric// Subclass of SubtargetFeature to be used when the feature is also a RISC-V 14*0fca6ea1SDimitry Andric// extension. Extensions have a version and may be experimental. 15*0fca6ea1SDimitry Andric// 16*0fca6ea1SDimitry Andric// name - Name of the extension in lower case. 17*0fca6ea1SDimitry Andric// major - Major version of extension. 18*0fca6ea1SDimitry Andric// minor - Minor version of extension. 19*0fca6ea1SDimitry Andric// desc - Description of extension. 20*0fca6ea1SDimitry Andric// implies - Extensions or features implied by this extension. 21*0fca6ea1SDimitry Andric// fieldname - name of field to create in RISCVSubtarget. By default replaces 22*0fca6ea1SDimitry Andric// uses the record name by replacing Feature with Has. 23*0fca6ea1SDimitry Andric// value - Value to assign to the field in RISCVSubtarget when this 24*0fca6ea1SDimitry Andric// extension is enabled. Usually "true", but can be changed. 25*0fca6ea1SDimitry Andricclass RISCVExtension<string name, int major, int minor, string desc, 26*0fca6ea1SDimitry Andric list<SubtargetFeature> implies = [], 27*0fca6ea1SDimitry Andric string fieldname = !subst("Feature", "Has", NAME), 28*0fca6ea1SDimitry Andric string value = "true"> 29*0fca6ea1SDimitry Andric : SubtargetFeature<name, fieldname, value, desc, implies> { 30*0fca6ea1SDimitry Andric // MajorVersion - The major version for this extension. 31*0fca6ea1SDimitry Andric int MajorVersion = major; 32*0fca6ea1SDimitry Andric 33*0fca6ea1SDimitry Andric // MinorVersion - The minor version for this extension. 34*0fca6ea1SDimitry Andric int MinorVersion = minor; 35*0fca6ea1SDimitry Andric 36*0fca6ea1SDimitry Andric // Experimental - Does extension require -menable-experimental-extensions. 37*0fca6ea1SDimitry Andric bit Experimental = false; 38*0fca6ea1SDimitry Andric} 39*0fca6ea1SDimitry Andric 40*0fca6ea1SDimitry Andric// The groupID/bitmask of RISCVExtension is used to retrieve a specific bit value 41*0fca6ea1SDimitry Andric// from __riscv_feature_bits based on the groupID and bitmask. 42*0fca6ea1SDimitry Andric// groupID - groupID of extension 43*0fca6ea1SDimitry Andric// bitPos - bit position of extension bitmask 44*0fca6ea1SDimitry Andricclass RISCVExtensionBitmask<bits<3> groupID, int bitPos> { 45*0fca6ea1SDimitry Andric int GroupID = groupID; 46*0fca6ea1SDimitry Andric int BitPos = bitPos; 47*0fca6ea1SDimitry Andric} 48*0fca6ea1SDimitry Andric 49*0fca6ea1SDimitry Andric// Version of RISCVExtension to be used for Experimental extensions. This 50*0fca6ea1SDimitry Andric// sets the Experimental flag and prepends experimental- to the -mattr name. 51*0fca6ea1SDimitry Andricclass RISCVExperimentalExtension<string name, int major, int minor, string desc, 52*0fca6ea1SDimitry Andric list<RISCVExtension> implies = [], 53*0fca6ea1SDimitry Andric string fieldname = !subst("Feature", "Has", NAME), 54*0fca6ea1SDimitry Andric string value = "true"> 55*0fca6ea1SDimitry Andric : RISCVExtension<"experimental-"#name, major, minor, desc, implies, 56*0fca6ea1SDimitry Andric fieldname, value> { 57*0fca6ea1SDimitry Andric let Experimental = true; 58*0fca6ea1SDimitry Andric} 59*0fca6ea1SDimitry Andric 607a6dacacSDimitry Andric// Integer Extensions 617a6dacacSDimitry Andric 627a6dacacSDimitry Andricdef FeatureStdExtI 63*0fca6ea1SDimitry Andric : RISCVExtension<"i", 2, 1, 64*0fca6ea1SDimitry Andric "'I' (Base Integer Instruction Set)">, 65*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 8>; 66*0fca6ea1SDimitry Andric 67*0fca6ea1SDimitry Andricdef FeatureStdExtE 68*0fca6ea1SDimitry Andric : RISCVExtension<"e", 2, 0, 69*0fca6ea1SDimitry Andric "Implements RV{32,64}E (provides 16 rather than 32 GPRs)">; 70*0fca6ea1SDimitry Andric 717a6dacacSDimitry Andricdef FeatureStdExtZic64b 72*0fca6ea1SDimitry Andric : RISCVExtension<"zic64b", 1, 0, 737a6dacacSDimitry Andric "'Zic64b' (Cache Block Size Is 64 Bytes)">; 747a6dacacSDimitry Andric 757a6dacacSDimitry Andricdef FeatureStdExtZicbom 76*0fca6ea1SDimitry Andric : RISCVExtension<"zicbom", 1, 0, 777a6dacacSDimitry Andric "'Zicbom' (Cache-Block Management Instructions)">; 787a6dacacSDimitry Andricdef HasStdExtZicbom : Predicate<"Subtarget->hasStdExtZicbom()">, 797a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicbom), 807a6dacacSDimitry Andric "'Zicbom' (Cache-Block Management Instructions)">; 817a6dacacSDimitry Andric 827a6dacacSDimitry Andricdef FeatureStdExtZicbop 83*0fca6ea1SDimitry Andric : RISCVExtension<"zicbop", 1, 0, 847a6dacacSDimitry Andric "'Zicbop' (Cache-Block Prefetch Instructions)">; 857a6dacacSDimitry Andricdef HasStdExtZicbop : Predicate<"Subtarget->hasStdExtZicbop()">, 867a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicbop), 877a6dacacSDimitry Andric "'Zicbop' (Cache-Block Prefetch Instructions)">; 887a6dacacSDimitry Andric 897a6dacacSDimitry Andricdef FeatureStdExtZicboz 90*0fca6ea1SDimitry Andric : RISCVExtension<"zicboz", 1, 0, 91*0fca6ea1SDimitry Andric "'Zicboz' (Cache-Block Zero Instructions)">, 92*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 37>; 937a6dacacSDimitry Andricdef HasStdExtZicboz : Predicate<"Subtarget->hasStdExtZicboz()">, 947a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicboz), 957a6dacacSDimitry Andric "'Zicboz' (Cache-Block Zero Instructions)">; 967a6dacacSDimitry Andric 977a6dacacSDimitry Andricdef FeatureStdExtZiccamoa 98*0fca6ea1SDimitry Andric : RISCVExtension<"ziccamoa", 1, 0, 997a6dacacSDimitry Andric "'Ziccamoa' (Main Memory Supports All Atomics in A)">; 1007a6dacacSDimitry Andric 1017a6dacacSDimitry Andricdef FeatureStdExtZiccif 102*0fca6ea1SDimitry Andric : RISCVExtension<"ziccif", 1, 0, 1037a6dacacSDimitry Andric "'Ziccif' (Main Memory Supports Instruction Fetch with Atomicity Requirement)">; 1047a6dacacSDimitry Andric 1057a6dacacSDimitry Andricdef FeatureStdExtZicclsm 106*0fca6ea1SDimitry Andric : RISCVExtension<"zicclsm", 1, 0, 1077a6dacacSDimitry Andric "'Zicclsm' (Main Memory Supports Misaligned Loads/Stores)">; 1087a6dacacSDimitry Andric 1097a6dacacSDimitry Andricdef FeatureStdExtZiccrse 110*0fca6ea1SDimitry Andric : RISCVExtension<"ziccrse", 1, 0, 1117a6dacacSDimitry Andric "'Ziccrse' (Main Memory Supports Forward Progress on LR/SC Sequences)">; 1127a6dacacSDimitry Andric 11306c3fb27SDimitry Andricdef FeatureStdExtZicsr 114*0fca6ea1SDimitry Andric : RISCVExtension<"zicsr", 2, 0, 11506c3fb27SDimitry Andric "'zicsr' (CSRs)">; 11606c3fb27SDimitry Andricdef HasStdExtZicsr : Predicate<"Subtarget->hasStdExtZicsr()">, 11706c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicsr), 11806c3fb27SDimitry Andric "'Zicsr' (CSRs)">; 11906c3fb27SDimitry Andric 1207a6dacacSDimitry Andricdef FeatureStdExtZicntr 121*0fca6ea1SDimitry Andric : RISCVExtension<"zicntr", 2, 0, 1227a6dacacSDimitry Andric "'Zicntr' (Base Counters and Timers)", 1237a6dacacSDimitry Andric [FeatureStdExtZicsr]>; 1247a6dacacSDimitry Andric 1257a6dacacSDimitry Andricdef FeatureStdExtZicond 126*0fca6ea1SDimitry Andric : RISCVExtension<"zicond", 1, 0, 127*0fca6ea1SDimitry Andric "'Zicond' (Integer Conditional Operations)">, 128*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 38>; 1297a6dacacSDimitry Andricdef HasStdExtZicond : Predicate<"Subtarget->hasStdExtZicond()">, 1307a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicond), 1317a6dacacSDimitry Andric "'Zicond' (Integer Conditional Operations)">; 1327a6dacacSDimitry Andric 1337a6dacacSDimitry Andricdef FeatureStdExtZifencei 134*0fca6ea1SDimitry Andric : RISCVExtension<"zifencei", 2, 0, 1357a6dacacSDimitry Andric "'Zifencei' (fence.i)">; 1367a6dacacSDimitry Andricdef HasStdExtZifencei : Predicate<"Subtarget->hasStdExtZifencei()">, 1377a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZifencei), 1387a6dacacSDimitry Andric "'Zifencei' (fence.i)">; 1397a6dacacSDimitry Andric 1407a6dacacSDimitry Andricdef FeatureStdExtZihintpause 141*0fca6ea1SDimitry Andric : RISCVExtension<"zihintpause", 2, 0, 142*0fca6ea1SDimitry Andric "'Zihintpause' (Pause Hint)">, 143*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 40>; 1447a6dacacSDimitry Andricdef HasStdExtZihintpause : Predicate<"Subtarget->hasStdExtZihintpause()">, 1457a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZihintpause), 1467a6dacacSDimitry Andric "'Zihintpause' (Pause Hint)">; 1477a6dacacSDimitry Andric 1487a6dacacSDimitry Andricdef FeatureStdExtZihintntl 149*0fca6ea1SDimitry Andric : RISCVExtension<"zihintntl", 1, 0, 150*0fca6ea1SDimitry Andric "'Zihintntl' (Non-Temporal Locality Hints)">, 151*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 39>; 1527a6dacacSDimitry Andricdef HasStdExtZihintntl : Predicate<"Subtarget->hasStdExtZihintntl()">, 1537a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZihintntl), 1547a6dacacSDimitry Andric "'Zihintntl' (Non-Temporal Locality Hints)">; 1557a6dacacSDimitry Andric 1567a6dacacSDimitry Andricdef FeatureStdExtZihpm 157*0fca6ea1SDimitry Andric : RISCVExtension<"zihpm", 2, 0, 1587a6dacacSDimitry Andric "'Zihpm' (Hardware Performance Counters)", 1597a6dacacSDimitry Andric [FeatureStdExtZicsr]>; 1607a6dacacSDimitry Andric 161*0fca6ea1SDimitry Andricdef FeatureStdExtZimop : RISCVExtension<"zimop", 1, 0, 1627a6dacacSDimitry Andric "'Zimop' (May-Be-Operations)">; 1637a6dacacSDimitry Andricdef HasStdExtZimop : Predicate<"Subtarget->hasStdExtZimop()">, 1647a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZimop), 1657a6dacacSDimitry Andric "'Zimop' (May-Be-Operations)">; 1667a6dacacSDimitry Andric 1677a6dacacSDimitry Andricdef FeatureStdExtZicfilp 168*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"zicfilp", 1, 0, 169*0fca6ea1SDimitry Andric "'Zicfilp' (Landing pad)", 170*0fca6ea1SDimitry Andric [FeatureStdExtZicsr]>; 1717a6dacacSDimitry Andricdef HasStdExtZicfilp : Predicate<"Subtarget->hasStdExtZicfilp()">, 1727a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicfilp), 1737a6dacacSDimitry Andric "'Zicfilp' (Landing pad)">; 174*0fca6ea1SDimitry Andricdef NoStdExtZicfilp : Predicate<"!Subtarget->hasStdExtZicfilp()">, 175*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of (not FeatureStdExtZicfilp))>; 1767a6dacacSDimitry Andric 1777a6dacacSDimitry Andricdef FeatureStdExtZicfiss 178*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"zicfiss", 1, 0, 1797a6dacacSDimitry Andric "'Zicfiss' (Shadow stack)", 1807a6dacacSDimitry Andric [FeatureStdExtZicsr, FeatureStdExtZimop]>; 1817a6dacacSDimitry Andricdef HasStdExtZicfiss : Predicate<"Subtarget->hasStdExtZicfiss()">, 1827a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicfiss), 1837a6dacacSDimitry Andric "'Zicfiss' (Shadow stack)">; 1847a6dacacSDimitry Andricdef NoHasStdExtZicfiss : Predicate<"!Subtarget->hasStdExtZicfiss()">; 1857a6dacacSDimitry Andric 1867a6dacacSDimitry Andric// Multiply Extensions 1877a6dacacSDimitry Andric 188*0fca6ea1SDimitry Andricdef FeatureStdExtZmmul 189*0fca6ea1SDimitry Andric : RISCVExtension<"zmmul", 1, 0, 190*0fca6ea1SDimitry Andric "'Zmmul' (Integer Multiplication)">; 191*0fca6ea1SDimitry Andricdef HasStdExtZmmul : Predicate<"Subtarget->hasStdExtZmmul()">, 192*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZmmul), 193*0fca6ea1SDimitry Andric "'Zmmul' (Integer Multiplication)">; 194*0fca6ea1SDimitry Andric 195bdd1243dSDimitry Andricdef FeatureStdExtM 196*0fca6ea1SDimitry Andric : RISCVExtension<"m", 2, 0, 197*0fca6ea1SDimitry Andric "'M' (Integer Multiplication and Division)", 198*0fca6ea1SDimitry Andric [FeatureStdExtZmmul]>, 199*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 12>; 200bdd1243dSDimitry Andricdef HasStdExtM : Predicate<"Subtarget->hasStdExtM()">, 201bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtM), 202bdd1243dSDimitry Andric "'M' (Integer Multiplication and Division)">; 203bdd1243dSDimitry Andric 2047a6dacacSDimitry Andric// Atomic Extensions 2057a6dacacSDimitry Andric 206bdd1243dSDimitry Andricdef FeatureStdExtA 207*0fca6ea1SDimitry Andric : RISCVExtension<"a", 2, 1, 208*0fca6ea1SDimitry Andric "'A' (Atomic Instructions)">, 209*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 0>; 210bdd1243dSDimitry Andricdef HasStdExtA : Predicate<"Subtarget->hasStdExtA()">, 211bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtA), 212bdd1243dSDimitry Andric "'A' (Atomic Instructions)">; 213bdd1243dSDimitry Andric 2147a6dacacSDimitry Andricdef FeatureStdExtZtso 215*0fca6ea1SDimitry Andric : RISCVExtension<"ztso", 1, 0, 216*0fca6ea1SDimitry Andric "'Ztso' (Memory Model - Total Store Order)">, 217*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 47>; 2187a6dacacSDimitry Andricdef HasStdExtZtso : Predicate<"Subtarget->hasStdExtZtso()">, 2197a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZtso), 2207a6dacacSDimitry Andric "'Ztso' (Memory Model - Total Store Order)">; 2217a6dacacSDimitry Andricdef NotHasStdExtZtso : Predicate<"!Subtarget->hasStdExtZtso()">; 2227a6dacacSDimitry Andric 223*0fca6ea1SDimitry Andricdef FeatureStdExtZa64rs : RISCVExtension<"za64rs", 1, 0, 2247a6dacacSDimitry Andric "'Za64rs' (Reservation Set Size of at Most 64 Bytes)">; 2257a6dacacSDimitry Andric 226*0fca6ea1SDimitry Andricdef FeatureStdExtZa128rs : RISCVExtension<"za128rs", 1, 0, 2277a6dacacSDimitry Andric "'Za128rs' (Reservation Set Size of at Most 128 Bytes)">; 2287a6dacacSDimitry Andric 229*0fca6ea1SDimitry Andricdef FeatureStdExtZaamo 230*0fca6ea1SDimitry Andric : RISCVExtension<"zaamo", 1, 0, 231*0fca6ea1SDimitry Andric "'Zaamo' (Atomic Memory Operations)">; 232*0fca6ea1SDimitry Andricdef HasStdExtAOrZaamo 233*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasStdExtA() || Subtarget->hasStdExtZaamo()">, 234*0fca6ea1SDimitry Andric AssemblerPredicate<(any_of FeatureStdExtA, FeatureStdExtZaamo), 235*0fca6ea1SDimitry Andric "'A' (Atomic Instructions) or " 236*0fca6ea1SDimitry Andric "'Zaamo' (Atomic Memory Operations)">; 237*0fca6ea1SDimitry Andric 238*0fca6ea1SDimitry Andricdef FeatureStdExtZabha 239*0fca6ea1SDimitry Andric : RISCVExtension<"zabha", 1, 0, 240*0fca6ea1SDimitry Andric "'Zabha' (Byte and Halfword Atomic Memory Operations)">; 241*0fca6ea1SDimitry Andricdef HasStdExtZabha : Predicate<"Subtarget->hasStdExtZabha()">, 242*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZabha), 243*0fca6ea1SDimitry Andric "'Zabha' (Byte and Halfword Atomic Memory Operations)">; 244*0fca6ea1SDimitry Andric 2457a6dacacSDimitry Andricdef FeatureStdExtZacas 246*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"zacas", 1, 0, 247*0fca6ea1SDimitry Andric "'Zacas' (Atomic Compare-And-Swap Instructions)">, 248*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 26>; 2497a6dacacSDimitry Andricdef HasStdExtZacas : Predicate<"Subtarget->hasStdExtZacas()">, 2507a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZacas), 2517a6dacacSDimitry Andric "'Zacas' (Atomic Compare-And-Swap Instructions)">; 2527a6dacacSDimitry Andricdef NoStdExtZacas : Predicate<"!Subtarget->hasStdExtZacas()">; 2537a6dacacSDimitry Andric 254*0fca6ea1SDimitry Andricdef FeatureStdExtZalasr 255*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"zalasr", 0, 1, 256*0fca6ea1SDimitry Andric "'Zalasr' (Load-Acquire and Store-Release Instructions)">; 257*0fca6ea1SDimitry Andricdef HasStdExtZalasr : Predicate<"Subtarget->hasStdExtZalasr()">, 258*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZalasr), 259*0fca6ea1SDimitry Andric "'Zalasr' (Load-Acquire and Store-Release Instructions)">; 260*0fca6ea1SDimitry Andric 261*0fca6ea1SDimitry Andricdef FeatureStdExtZalrsc 262*0fca6ea1SDimitry Andric : RISCVExtension<"zalrsc", 1, 0, 263*0fca6ea1SDimitry Andric "'Zalrsc' (Load-Reserved/Store-Conditional)">; 264*0fca6ea1SDimitry Andricdef HasStdExtAOrZalrsc 265*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasStdExtA() || Subtarget->hasStdExtZalrsc()">, 266*0fca6ea1SDimitry Andric AssemblerPredicate<(any_of FeatureStdExtA, FeatureStdExtZalrsc), 267*0fca6ea1SDimitry Andric "'A' (Atomic Instructions) or " 268*0fca6ea1SDimitry Andric "'Zalrsc' (Load-Reserved/Store-Conditional)">; 269*0fca6ea1SDimitry Andric 270*0fca6ea1SDimitry Andricdef FeatureStdExtZama16b 271*0fca6ea1SDimitry Andric : RISCVExtension<"zama16b", 1, 0, 272*0fca6ea1SDimitry Andric "'Zama16b' (Atomic 16-byte misaligned loads, stores and AMOs)">; 273*0fca6ea1SDimitry Andric 274*0fca6ea1SDimitry Andricdef FeatureStdExtZawrs : RISCVExtension<"zawrs", 1, 0, 2757a6dacacSDimitry Andric "'Zawrs' (Wait on Reservation Set)">; 2767a6dacacSDimitry Andricdef HasStdExtZawrs : Predicate<"Subtarget->hasStdExtZawrs()">, 2777a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZawrs), 2787a6dacacSDimitry Andric "'Zawrs' (Wait on Reservation Set)">; 2797a6dacacSDimitry Andric 2807a6dacacSDimitry Andric// Floating Point Extensions 2817a6dacacSDimitry Andric 282bdd1243dSDimitry Andricdef FeatureStdExtF 283*0fca6ea1SDimitry Andric : RISCVExtension<"f", 2, 2, 28406c3fb27SDimitry Andric "'F' (Single-Precision Floating-Point)", 285*0fca6ea1SDimitry Andric [FeatureStdExtZicsr]>, 286*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 5>; 287bdd1243dSDimitry Andricdef HasStdExtF : Predicate<"Subtarget->hasStdExtF()">, 288bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtF), 289bdd1243dSDimitry Andric "'F' (Single-Precision Floating-Point)">; 290bdd1243dSDimitry Andric 291bdd1243dSDimitry Andricdef FeatureStdExtD 292*0fca6ea1SDimitry Andric : RISCVExtension<"d", 2, 2, 293bdd1243dSDimitry Andric "'D' (Double-Precision Floating-Point)", 294*0fca6ea1SDimitry Andric [FeatureStdExtF]>, 295*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 3>; 296bdd1243dSDimitry Andricdef HasStdExtD : Predicate<"Subtarget->hasStdExtD()">, 297bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtD), 298bdd1243dSDimitry Andric "'D' (Double-Precision Floating-Point)">; 299bdd1243dSDimitry Andric 300bdd1243dSDimitry Andricdef FeatureStdExtZfhmin 301*0fca6ea1SDimitry Andric : RISCVExtension<"zfhmin", 1, 0, 302bdd1243dSDimitry Andric "'Zfhmin' (Half-Precision Floating-Point Minimal)", 303*0fca6ea1SDimitry Andric [FeatureStdExtF]>, 304*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 36>; 305bdd1243dSDimitry Andricdef HasStdExtZfhmin : Predicate<"Subtarget->hasStdExtZfhmin()">, 306bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfhmin), 3077a6dacacSDimitry Andric "'Zfh' (Half-Precision Floating-Point) or " 308bdd1243dSDimitry Andric "'Zfhmin' (Half-Precision Floating-Point Minimal)">; 309bdd1243dSDimitry Andric 310bdd1243dSDimitry Andricdef FeatureStdExtZfh 311*0fca6ea1SDimitry Andric : RISCVExtension<"zfh", 1, 0, 312bdd1243dSDimitry Andric "'Zfh' (Half-Precision Floating-Point)", 313*0fca6ea1SDimitry Andric [FeatureStdExtZfhmin]>, 314*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 35>; 315bdd1243dSDimitry Andricdef HasStdExtZfh : Predicate<"Subtarget->hasStdExtZfh()">, 316bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfh), 317bdd1243dSDimitry Andric "'Zfh' (Half-Precision Floating-Point)">; 318bdd1243dSDimitry Andricdef NoStdExtZfh : Predicate<"!Subtarget->hasStdExtZfh()">; 319bdd1243dSDimitry Andric 3207a6dacacSDimitry Andricdef FeatureStdExtZfbfmin 321*0fca6ea1SDimitry Andric : RISCVExtension<"zfbfmin", 1, 0, "'Zfbfmin' (Scalar BF16 Converts)", 3227a6dacacSDimitry Andric [FeatureStdExtF]>; 3237a6dacacSDimitry Andricdef HasStdExtZfbfmin : Predicate<"Subtarget->hasStdExtZfbfmin()">, 3247a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfbfmin), 3257a6dacacSDimitry Andric "'Zfbfmin' (Scalar BF16 Converts)">; 3267a6dacacSDimitry Andric 3277a6dacacSDimitry Andricdef HasHalfFPLoadStoreMove 3287a6dacacSDimitry Andric : Predicate<"Subtarget->hasHalfFPLoadStoreMove()">, 3297a6dacacSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZfh, FeatureStdExtZfhmin, 3307a6dacacSDimitry Andric FeatureStdExtZfbfmin), 331bdd1243dSDimitry Andric "'Zfh' (Half-Precision Floating-Point) or " 3327a6dacacSDimitry Andric "'Zfhmin' (Half-Precision Floating-Point Minimal) or " 3337a6dacacSDimitry Andric "'Zfbfmin' (Scalar BF16 Converts)">; 3347a6dacacSDimitry Andric 3357a6dacacSDimitry Andricdef FeatureStdExtZfa 336*0fca6ea1SDimitry Andric : RISCVExtension<"zfa", 1, 0, 3377a6dacacSDimitry Andric "'Zfa' (Additional Floating-Point)", 338*0fca6ea1SDimitry Andric [FeatureStdExtF]>, 339*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 34>; 3407a6dacacSDimitry Andricdef HasStdExtZfa : Predicate<"Subtarget->hasStdExtZfa()">, 3417a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfa), 3427a6dacacSDimitry Andric "'Zfa' (Additional Floating-Point)">; 343bdd1243dSDimitry Andric 344bdd1243dSDimitry Andricdef FeatureStdExtZfinx 345*0fca6ea1SDimitry Andric : RISCVExtension<"zfinx", 1, 0, 34606c3fb27SDimitry Andric "'Zfinx' (Float in Integer)", 34706c3fb27SDimitry Andric [FeatureStdExtZicsr]>; 348bdd1243dSDimitry Andricdef HasStdExtZfinx : Predicate<"Subtarget->hasStdExtZfinx()">, 349bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfinx), 350bdd1243dSDimitry Andric "'Zfinx' (Float in Integer)">; 351bdd1243dSDimitry Andric 352bdd1243dSDimitry Andricdef FeatureStdExtZdinx 353*0fca6ea1SDimitry Andric : RISCVExtension<"zdinx", 1, 0, 354bdd1243dSDimitry Andric "'Zdinx' (Double in Integer)", 355bdd1243dSDimitry Andric [FeatureStdExtZfinx]>; 356bdd1243dSDimitry Andricdef HasStdExtZdinx : Predicate<"Subtarget->hasStdExtZdinx()">, 357bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZdinx), 358bdd1243dSDimitry Andric "'Zdinx' (Double in Integer)">; 359bdd1243dSDimitry Andric 360bdd1243dSDimitry Andricdef FeatureStdExtZhinxmin 361*0fca6ea1SDimitry Andric : RISCVExtension<"zhinxmin", 1, 0, 362bdd1243dSDimitry Andric "'Zhinxmin' (Half Float in Integer Minimal)", 363bdd1243dSDimitry Andric [FeatureStdExtZfinx]>; 364bdd1243dSDimitry Andricdef HasStdExtZhinxmin : Predicate<"Subtarget->hasStdExtZhinxmin()">, 365bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZhinxmin), 3667a6dacacSDimitry Andric "'Zhinx' (Half Float in Integer) or " 367bdd1243dSDimitry Andric "'Zhinxmin' (Half Float in Integer Minimal)">; 368bdd1243dSDimitry Andric 369bdd1243dSDimitry Andricdef FeatureStdExtZhinx 370*0fca6ea1SDimitry Andric : RISCVExtension<"zhinx", 1, 0, 371bdd1243dSDimitry Andric "'Zhinx' (Half Float in Integer)", 372cb14a3feSDimitry Andric [FeatureStdExtZhinxmin]>; 373bdd1243dSDimitry Andricdef HasStdExtZhinx : Predicate<"Subtarget->hasStdExtZhinx()">, 374bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZhinx), 375bdd1243dSDimitry Andric "'Zhinx' (Half Float in Integer)">; 37606c3fb27SDimitry Andricdef NoStdExtZhinx : Predicate<"!Subtarget->hasStdExtZhinx()">; 377bdd1243dSDimitry Andric 3787a6dacacSDimitry Andric// Compressed Extensions 37906c3fb27SDimitry Andric 380bdd1243dSDimitry Andricdef FeatureStdExtC 381*0fca6ea1SDimitry Andric : RISCVExtension<"c", 2, 0, 382*0fca6ea1SDimitry Andric "'C' (Compressed Instructions)">, 383*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 2>; 384bdd1243dSDimitry Andricdef HasStdExtC : Predicate<"Subtarget->hasStdExtC()">, 385bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtC), 386bdd1243dSDimitry Andric "'C' (Compressed Instructions)">; 387bdd1243dSDimitry Andric 3887a6dacacSDimitry Andricdef FeatureNoRVCHints 3897a6dacacSDimitry Andric : SubtargetFeature<"no-rvc-hints", "EnableRVCHintInstrs", "false", 3907a6dacacSDimitry Andric "Disable RVC Hint Instructions.">; 3917a6dacacSDimitry Andricdef HasRVCHints : Predicate<"Subtarget->enableRVCHintInstrs()">, 3927a6dacacSDimitry Andric AssemblerPredicate<(all_of(not FeatureNoRVCHints)), 3937a6dacacSDimitry Andric "RVC Hint Instructions">; 394bdd1243dSDimitry Andric 39506c3fb27SDimitry Andricdef FeatureStdExtZca 396*0fca6ea1SDimitry Andric : RISCVExtension<"zca", 1, 0, 397bdd1243dSDimitry Andric "'Zca' (part of the C extension, excluding compressed " 398bdd1243dSDimitry Andric "floating point loads/stores)">; 399bdd1243dSDimitry Andric 400bdd1243dSDimitry Andricdef HasStdExtCOrZca 40106c3fb27SDimitry Andric : Predicate<"Subtarget->hasStdExtCOrZca()">, 40206c3fb27SDimitry Andric AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZca), 403bdd1243dSDimitry Andric "'C' (Compressed Instructions) or " 404bdd1243dSDimitry Andric "'Zca' (part of the C extension, excluding " 405bdd1243dSDimitry Andric "compressed floating point loads/stores)">; 406bdd1243dSDimitry Andric 40706c3fb27SDimitry Andricdef FeatureStdExtZcb 408*0fca6ea1SDimitry Andric : RISCVExtension<"zcb", 1, 0, 40906c3fb27SDimitry Andric "'Zcb' (Compressed basic bit manipulation instructions)", 41006c3fb27SDimitry Andric [FeatureStdExtZca]>; 41106c3fb27SDimitry Andricdef HasStdExtZcb : Predicate<"Subtarget->hasStdExtZcb()">, 41206c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZcb), 41306c3fb27SDimitry Andric "'Zcb' (Compressed basic bit manipulation instructions)">; 41406c3fb27SDimitry Andric 41506c3fb27SDimitry Andricdef FeatureStdExtZcd 416*0fca6ea1SDimitry Andric : RISCVExtension<"zcd", 1, 0, 41706c3fb27SDimitry Andric "'Zcd' (Compressed Double-Precision Floating-Point Instructions)", 418*0fca6ea1SDimitry Andric [FeatureStdExtD, FeatureStdExtZca]>; 419bdd1243dSDimitry Andric 420bdd1243dSDimitry Andricdef HasStdExtCOrZcd 421*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasStdExtCOrZcd()">, 42206c3fb27SDimitry Andric AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZcd), 423bdd1243dSDimitry Andric "'C' (Compressed Instructions) or " 424bdd1243dSDimitry Andric "'Zcd' (Compressed Double-Precision Floating-Point Instructions)">; 425bdd1243dSDimitry Andric 42606c3fb27SDimitry Andricdef FeatureStdExtZcf 427*0fca6ea1SDimitry Andric : RISCVExtension<"zcf", 1, 0, 42806c3fb27SDimitry Andric "'Zcf' (Compressed Single-Precision Floating-Point Instructions)", 429*0fca6ea1SDimitry Andric [FeatureStdExtF, FeatureStdExtZca]>; 430bdd1243dSDimitry Andric 43106c3fb27SDimitry Andricdef FeatureStdExtZcmp 432*0fca6ea1SDimitry Andric : RISCVExtension<"zcmp", 1, 0, 433*0fca6ea1SDimitry Andric "'Zcmp' (sequenced instructions for code-size reduction)", 43406c3fb27SDimitry Andric [FeatureStdExtZca]>; 43506c3fb27SDimitry Andricdef HasStdExtZcmp : Predicate<"Subtarget->hasStdExtZcmp() && !Subtarget->hasStdExtC()">, 43606c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZcmp), 437*0fca6ea1SDimitry Andric "'Zcmp' (sequenced instructions for code-size reduction)">; 43806c3fb27SDimitry Andric 43906c3fb27SDimitry Andricdef FeatureStdExtZcmt 440*0fca6ea1SDimitry Andric : RISCVExtension<"zcmt", 1, 0, 441*0fca6ea1SDimitry Andric "'Zcmt' (table jump instructions for code-size reduction)", 44206c3fb27SDimitry Andric [FeatureStdExtZca, FeatureStdExtZicsr]>; 44306c3fb27SDimitry Andricdef HasStdExtZcmt : Predicate<"Subtarget->hasStdExtZcmt()">, 44406c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZcmt), 445*0fca6ea1SDimitry Andric "'Zcmt' (table jump instructions for code-size reduction)">; 44606c3fb27SDimitry Andric 44706c3fb27SDimitry Andricdef FeatureStdExtZce 448*0fca6ea1SDimitry Andric : RISCVExtension<"zce", 1, 0, 44906c3fb27SDimitry Andric "'Zce' (Compressed extensions for microcontrollers)", 450*0fca6ea1SDimitry Andric [FeatureStdExtZcb, FeatureStdExtZcmp, FeatureStdExtZcmt]>; 45106c3fb27SDimitry Andric 45206c3fb27SDimitry Andricdef HasStdExtCOrZcfOrZce 45306c3fb27SDimitry Andric : Predicate<"Subtarget->hasStdExtC() || Subtarget->hasStdExtZcf() " 45406c3fb27SDimitry Andric "Subtarget->hasStdExtZce()">, 45506c3fb27SDimitry Andric AssemblerPredicate<(any_of FeatureStdExtC, FeatureStdExtZcf, 45606c3fb27SDimitry Andric FeatureStdExtZce), 457bdd1243dSDimitry Andric "'C' (Compressed Instructions) or " 458bdd1243dSDimitry Andric "'Zcf' (Compressed Single-Precision Floating-Point Instructions)">; 459bdd1243dSDimitry Andric 460*0fca6ea1SDimitry Andricdef FeatureStdExtZcmop 461*0fca6ea1SDimitry Andric : RISCVExtension<"zcmop", 1, 0, 4627a6dacacSDimitry Andric "'Zcmop' (Compressed May-Be-Operations)", 4637a6dacacSDimitry Andric [FeatureStdExtZca]>; 4647a6dacacSDimitry Andricdef HasStdExtZcmop : Predicate<"Subtarget->hasStdExtZcmop()">, 4657a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZcmop), 4667a6dacacSDimitry Andric "'Zcmop' (Compressed May-Be-Operations)">; 4677a6dacacSDimitry Andric 4687a6dacacSDimitry Andric// Bitmanip Extensions 4697a6dacacSDimitry Andric 4707a6dacacSDimitry Andricdef FeatureStdExtZba 471*0fca6ea1SDimitry Andric : RISCVExtension<"zba", 1, 0, 472*0fca6ea1SDimitry Andric "'Zba' (Address Generation Instructions)">, 473*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 27>; 4747a6dacacSDimitry Andricdef HasStdExtZba : Predicate<"Subtarget->hasStdExtZba()">, 4757a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZba), 4767a6dacacSDimitry Andric "'Zba' (Address Generation Instructions)">; 4777a6dacacSDimitry Andricdef NotHasStdExtZba : Predicate<"!Subtarget->hasStdExtZba()">; 4787a6dacacSDimitry Andric 4797a6dacacSDimitry Andricdef FeatureStdExtZbb 480*0fca6ea1SDimitry Andric : RISCVExtension<"zbb", 1, 0, 481*0fca6ea1SDimitry Andric "'Zbb' (Basic Bit-Manipulation)">, 482*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 28>; 4837a6dacacSDimitry Andricdef HasStdExtZbb : Predicate<"Subtarget->hasStdExtZbb()">, 4847a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbb), 4857a6dacacSDimitry Andric "'Zbb' (Basic Bit-Manipulation)">; 486*0fca6ea1SDimitry Andricdef NoStdExtZbb : Predicate<"!Subtarget->hasStdExtZbb()">, 487*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of (not FeatureStdExtZbb))>; 4887a6dacacSDimitry Andric 4897a6dacacSDimitry Andricdef FeatureStdExtZbc 490*0fca6ea1SDimitry Andric : RISCVExtension<"zbc", 1, 0, 491*0fca6ea1SDimitry Andric "'Zbc' (Carry-Less Multiplication)">, 492*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 29>; 4937a6dacacSDimitry Andricdef HasStdExtZbc : Predicate<"Subtarget->hasStdExtZbc()">, 4947a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbc), 4957a6dacacSDimitry Andric "'Zbc' (Carry-Less Multiplication)">; 4967a6dacacSDimitry Andric 4977a6dacacSDimitry Andricdef FeatureStdExtZbs 498*0fca6ea1SDimitry Andric : RISCVExtension<"zbs", 1, 0, 499*0fca6ea1SDimitry Andric "'Zbs' (Single-Bit Instructions)">, 500*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 33>; 5017a6dacacSDimitry Andricdef HasStdExtZbs : Predicate<"Subtarget->hasStdExtZbs()">, 5027a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbs), 5037a6dacacSDimitry Andric "'Zbs' (Single-Bit Instructions)">; 5047a6dacacSDimitry Andric 5057a6dacacSDimitry Andric// Bitmanip Extensions for Cryptography Extensions 5067a6dacacSDimitry Andric 507*0fca6ea1SDimitry Andricdef FeatureStdExtB 508*0fca6ea1SDimitry Andric : RISCVExtension<"b", 1, 0, 509*0fca6ea1SDimitry Andric "'B' (the collection of the Zba, Zbb, Zbs extensions)", 510*0fca6ea1SDimitry Andric [FeatureStdExtZba, FeatureStdExtZbb, FeatureStdExtZbs]>; 511*0fca6ea1SDimitry Andricdef HasStdExtB : Predicate<"Subtarget->hasStdExtB()">, 512*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtB), 513*0fca6ea1SDimitry Andric "'B' (the collection of the Zba, Zbb, Zbs extensions)">; 514*0fca6ea1SDimitry Andric 5157a6dacacSDimitry Andricdef FeatureStdExtZbkb 516*0fca6ea1SDimitry Andric : RISCVExtension<"zbkb", 1, 0, 517*0fca6ea1SDimitry Andric "'Zbkb' (Bitmanip instructions for Cryptography)">, 518*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 30>; 5197a6dacacSDimitry Andricdef HasStdExtZbkb : Predicate<"Subtarget->hasStdExtZbkb()">, 5207a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbkb), 5217a6dacacSDimitry Andric "'Zbkb' (Bitmanip instructions for Cryptography)">; 5227a6dacacSDimitry Andric 5237a6dacacSDimitry Andricdef FeatureStdExtZbkx 524*0fca6ea1SDimitry Andric : RISCVExtension<"zbkx", 1, 0, 525*0fca6ea1SDimitry Andric "'Zbkx' (Crossbar permutation instructions)">, 526*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 32>; 5277a6dacacSDimitry Andricdef HasStdExtZbkx : Predicate<"Subtarget->hasStdExtZbkx()">, 5287a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbkx), 5297a6dacacSDimitry Andric "'Zbkx' (Crossbar permutation instructions)">; 5307a6dacacSDimitry Andric 5317a6dacacSDimitry Andricdef HasStdExtZbbOrZbkb 5327a6dacacSDimitry Andric : Predicate<"Subtarget->hasStdExtZbb() || Subtarget->hasStdExtZbkb()">, 5337a6dacacSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZbb, FeatureStdExtZbkb), 5347a6dacacSDimitry Andric "'Zbb' (Basic Bit-Manipulation) or " 5357a6dacacSDimitry Andric "'Zbkb' (Bitmanip instructions for Cryptography)">; 5367a6dacacSDimitry Andric 5377a6dacacSDimitry Andric// The Carry-less multiply subextension for cryptography is a subset of basic 5387a6dacacSDimitry Andric// carry-less multiply subextension. The former should be enabled if the latter 5397a6dacacSDimitry Andric// is enabled. 5407a6dacacSDimitry Andricdef FeatureStdExtZbkc 541*0fca6ea1SDimitry Andric : RISCVExtension<"zbkc", 1, 0, 5427a6dacacSDimitry Andric "'Zbkc' (Carry-less multiply instructions for " 543*0fca6ea1SDimitry Andric "Cryptography)">, 544*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 31>; 5457a6dacacSDimitry Andricdef HasStdExtZbkc 5467a6dacacSDimitry Andric : Predicate<"Subtarget->hasStdExtZbkc()">, 5477a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbkc), 5487a6dacacSDimitry Andric "'Zbkc' (Carry-less multiply instructions for Cryptography)">; 5497a6dacacSDimitry Andric 5507a6dacacSDimitry Andricdef HasStdExtZbcOrZbkc 5517a6dacacSDimitry Andric : Predicate<"Subtarget->hasStdExtZbc() || Subtarget->hasStdExtZbkc()">, 5527a6dacacSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZbc, FeatureStdExtZbkc), 5537a6dacacSDimitry Andric "'Zbc' (Carry-Less Multiplication) or " 5547a6dacacSDimitry Andric "'Zbkc' (Carry-less multiply instructions " 5557a6dacacSDimitry Andric "for Cryptography)">; 5567a6dacacSDimitry Andric 5577a6dacacSDimitry Andric// Cryptography Extensions 5587a6dacacSDimitry Andric 5597a6dacacSDimitry Andricdef FeatureStdExtZknd 560*0fca6ea1SDimitry Andric : RISCVExtension<"zknd", 1, 0, 561*0fca6ea1SDimitry Andric "'Zknd' (NIST Suite: AES Decryption)">, 562*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 41>; 5637a6dacacSDimitry Andricdef HasStdExtZknd : Predicate<"Subtarget->hasStdExtZknd()">, 5647a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZknd), 5657a6dacacSDimitry Andric "'Zknd' (NIST Suite: AES Decryption)">; 5667a6dacacSDimitry Andric 5677a6dacacSDimitry Andricdef FeatureStdExtZkne 568*0fca6ea1SDimitry Andric : RISCVExtension<"zkne", 1, 0, 569*0fca6ea1SDimitry Andric "'Zkne' (NIST Suite: AES Encryption)">, 570*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 42>; 5717a6dacacSDimitry Andricdef HasStdExtZkne : Predicate<"Subtarget->hasStdExtZkne()">, 5727a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZkne), 5737a6dacacSDimitry Andric "'Zkne' (NIST Suite: AES Encryption)">; 5747a6dacacSDimitry Andric 5757a6dacacSDimitry Andric// Some instructions belong to both Zknd and Zkne subextensions. 5767a6dacacSDimitry Andric// They should be enabled if either has been specified. 5777a6dacacSDimitry Andricdef HasStdExtZkndOrZkne 5787a6dacacSDimitry Andric : Predicate<"Subtarget->hasStdExtZknd() || Subtarget->hasStdExtZkne()">, 5797a6dacacSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZknd, FeatureStdExtZkne), 5807a6dacacSDimitry Andric "'Zknd' (NIST Suite: AES Decryption) or " 5817a6dacacSDimitry Andric "'Zkne' (NIST Suite: AES Encryption)">; 5827a6dacacSDimitry Andric 5837a6dacacSDimitry Andricdef FeatureStdExtZknh 584*0fca6ea1SDimitry Andric : RISCVExtension<"zknh", 1, 0, 585*0fca6ea1SDimitry Andric "'Zknh' (NIST Suite: Hash Function Instructions)">, 586*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 43>; 5877a6dacacSDimitry Andricdef HasStdExtZknh : Predicate<"Subtarget->hasStdExtZknh()">, 5887a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZknh), 5897a6dacacSDimitry Andric "'Zknh' (NIST Suite: Hash Function Instructions)">; 5907a6dacacSDimitry Andric 5917a6dacacSDimitry Andricdef FeatureStdExtZksed 592*0fca6ea1SDimitry Andric : RISCVExtension<"zksed", 1, 0, 593*0fca6ea1SDimitry Andric "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)">, 594*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 44>; 5957a6dacacSDimitry Andricdef HasStdExtZksed : Predicate<"Subtarget->hasStdExtZksed()">, 5967a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZksed), 5977a6dacacSDimitry Andric "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)">; 5987a6dacacSDimitry Andric 5997a6dacacSDimitry Andricdef FeatureStdExtZksh 600*0fca6ea1SDimitry Andric : RISCVExtension<"zksh", 1, 0, 601*0fca6ea1SDimitry Andric "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)">, 602*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 45>; 6037a6dacacSDimitry Andricdef HasStdExtZksh : Predicate<"Subtarget->hasStdExtZksh()">, 6047a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZksh), 6057a6dacacSDimitry Andric "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)">; 6067a6dacacSDimitry Andric 6077a6dacacSDimitry Andricdef FeatureStdExtZkr 608*0fca6ea1SDimitry Andric : RISCVExtension<"zkr", 1, 0, 6097a6dacacSDimitry Andric "'Zkr' (Entropy Source Extension)">; 6107a6dacacSDimitry Andricdef HasStdExtZkr : Predicate<"Subtarget->hasStdExtZkr()">, 6117a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZkr), 6127a6dacacSDimitry Andric "'Zkr' (Entropy Source Extension)">; 6137a6dacacSDimitry Andric 6147a6dacacSDimitry Andricdef FeatureStdExtZkn 615*0fca6ea1SDimitry Andric : RISCVExtension<"zkn", 1, 0, 6167a6dacacSDimitry Andric "'Zkn' (NIST Algorithm Suite)", 6177a6dacacSDimitry Andric [FeatureStdExtZbkb, 6187a6dacacSDimitry Andric FeatureStdExtZbkc, 6197a6dacacSDimitry Andric FeatureStdExtZbkx, 6207a6dacacSDimitry Andric FeatureStdExtZkne, 6217a6dacacSDimitry Andric FeatureStdExtZknd, 6227a6dacacSDimitry Andric FeatureStdExtZknh]>; 6237a6dacacSDimitry Andric 6247a6dacacSDimitry Andricdef FeatureStdExtZks 625*0fca6ea1SDimitry Andric : RISCVExtension<"zks", 1, 0, 6267a6dacacSDimitry Andric "'Zks' (ShangMi Algorithm Suite)", 6277a6dacacSDimitry Andric [FeatureStdExtZbkb, 6287a6dacacSDimitry Andric FeatureStdExtZbkc, 6297a6dacacSDimitry Andric FeatureStdExtZbkx, 6307a6dacacSDimitry Andric FeatureStdExtZksed, 6317a6dacacSDimitry Andric FeatureStdExtZksh]>; 6327a6dacacSDimitry Andric 6337a6dacacSDimitry Andricdef FeatureStdExtZkt 634*0fca6ea1SDimitry Andric : RISCVExtension<"zkt", 1, 0, 635*0fca6ea1SDimitry Andric "'Zkt' (Data Independent Execution Latency)">, 636*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 46>; 6377a6dacacSDimitry Andric 6387a6dacacSDimitry Andricdef FeatureStdExtZk 639*0fca6ea1SDimitry Andric : RISCVExtension<"zk", 1, 0, 6407a6dacacSDimitry Andric "'Zk' (Standard scalar cryptography extension)", 6417a6dacacSDimitry Andric [FeatureStdExtZkn, 6427a6dacacSDimitry Andric FeatureStdExtZkr, 6437a6dacacSDimitry Andric FeatureStdExtZkt]>; 6447a6dacacSDimitry Andric 6457a6dacacSDimitry Andric// Vector Extensions 646bdd1243dSDimitry Andric 647*0fca6ea1SDimitry Andricdef FeatureStdExtZvl32b : RISCVExtension<"zvl32b", 1, 0, 648*0fca6ea1SDimitry Andric "'Zvl' (Minimum Vector Length) 32", [], 649*0fca6ea1SDimitry Andric "ZvlLen", "32">; 650bdd1243dSDimitry Andric 651bdd1243dSDimitry Andricforeach i = { 6-16 } in { 652bdd1243dSDimitry Andric defvar I = !shl(1, i); 653bdd1243dSDimitry Andric def FeatureStdExtZvl#I#b : 654*0fca6ea1SDimitry Andric RISCVExtension<"zvl"#I#"b", 1, 0, 655bdd1243dSDimitry Andric "'Zvl' (Minimum Vector Length) "#I, 656*0fca6ea1SDimitry Andric [!cast<RISCVExtension>("FeatureStdExtZvl"#!srl(I, 1)#"b")], 657*0fca6ea1SDimitry Andric "ZvlLen", !cast<string>(I)>; 658bdd1243dSDimitry Andric} 659bdd1243dSDimitry Andric 660bdd1243dSDimitry Andricdef FeatureStdExtZve32x 661*0fca6ea1SDimitry Andric : RISCVExtension<"zve32x", 1, 0, 662bdd1243dSDimitry Andric "'Zve32x' (Vector Extensions for Embedded Processors " 663bdd1243dSDimitry Andric "with maximal 32 EEW)", 66406c3fb27SDimitry Andric [FeatureStdExtZicsr, FeatureStdExtZvl32b]>; 665bdd1243dSDimitry Andric 666*0fca6ea1SDimitry Andric 667bdd1243dSDimitry Andricdef FeatureStdExtZve32f 668*0fca6ea1SDimitry Andric : RISCVExtension<"zve32f", 1, 0, 669bdd1243dSDimitry Andric "'Zve32f' (Vector Extensions for Embedded Processors " 670bdd1243dSDimitry Andric "with maximal 32 EEW and F extension)", 67106c3fb27SDimitry Andric [FeatureStdExtZve32x, FeatureStdExtF]>; 672bdd1243dSDimitry Andric 673bdd1243dSDimitry Andricdef FeatureStdExtZve64x 674*0fca6ea1SDimitry Andric : RISCVExtension<"zve64x", 1, 0, 675bdd1243dSDimitry Andric "'Zve64x' (Vector Extensions for Embedded Processors " 676bdd1243dSDimitry Andric "with maximal 64 EEW)", 677bdd1243dSDimitry Andric [FeatureStdExtZve32x, FeatureStdExtZvl64b]>; 678bdd1243dSDimitry Andric 679bdd1243dSDimitry Andricdef FeatureStdExtZve64f 680*0fca6ea1SDimitry Andric : RISCVExtension<"zve64f", 1, 0, 681bdd1243dSDimitry Andric "'Zve64f' (Vector Extensions for Embedded Processors " 682bdd1243dSDimitry Andric "with maximal 64 EEW and F extension)", 683bdd1243dSDimitry Andric [FeatureStdExtZve32f, FeatureStdExtZve64x]>; 684bdd1243dSDimitry Andric 685bdd1243dSDimitry Andricdef FeatureStdExtZve64d 686*0fca6ea1SDimitry Andric : RISCVExtension<"zve64d", 1, 0, 687bdd1243dSDimitry Andric "'Zve64d' (Vector Extensions for Embedded Processors " 688bdd1243dSDimitry Andric "with maximal 64 EEW, F and D extension)", 68906c3fb27SDimitry Andric [FeatureStdExtZve64f, FeatureStdExtD]>; 690bdd1243dSDimitry Andric 691bdd1243dSDimitry Andricdef FeatureStdExtV 692*0fca6ea1SDimitry Andric : RISCVExtension<"v", 1, 0, 693bdd1243dSDimitry Andric "'V' (Vector Extension for Application Processors)", 694*0fca6ea1SDimitry Andric [FeatureStdExtZvl128b, FeatureStdExtZve64d]>, 695*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 21>; 696bdd1243dSDimitry Andric 69706c3fb27SDimitry Andricdef FeatureStdExtZvfbfmin 698*0fca6ea1SDimitry Andric : RISCVExtension<"zvfbfmin", 1, 0, "'Zvbfmin' (Vector BF16 Converts)", 699cb14a3feSDimitry Andric [FeatureStdExtZve32f]>; 70006c3fb27SDimitry Andricdef HasStdExtZvfbfmin : Predicate<"Subtarget->hasStdExtZvfbfmin()">, 70106c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvfbfmin), 70206c3fb27SDimitry Andric "'Zvfbfmin' (Vector BF16 Converts)">; 70306c3fb27SDimitry Andric 70406c3fb27SDimitry Andricdef FeatureStdExtZvfbfwma 705*0fca6ea1SDimitry Andric : RISCVExtension<"zvfbfwma", 1, 0, 70606c3fb27SDimitry Andric "'Zvfbfwma' (Vector BF16 widening mul-add)", 707cb14a3feSDimitry Andric [FeatureStdExtZvfbfmin, FeatureStdExtZfbfmin]>; 70806c3fb27SDimitry Andricdef HasStdExtZvfbfwma : Predicate<"Subtarget->hasStdExtZvfbfwma()">, 70906c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvfbfwma), 71006c3fb27SDimitry Andric "'Zvfbfwma' (Vector BF16 widening mul-add)">; 71106c3fb27SDimitry Andric 7125f757f3fSDimitry Andricdef FeatureStdExtZvfhmin 713*0fca6ea1SDimitry Andric : RISCVExtension<"zvfhmin", 1, 0, 7145f757f3fSDimitry Andric "'Zvfhmin' (Vector Half-Precision Floating-Point Minimal)", 715*0fca6ea1SDimitry Andric [FeatureStdExtZve32f]>, 716*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 51>; 7175f757f3fSDimitry Andric 718cb14a3feSDimitry Andricdef FeatureStdExtZvfh 719*0fca6ea1SDimitry Andric : RISCVExtension<"zvfh", 1, 0, 720cb14a3feSDimitry Andric "'Zvfh' (Vector Half-Precision Floating-Point)", 721*0fca6ea1SDimitry Andric [FeatureStdExtZvfhmin, FeatureStdExtZfhmin]>, 722*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 50>; 723cb14a3feSDimitry Andric 72406c3fb27SDimitry Andricdef HasStdExtZfhOrZvfh 72506c3fb27SDimitry Andric : Predicate<"Subtarget->hasStdExtZfh() || Subtarget->hasStdExtZvfh()">, 72606c3fb27SDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZfh, FeatureStdExtZvfh), 72706c3fb27SDimitry Andric "'Zfh' (Half-Precision Floating-Point) or " 72806c3fb27SDimitry Andric "'Zvfh' (Vector Half-Precision Floating-Point)">; 729bdd1243dSDimitry Andric 7307a6dacacSDimitry Andric// Vector Cryptography and Bitmanip Extensions 731bdd1243dSDimitry Andric 7325f757f3fSDimitry Andricdef FeatureStdExtZvkb 733*0fca6ea1SDimitry Andric : RISCVExtension<"zvkb", 1, 0, 734*0fca6ea1SDimitry Andric "'Zvkb' (Vector Bit-manipulation used in Cryptography)">, 735*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 52>; 7365f757f3fSDimitry Andricdef HasStdExtZvkb : Predicate<"Subtarget->hasStdExtZvkb()">, 7375f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvkb), 7385f757f3fSDimitry Andric "'Zvkb' (Vector Bit-manipulation used in Cryptography)">; 7395f757f3fSDimitry Andric 74006c3fb27SDimitry Andricdef FeatureStdExtZvbb 741*0fca6ea1SDimitry Andric : RISCVExtension<"zvbb", 1, 0, 7427a6dacacSDimitry Andric "'Zvbb' (Vector basic bit-manipulation instructions)", 743*0fca6ea1SDimitry Andric [FeatureStdExtZvkb]>, 744*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 48>; 74506c3fb27SDimitry Andricdef HasStdExtZvbb : Predicate<"Subtarget->hasStdExtZvbb()">, 74606c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvbb), 7477a6dacacSDimitry Andric "'Zvbb' (Vector basic bit-manipulation instructions)">; 74806c3fb27SDimitry Andric 74906c3fb27SDimitry Andricdef FeatureStdExtZvbc 750*0fca6ea1SDimitry Andric : RISCVExtension<"zvbc", 1, 0, 751*0fca6ea1SDimitry Andric "'Zvbc' (Vector Carryless Multiplication)">, 752*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 49>; 75306c3fb27SDimitry Andricdef HasStdExtZvbc : Predicate<"Subtarget->hasStdExtZvbc()">, 75406c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvbc), 75506c3fb27SDimitry Andric "'Zvbc' (Vector Carryless Multiplication)">; 75606c3fb27SDimitry Andric 75706c3fb27SDimitry Andricdef FeatureStdExtZvkg 758*0fca6ea1SDimitry Andric : RISCVExtension<"zvkg", 1, 0, 759*0fca6ea1SDimitry Andric "'Zvkg' (Vector GCM instructions for Cryptography)">, 760*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 53>; 76106c3fb27SDimitry Andricdef HasStdExtZvkg : Predicate<"Subtarget->hasStdExtZvkg()">, 76206c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvkg), 76306c3fb27SDimitry Andric "'Zvkg' (Vector GCM instructions for Cryptography)">; 76406c3fb27SDimitry Andric 76506c3fb27SDimitry Andricdef FeatureStdExtZvkned 766*0fca6ea1SDimitry Andric : RISCVExtension<"zvkned", 1, 0, 767*0fca6ea1SDimitry Andric "'Zvkned' (Vector AES Encryption & Decryption (Single Round))">, 768*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 54>; 76906c3fb27SDimitry Andricdef HasStdExtZvkned : Predicate<"Subtarget->hasStdExtZvkned()">, 77006c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvkned), 77106c3fb27SDimitry Andric "'Zvkned' (Vector AES Encryption & Decryption (Single Round))">; 77206c3fb27SDimitry Andric 77306c3fb27SDimitry Andricdef FeatureStdExtZvknha 774*0fca6ea1SDimitry Andric : RISCVExtension<"zvknha", 1, 0, 775*0fca6ea1SDimitry Andric "'Zvknha' (Vector SHA-2 (SHA-256 only))">, 776*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 55>; 7775f757f3fSDimitry Andricdef HasStdExtZvknha : Predicate<"Subtarget->hasStdExtZvknha()">, 7785f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvknha), 7795f757f3fSDimitry Andric "'Zvknha' (Vector SHA-2 (SHA-256 only))">; 78006c3fb27SDimitry Andric 78106c3fb27SDimitry Andricdef FeatureStdExtZvknhb 782*0fca6ea1SDimitry Andric : RISCVExtension<"zvknhb", 1, 0, 78306c3fb27SDimitry Andric "'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))", 784*0fca6ea1SDimitry Andric [FeatureStdExtZve64x]>, 785*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 56>; 7865f757f3fSDimitry Andricdef HasStdExtZvknhb : Predicate<"Subtarget->hasStdExtZvknhb()">, 7875f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvknhb), 7885f757f3fSDimitry Andric "'Zvknhb' (Vector SHA-2 (SHA-256 and SHA-512))">; 78906c3fb27SDimitry Andric 7905f757f3fSDimitry Andricdef HasStdExtZvknhaOrZvknhb : Predicate<"Subtarget->hasStdExtZvknha() || Subtarget->hasStdExtZvknhb()">, 7915f757f3fSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZvknha, FeatureStdExtZvknhb), 7925f757f3fSDimitry Andric "'Zvknha' or 'Zvknhb' (Vector SHA-2)">; 79306c3fb27SDimitry Andric 79406c3fb27SDimitry Andricdef FeatureStdExtZvksed 795*0fca6ea1SDimitry Andric : RISCVExtension<"zvksed", 1, 0, 796*0fca6ea1SDimitry Andric "'Zvksed' (SM4 Block Cipher Instructions)">, 797*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 57>; 79806c3fb27SDimitry Andricdef HasStdExtZvksed : Predicate<"Subtarget->hasStdExtZvksed()">, 79906c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvksed), 80006c3fb27SDimitry Andric "'Zvksed' (SM4 Block Cipher Instructions)">; 80106c3fb27SDimitry Andric 80206c3fb27SDimitry Andricdef FeatureStdExtZvksh 803*0fca6ea1SDimitry Andric : RISCVExtension<"zvksh", 1, 0, 804*0fca6ea1SDimitry Andric "'Zvksh' (SM3 Hash Function Instructions)">, 805*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 58>; 80606c3fb27SDimitry Andricdef HasStdExtZvksh : Predicate<"Subtarget->hasStdExtZvksh()">, 80706c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZvksh), 80806c3fb27SDimitry Andric "'Zvksh' (SM3 Hash Function Instructions)">; 80906c3fb27SDimitry Andric 81006c3fb27SDimitry Andricdef FeatureStdExtZvkt 811*0fca6ea1SDimitry Andric : RISCVExtension<"zvkt", 1, 0, 812*0fca6ea1SDimitry Andric "'Zvkt' (Vector Data-Independent Execution Latency)">, 813*0fca6ea1SDimitry Andric RISCVExtensionBitmask<0, 59>; 81406c3fb27SDimitry Andric 8155f757f3fSDimitry Andric// Zvk short-hand extensions 8165f757f3fSDimitry Andric 8175f757f3fSDimitry Andricdef FeatureStdExtZvkn 818*0fca6ea1SDimitry Andric : RISCVExtension<"zvkn", 1, 0, 8197a6dacacSDimitry Andric "'Zvkn' (shorthand for 'Zvkned', 'Zvknhb', 'Zvkb', and " 8207a6dacacSDimitry Andric "'Zvkt')", 8215f757f3fSDimitry Andric [FeatureStdExtZvkned, FeatureStdExtZvknhb, 8225f757f3fSDimitry Andric FeatureStdExtZvkb, FeatureStdExtZvkt]>; 8235f757f3fSDimitry Andric 8245f757f3fSDimitry Andricdef FeatureStdExtZvknc 825*0fca6ea1SDimitry Andric : RISCVExtension<"zvknc", 1, 0, 8267a6dacacSDimitry Andric "'Zvknc' (shorthand for 'Zvknc' and 'Zvbc')", 8275f757f3fSDimitry Andric [FeatureStdExtZvkn, FeatureStdExtZvbc]>; 8285f757f3fSDimitry Andric 8295f757f3fSDimitry Andricdef FeatureStdExtZvkng 830*0fca6ea1SDimitry Andric : RISCVExtension<"zvkng", 1, 0, 8317a6dacacSDimitry Andric "'zvkng' (shorthand for 'Zvkn' and 'Zvkg')", 8325f757f3fSDimitry Andric [FeatureStdExtZvkn, FeatureStdExtZvkg]>; 8335f757f3fSDimitry Andric 8345f757f3fSDimitry Andricdef FeatureStdExtZvks 835*0fca6ea1SDimitry Andric : RISCVExtension<"zvks", 1, 0, 8367a6dacacSDimitry Andric "'Zvks' (shorthand for 'Zvksed', 'Zvksh', 'Zvkb', and " 8377a6dacacSDimitry Andric "'Zvkt')", 8385f757f3fSDimitry Andric [FeatureStdExtZvksed, FeatureStdExtZvksh, 8395f757f3fSDimitry Andric FeatureStdExtZvkb, FeatureStdExtZvkt]>; 8405f757f3fSDimitry Andric 8415f757f3fSDimitry Andricdef FeatureStdExtZvksc 842*0fca6ea1SDimitry Andric : RISCVExtension<"zvksc", 1, 0, 8437a6dacacSDimitry Andric "'Zvksc' (shorthand for 'Zvks' and 'Zvbc')", 8445f757f3fSDimitry Andric [FeatureStdExtZvks, FeatureStdExtZvbc]>; 8455f757f3fSDimitry Andric 8465f757f3fSDimitry Andricdef FeatureStdExtZvksg 847*0fca6ea1SDimitry Andric : RISCVExtension<"zvksg", 1, 0, 8487a6dacacSDimitry Andric "'Zvksg' (shorthand for 'Zvks' and 'Zvkg')", 8495f757f3fSDimitry Andric [FeatureStdExtZvks, FeatureStdExtZvkg]>; 8507a6dacacSDimitry Andric// Vector instruction predicates 8515f757f3fSDimitry Andric 8527a6dacacSDimitry Andricdef HasVInstructions : Predicate<"Subtarget->hasVInstructions()">, 8537a6dacacSDimitry Andric AssemblerPredicate< 8547a6dacacSDimitry Andric (any_of FeatureStdExtZve32x), 8557a6dacacSDimitry Andric "'V' (Vector Extension for Application Processors), 'Zve32x' " 8567a6dacacSDimitry Andric "(Vector Extensions for Embedded Processors)">; 8577a6dacacSDimitry Andricdef HasVInstructionsI64 : Predicate<"Subtarget->hasVInstructionsI64()">, 8587a6dacacSDimitry Andric AssemblerPredicate< 8597a6dacacSDimitry Andric (any_of FeatureStdExtZve64x), 8607a6dacacSDimitry Andric "'V' (Vector Extension for Application Processors) or 'Zve64x' " 8617a6dacacSDimitry Andric "(Vector Extensions for Embedded Processors)">; 8627a6dacacSDimitry Andricdef HasVInstructionsAnyF : Predicate<"Subtarget->hasVInstructionsAnyF()">, 8637a6dacacSDimitry Andric AssemblerPredicate< 8647a6dacacSDimitry Andric (any_of FeatureStdExtZve32f), 8657a6dacacSDimitry Andric "'V' (Vector Extension for Application Processors), 'Zve32f' " 8667a6dacacSDimitry Andric "(Vector Extensions for Embedded Processors)">; 86706c3fb27SDimitry Andric 8687a6dacacSDimitry Andricdef HasVInstructionsF16Minimal : Predicate<"Subtarget->hasVInstructionsF16Minimal()">, 8697a6dacacSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZvfhmin, FeatureStdExtZvfh), 8707a6dacacSDimitry Andric "'Zvfhmin' (Vector Half-Precision Floating-Point Minimal) or " 8717a6dacacSDimitry Andric "'Zvfh' (Vector Half-Precision Floating-Point)">; 872647cbc5dSDimitry Andric 8737a6dacacSDimitry Andricdef HasVInstructionsBF16 : Predicate<"Subtarget->hasVInstructionsBF16()">; 8747a6dacacSDimitry Andricdef HasVInstructionsF16 : Predicate<"Subtarget->hasVInstructionsF16()">; 8757a6dacacSDimitry Andricdef HasVInstructionsF64 : Predicate<"Subtarget->hasVInstructionsF64()">; 876647cbc5dSDimitry Andric 8777a6dacacSDimitry Andricdef HasVInstructionsFullMultiply : Predicate<"Subtarget->hasVInstructionsFullMultiply()">; 8787a6dacacSDimitry Andric 8797a6dacacSDimitry Andric// Hypervisor Extensions 8807a6dacacSDimitry Andric 8817a6dacacSDimitry Andricdef FeatureStdExtH 882*0fca6ea1SDimitry Andric : RISCVExtension<"h", 1, 0, 8837a6dacacSDimitry Andric "'H' (Hypervisor)">; 8847a6dacacSDimitry Andric 8857a6dacacSDimitry Andricdef HasStdExtH : Predicate<"Subtarget->hasStdExtH()">, 8867a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtH), 8877a6dacacSDimitry Andric "'H' (Hypervisor)">; 8887a6dacacSDimitry Andric 8897a6dacacSDimitry Andric// Supervisor extensions 890647cbc5dSDimitry Andric 891*0fca6ea1SDimitry Andricdef FeatureStdExtShgatpa 892*0fca6ea1SDimitry Andric : RISCVExtension<"shgatpa", 1, 0, 893*0fca6ea1SDimitry Andric "'Sgatpa' (SvNNx4 mode supported for all modes supported by satp, as well as Bare)">; 894*0fca6ea1SDimitry Andricdef FeatureStdExtShvsatpa 895*0fca6ea1SDimitry Andric : RISCVExtension<"shvsatpa", 1, 0, 896*0fca6ea1SDimitry Andric "'Svsatpa' (vsatp supports all modes supported by satp)">; 897*0fca6ea1SDimitry Andric 89806c3fb27SDimitry Andricdef FeatureStdExtSmaia 899*0fca6ea1SDimitry Andric : RISCVExtension<"smaia", 1, 0, 900*0fca6ea1SDimitry Andric "'Smaia' (Advanced Interrupt Architecture Machine Level)">; 90106c3fb27SDimitry Andricdef FeatureStdExtSsaia 902*0fca6ea1SDimitry Andric : RISCVExtension<"ssaia", 1, 0, 9037a6dacacSDimitry Andric "'Ssaia' (Advanced Interrupt Architecture Supervisor " 904*0fca6ea1SDimitry Andric "Level)">; 905*0fca6ea1SDimitry Andric 906*0fca6ea1SDimitry Andricdef FeatureStdExtSmcsrind 907*0fca6ea1SDimitry Andric : RISCVExtension<"smcsrind", 1, 0, 908*0fca6ea1SDimitry Andric "'Smcsrind' (Indirect CSR Access Machine Level)">; 909*0fca6ea1SDimitry Andricdef FeatureStdExtSscsrind 910*0fca6ea1SDimitry Andric : RISCVExtension<"sscsrind", 1, 0, 911*0fca6ea1SDimitry Andric "'Sscsrind' (Indirect CSR Access Supervisor Level)">; 91206c3fb27SDimitry Andric 9137a6dacacSDimitry Andricdef FeatureStdExtSmepmp 914*0fca6ea1SDimitry Andric : RISCVExtension<"smepmp", 1, 0, 915*0fca6ea1SDimitry Andric "'Smepmp' (Enhanced Physical Memory Protection)">; 916*0fca6ea1SDimitry Andric 917*0fca6ea1SDimitry Andricdef FeatureStdExtSmcdeleg 918*0fca6ea1SDimitry Andric : RISCVExtension<"smcdeleg", 1, 0, 919*0fca6ea1SDimitry Andric "'Smcdeleg' (Counter Delegation Machine Level)">; 920*0fca6ea1SDimitry Andricdef FeatureStdExtSsccfg 921*0fca6ea1SDimitry Andric : RISCVExtension<"ssccfg", 1, 0, 922*0fca6ea1SDimitry Andric "'Ssccfg' (Counter Configuration Supervisor Level)">; 923*0fca6ea1SDimitry Andric 924*0fca6ea1SDimitry Andricdef FeatureStdExtSsccptr 925*0fca6ea1SDimitry Andric : RISCVExtension<"ssccptr", 1, 0, 926*0fca6ea1SDimitry Andric "'Ssccptr' (Main memory supports page table reads)">; 927*0fca6ea1SDimitry Andric 928*0fca6ea1SDimitry Andricdef FeatureStdExtSscofpmf 929*0fca6ea1SDimitry Andric : RISCVExtension<"sscofpmf", 1, 0, 930*0fca6ea1SDimitry Andric "'Sscofpmf' (Count Overflow and Mode-Based Filtering)">; 931*0fca6ea1SDimitry Andric 932*0fca6ea1SDimitry Andricdef FeatureStdExtShcounterenw 933*0fca6ea1SDimitry Andric : RISCVExtension<"shcounterenw", 1, 0, 934*0fca6ea1SDimitry Andric "'Shcounterenw' (Support writeable hcounteren enable " 935*0fca6ea1SDimitry Andric "bit for any hpmcounter that is not read-only zero)">; 936*0fca6ea1SDimitry Andricdef FeatureStdExtSscounterenw 937*0fca6ea1SDimitry Andric : RISCVExtension<"sscounterenw", 1, 0, 938*0fca6ea1SDimitry Andric "'Sscounterenw' (Support writeable scounteren enable " 939*0fca6ea1SDimitry Andric "bit for any hpmcounter that is not read-only zero)">; 940*0fca6ea1SDimitry Andric 941*0fca6ea1SDimitry Andricdef FeatureStdExtSmstateen 942*0fca6ea1SDimitry Andric : RISCVExtension<"smstateen", 1, 0, 943*0fca6ea1SDimitry Andric "'Smstateen' (Machine-mode view of the state-enable extension)">; 944*0fca6ea1SDimitry Andricdef FeatureStdExtSsstateen 945*0fca6ea1SDimitry Andric : RISCVExtension<"ssstateen", 1, 0, 946*0fca6ea1SDimitry Andric "'Ssstateen' (Supervisor-mode view of the state-enable extension)">; 947*0fca6ea1SDimitry Andric 948*0fca6ea1SDimitry Andricdef FeatureStdExtSsstrict 949*0fca6ea1SDimitry Andric : RISCVExtension<"ssstrict", 1, 0, 950*0fca6ea1SDimitry Andric "'Ssstrict' (No non-conforming extensions are present)">; 951*0fca6ea1SDimitry Andric 952*0fca6ea1SDimitry Andricdef FeatureStdExtSstc 953*0fca6ea1SDimitry Andric : RISCVExtension<"sstc", 1, 0, 954*0fca6ea1SDimitry Andric "'Sstc' (Supervisor-mode timer interrupts)">; 955*0fca6ea1SDimitry Andric 956*0fca6ea1SDimitry Andricdef FeaturesStdExtSsqosid 957*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"ssqosid", 1, 0, 958*0fca6ea1SDimitry Andric "'Ssqosid' (Quality-of-Service (QoS) Identifiers)">; 959*0fca6ea1SDimitry Andric 960*0fca6ea1SDimitry Andricdef FeatureStdExtShtvala 961*0fca6ea1SDimitry Andric : RISCVExtension<"shtvala", 1, 0, 962*0fca6ea1SDimitry Andric "'Shtvala' (htval provides all needed values)">; 963*0fca6ea1SDimitry Andricdef FeatureStdExtShvstvala 964*0fca6ea1SDimitry Andric : RISCVExtension<"shvstvala", 1, 0, 965*0fca6ea1SDimitry Andric "'Shvstvala' (vstval provides all needed values)">; 966*0fca6ea1SDimitry Andricdef FeatureStdExtSstvala 967*0fca6ea1SDimitry Andric : RISCVExtension<"sstvala", 1, 0, 968*0fca6ea1SDimitry Andric "'Sstvala' (stval provides all needed values)">; 969*0fca6ea1SDimitry Andric 970*0fca6ea1SDimitry Andricdef FeatureStdExtShvstvecd 971*0fca6ea1SDimitry Andric : RISCVExtension<"shvstvecd", 1, 0, 972*0fca6ea1SDimitry Andric "'Shvstvecd' (vstvec supports Direct mode)">; 973*0fca6ea1SDimitry Andricdef FeatureStdExtSstvecd 974*0fca6ea1SDimitry Andric : RISCVExtension<"sstvecd", 1, 0, 975*0fca6ea1SDimitry Andric "'Sstvecd' (stvec supports Direct mode)">; 976*0fca6ea1SDimitry Andric 977*0fca6ea1SDimitry Andricdef FeatureStdExtSsu64xl 978*0fca6ea1SDimitry Andric : RISCVExtension<"ssu64xl", 1, 0, 979*0fca6ea1SDimitry Andric "'Ssu64xl' (UXLEN=64 supported)">; 980*0fca6ea1SDimitry Andric 981*0fca6ea1SDimitry Andricdef FeatureStdExtSvade 982*0fca6ea1SDimitry Andric : RISCVExtension<"svade", 1, 0, 983*0fca6ea1SDimitry Andric "'Svade' (Raise exceptions on improper A/D bits)">; 984*0fca6ea1SDimitry Andric 985*0fca6ea1SDimitry Andricdef FeatureStdExtSvadu 986*0fca6ea1SDimitry Andric : RISCVExtension<"svadu", 1, 0, 987*0fca6ea1SDimitry Andric "'Svadu' (Hardware A/D updates)">; 988*0fca6ea1SDimitry Andric 989*0fca6ea1SDimitry Andricdef FeatureStdExtSvbare 990*0fca6ea1SDimitry Andric : RISCVExtension<"svbare", 1, 0, 991*0fca6ea1SDimitry Andric "'Svbare' $(satp mode Bare supported)">; 99206c3fb27SDimitry Andric 9937a6dacacSDimitry Andricdef FeatureStdExtSvinval 994*0fca6ea1SDimitry Andric : RISCVExtension<"svinval", 1, 0, 9957a6dacacSDimitry Andric "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)">; 9967a6dacacSDimitry Andricdef HasStdExtSvinval : Predicate<"Subtarget->hasStdExtSvinval()">, 9977a6dacacSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtSvinval), 9987a6dacacSDimitry Andric "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)">; 9997a6dacacSDimitry Andric 10007a6dacacSDimitry Andricdef FeatureStdExtSvnapot 1001*0fca6ea1SDimitry Andric : RISCVExtension<"svnapot", 1, 0, 10027a6dacacSDimitry Andric "'Svnapot' (NAPOT Translation Contiguity)">; 10037a6dacacSDimitry Andric 10047a6dacacSDimitry Andricdef FeatureStdExtSvpbmt 1005*0fca6ea1SDimitry Andric : RISCVExtension<"svpbmt", 1, 0, 10067a6dacacSDimitry Andric "'Svpbmt' (Page-Based Memory Types)">; 100706c3fb27SDimitry Andric 1008*0fca6ea1SDimitry Andric// Pointer Masking extensions 1009*0fca6ea1SDimitry Andric 1010*0fca6ea1SDimitry Andric// A supervisor-level extension that provides pointer masking for the next lower 1011*0fca6ea1SDimitry Andric// privilege mode (U-mode), and for VS- and VU-modes if the H extension is 1012*0fca6ea1SDimitry Andric// present. 1013*0fca6ea1SDimitry Andricdef FeatureStdExtSsnpm 1014*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"ssnpm", 1, 0, 1015*0fca6ea1SDimitry Andric "'Ssnpm' (Supervisor-level Pointer Masking for next lower privilege mode)">; 1016*0fca6ea1SDimitry Andric 1017*0fca6ea1SDimitry Andric// A machine-level extension that provides pointer masking for the next lower 1018*0fca6ea1SDimitry Andric// privilege mode (S/HS if S-mode is implemented, or U-mode otherwise). 1019*0fca6ea1SDimitry Andricdef FeatureStdExtSmnpm 1020*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"smnpm", 1, 0, 1021*0fca6ea1SDimitry Andric "'Smnpm' (Machine-level Pointer Masking for next lower privilege mode)">; 1022*0fca6ea1SDimitry Andric 1023*0fca6ea1SDimitry Andric// A machine-level extension that provides pointer masking for M-mode. 1024*0fca6ea1SDimitry Andricdef FeatureStdExtSmmpm 1025*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"smmpm", 1, 0, 1026*0fca6ea1SDimitry Andric "'Smmpm' (Machine-level Pointer Masking for M-mode)">; 1027*0fca6ea1SDimitry Andric 1028*0fca6ea1SDimitry Andric// An extension that indicates that there is pointer-masking support available 1029*0fca6ea1SDimitry Andric// in supervisor mode, with some facility provided in the supervisor execution 1030*0fca6ea1SDimitry Andric// environment to control pointer masking. 1031*0fca6ea1SDimitry Andricdef FeatureStdExtSspm 1032*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"sspm", 1, 0, 1033*0fca6ea1SDimitry Andric "'Sspm' (Indicates Supervisor-mode Pointer Masking)">; 1034*0fca6ea1SDimitry Andric 1035*0fca6ea1SDimitry Andric// An extension that indicates that there is pointer-masking support available 1036*0fca6ea1SDimitry Andric// in user mode, with some facility provided in the application execution 1037*0fca6ea1SDimitry Andric// environment to control pointer masking. 1038*0fca6ea1SDimitry Andricdef FeatureStdExtSupm 1039*0fca6ea1SDimitry Andric : RISCVExperimentalExtension<"supm", 1, 0, 1040*0fca6ea1SDimitry Andric "'Supm' (Indicates User-mode Pointer Masking)">; 1041*0fca6ea1SDimitry Andric 1042bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 1043bdd1243dSDimitry Andric// Vendor extensions 1044bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 1045bdd1243dSDimitry Andric 10467a6dacacSDimitry Andric// Ventana Extenions 10477a6dacacSDimitry Andric 1048bdd1243dSDimitry Andricdef FeatureVendorXVentanaCondOps 1049*0fca6ea1SDimitry Andric : RISCVExtension<"xventanacondops", 1, 0, 1050bdd1243dSDimitry Andric "'XVentanaCondOps' (Ventana Conditional Ops)">; 1051bdd1243dSDimitry Andricdef HasVendorXVentanaCondOps : Predicate<"Subtarget->hasVendorXVentanaCondOps()">, 1052bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXVentanaCondOps), 1053bdd1243dSDimitry Andric "'XVentanaCondOps' (Ventana Conditional Ops)">; 1054bdd1243dSDimitry Andric 10557a6dacacSDimitry Andric// T-Head Extensions 10567a6dacacSDimitry Andric 105706c3fb27SDimitry Andricdef FeatureVendorXTHeadBa 1058*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadba", 1, 0, 1059*0fca6ea1SDimitry Andric "'XTHeadBa' (T-Head address calculation instructions)">; 106006c3fb27SDimitry Andricdef HasVendorXTHeadBa : Predicate<"Subtarget->hasVendorXTHeadBa()">, 106106c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadBa), 1062*0fca6ea1SDimitry Andric "'XTHeadBa' (T-Head address calculation instructions)">; 106306c3fb27SDimitry Andric 106406c3fb27SDimitry Andricdef FeatureVendorXTHeadBb 1065*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadbb", 1, 0, 1066*0fca6ea1SDimitry Andric "'XTHeadBb' (T-Head basic bit-manipulation instructions)">; 106706c3fb27SDimitry Andricdef HasVendorXTHeadBb : Predicate<"Subtarget->hasVendorXTHeadBb()">, 106806c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadBb), 1069*0fca6ea1SDimitry Andric "'XTHeadBb' (T-Head basic bit-manipulation instructions)">; 107006c3fb27SDimitry Andric 107106c3fb27SDimitry Andricdef FeatureVendorXTHeadBs 1072*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadbs", 1, 0, 1073*0fca6ea1SDimitry Andric "'XTHeadBs' (T-Head single-bit instructions)">; 107406c3fb27SDimitry Andricdef HasVendorXTHeadBs : Predicate<"Subtarget->hasVendorXTHeadBs()">, 107506c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadBs), 1076*0fca6ea1SDimitry Andric "'XTHeadBs' (T-Head single-bit instructions)">; 107706c3fb27SDimitry Andric 107806c3fb27SDimitry Andricdef FeatureVendorXTHeadCondMov 1079*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadcondmov", 1, 0, 1080*0fca6ea1SDimitry Andric "'XTHeadCondMov' (T-Head conditional move instructions)">; 108106c3fb27SDimitry Andricdef HasVendorXTHeadCondMov : Predicate<"Subtarget->hasVendorXTHeadCondMov()">, 108206c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadCondMov), 1083*0fca6ea1SDimitry Andric "'XTHeadCondMov' (T-Head conditional move instructions)">; 108406c3fb27SDimitry Andric 108506c3fb27SDimitry Andricdef FeatureVendorXTHeadCmo 1086*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadcmo", 1, 0, 1087*0fca6ea1SDimitry Andric "'XTHeadCmo' (T-Head cache management instructions)">; 108806c3fb27SDimitry Andricdef HasVendorXTHeadCmo : Predicate<"Subtarget->hasVendorXTHeadCmo()">, 108906c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadCmo), 1090*0fca6ea1SDimitry Andric "'XTHeadCmo' (T-Head cache management instructions)">; 109106c3fb27SDimitry Andric 109206c3fb27SDimitry Andricdef FeatureVendorXTHeadFMemIdx 1093*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadfmemidx", 1, 0, 1094*0fca6ea1SDimitry Andric "'XTHeadFMemIdx' (T-Head FP Indexed Memory Operations)">; 109506c3fb27SDimitry Andricdef HasVendorXTHeadFMemIdx : Predicate<"Subtarget->hasVendorXTHeadFMemIdx()">, 109606c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadFMemIdx), 1097*0fca6ea1SDimitry Andric "'XTHeadFMemIdx' (T-Head FP Indexed Memory Operations)">; 109806c3fb27SDimitry Andric 109906c3fb27SDimitry Andricdef FeatureVendorXTHeadMac 1100*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadmac", 1, 0, 1101*0fca6ea1SDimitry Andric "'XTHeadMac' (T-Head Multiply-Accumulate Instructions)">; 110206c3fb27SDimitry Andricdef HasVendorXTHeadMac : Predicate<"Subtarget->hasVendorXTHeadMac()">, 110306c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadMac), 1104*0fca6ea1SDimitry Andric "'XTHeadMac' (T-Head Multiply-Accumulate Instructions)">; 110506c3fb27SDimitry Andric 110606c3fb27SDimitry Andricdef FeatureVendorXTHeadMemIdx 1107*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadmemidx", 1, 0, 1108*0fca6ea1SDimitry Andric "'XTHeadMemIdx' (T-Head Indexed Memory Operations)">; 110906c3fb27SDimitry Andricdef HasVendorXTHeadMemIdx : Predicate<"Subtarget->hasVendorXTHeadMemIdx()">, 111006c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadMemIdx), 1111*0fca6ea1SDimitry Andric "'XTHeadMemIdx' (T-Head Indexed Memory Operations)">; 111206c3fb27SDimitry Andric 111306c3fb27SDimitry Andricdef FeatureVendorXTHeadMemPair 1114*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadmempair", 1, 0, 1115*0fca6ea1SDimitry Andric "'XTHeadMemPair' (T-Head two-GPR Memory Operations)">; 111606c3fb27SDimitry Andricdef HasVendorXTHeadMemPair : Predicate<"Subtarget->hasVendorXTHeadMemPair()">, 111706c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadMemPair), 1118*0fca6ea1SDimitry Andric "'XTHeadMemPair' (T-Head two-GPR Memory Operations)">; 111906c3fb27SDimitry Andric 112006c3fb27SDimitry Andricdef FeatureVendorXTHeadSync 1121*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadsync", 1, 0, 1122*0fca6ea1SDimitry Andric "'XTHeadSync' (T-Head multicore synchronization instructions)">; 112306c3fb27SDimitry Andricdef HasVendorXTHeadSync : Predicate<"Subtarget->hasVendorXTHeadSync()">, 112406c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadSync), 1125*0fca6ea1SDimitry Andric "'XTHeadSync' (T-Head multicore synchronization instructions)">; 112606c3fb27SDimitry Andric 1127bdd1243dSDimitry Andricdef FeatureVendorXTHeadVdot 1128*0fca6ea1SDimitry Andric : RISCVExtension<"xtheadvdot", 1, 0, 1129*0fca6ea1SDimitry Andric "'XTHeadVdot' (T-Head Vector Extensions for Dot)", 1130bdd1243dSDimitry Andric [FeatureStdExtV]>; 1131bdd1243dSDimitry Andricdef HasVendorXTHeadVdot : Predicate<"Subtarget->hasVendorXTHeadVdot()">, 1132bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadVdot), 1133*0fca6ea1SDimitry Andric "'XTHeadVdot' (T-Head Vector Extensions for Dot)">; 1134bdd1243dSDimitry Andric 11357a6dacacSDimitry Andric// SiFive Extensions 11367a6dacacSDimitry Andric 113706c3fb27SDimitry Andricdef FeatureVendorXSfvcp 1138*0fca6ea1SDimitry Andric : RISCVExtension<"xsfvcp", 1, 0, 113906c3fb27SDimitry Andric "'XSfvcp' (SiFive Custom Vector Coprocessor Interface Instructions)", 114006c3fb27SDimitry Andric [FeatureStdExtZve32x]>; 114106c3fb27SDimitry Andricdef HasVendorXSfvcp : Predicate<"Subtarget->hasVendorXSfvcp()">, 114206c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSfvcp), 114306c3fb27SDimitry Andric "'XSfvcp' (SiFive Custom Vector Coprocessor Interface Instructions)">; 114406c3fb27SDimitry Andric 11455f757f3fSDimitry Andricdef FeatureVendorXSfvqmaccdod 1146*0fca6ea1SDimitry Andric : RISCVExtension<"xsfvqmaccdod", 1, 0, 11475f757f3fSDimitry Andric "'XSfvqmaccdod' (SiFive Int8 Matrix Multiplication Instructions (2-by-8 and 8-by-2))", 11485f757f3fSDimitry Andric [FeatureStdExtZve32x]>; 11497a6dacacSDimitry Andricdef HasVendorXSfvqmaccdod 11507a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXSfvqmaccdod()">, 11515f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSfvqmaccdod), 11525f757f3fSDimitry Andric "'XSfvqmaccdod' (SiFive Int8 Matrix Multiplication Instructions (2-by-8 and 8-by-2))">; 11535f757f3fSDimitry Andric 11545f757f3fSDimitry Andricdef FeatureVendorXSfvqmaccqoq 1155*0fca6ea1SDimitry Andric : RISCVExtension<"xsfvqmaccqoq", 1, 0, 11565f757f3fSDimitry Andric "'XSfvqmaccqoq' (SiFive Int8 Matrix Multiplication Instructions (4-by-8 and 8-by-4))", 11575f757f3fSDimitry Andric [FeatureStdExtZve32x]>; 11587a6dacacSDimitry Andricdef HasVendorXSfvqmaccqoq 11597a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXSfvqmaccqoq()">, 11605f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSfvqmaccqoq), 11615f757f3fSDimitry Andric "'XSfvqmaccqoq' (SiFive Int8 Matrix Multiplication Instructions (4-by-8 and 8-by-4))">; 11625f757f3fSDimitry Andric 11635f757f3fSDimitry Andricdef FeatureVendorXSfvfwmaccqqq 1164*0fca6ea1SDimitry Andric : RISCVExtension<"xsfvfwmaccqqq", 1, 0, 11655f757f3fSDimitry Andric "'XSfvfwmaccqqq' (SiFive Matrix Multiply Accumulate Instruction and 4-by-4))", 1166*0fca6ea1SDimitry Andric [FeatureStdExtZvfbfmin]>; 11677a6dacacSDimitry Andricdef HasVendorXSfvfwmaccqqq 11687a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXSfvfwmaccqqq()">, 11695f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSfvfwmaccqqq), 11705f757f3fSDimitry Andric "'XSfvfwmaccqqq' (SiFive Matrix Multiply Accumulate Instruction and 4-by-4))">; 11715f757f3fSDimitry Andric 11725f757f3fSDimitry Andricdef FeatureVendorXSfvfnrclipxfqf 1173*0fca6ea1SDimitry Andric : RISCVExtension<"xsfvfnrclipxfqf", 1, 0, 11745f757f3fSDimitry Andric "'XSfvfnrclipxfqf' (SiFive FP32-to-int8 Ranged Clip Instructions)", 11755f757f3fSDimitry Andric [FeatureStdExtZve32f]>; 11767a6dacacSDimitry Andricdef HasVendorXSfvfnrclipxfqf 11777a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXSfvfnrclipxfqf()">, 11785f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSfvfnrclipxfqf), 11795f757f3fSDimitry Andric "'XSfvfnrclipxfqf' (SiFive FP32-to-int8 Ranged Clip Instructions)">; 11807a6dacacSDimitry Andric 1181*0fca6ea1SDimitry Andricdef FeatureVendorXSiFivecdiscarddlone 1182*0fca6ea1SDimitry Andric : RISCVExtension<"xsifivecdiscarddlone", 1, 0, 1183*0fca6ea1SDimitry Andric "'XSiFivecdiscarddlone' (SiFive sf.cdiscard.d.l1 Instruction)", []>; 1184*0fca6ea1SDimitry Andricdef HasVendorXSiFivecdiscarddlone 1185*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasVendorXSiFivecdiscarddlone()">, 1186*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSiFivecdiscarddlone), 1187*0fca6ea1SDimitry Andric "'XSiFivecdiscarddlone' (SiFive sf.cdiscard.d.l1 Instruction)">; 1188*0fca6ea1SDimitry Andric 1189*0fca6ea1SDimitry Andricdef FeatureVendorXSiFivecflushdlone 1190*0fca6ea1SDimitry Andric : RISCVExtension<"xsifivecflushdlone", 1, 0, 1191*0fca6ea1SDimitry Andric "'XSiFivecflushdlone' (SiFive sf.cflush.d.l1 Instruction)", []>; 1192*0fca6ea1SDimitry Andricdef HasVendorXSiFivecflushdlone 1193*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasVendorXSiFivecflushdlone()">, 1194*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSiFivecflushdlone), 1195*0fca6ea1SDimitry Andric "'XSiFivecflushdlone' (SiFive sf.cflush.d.l1 Instruction)">; 1196*0fca6ea1SDimitry Andric 1197*0fca6ea1SDimitry Andricdef FeatureVendorXSfcease 1198*0fca6ea1SDimitry Andric : RISCVExtension<"xsfcease", 1, 0, 1199*0fca6ea1SDimitry Andric "'XSfcease' (SiFive sf.cease Instruction)", []>; 1200*0fca6ea1SDimitry Andricdef HasVendorXSfcease 1201*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasVendorXSfcease()">, 1202*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXSfcease), 1203*0fca6ea1SDimitry Andric "'XSfcease' (SiFive sf.cease Instruction)">; 1204*0fca6ea1SDimitry Andric 12057a6dacacSDimitry Andric// Core-V Extensions 12067a6dacacSDimitry Andric 12075f757f3fSDimitry Andricdef FeatureVendorXCVelw 1208*0fca6ea1SDimitry Andric : RISCVExtension<"xcvelw", 1, 0, 12095f757f3fSDimitry Andric "'XCVelw' (CORE-V Event Load Word)">; 12105f757f3fSDimitry Andricdef HasVendorXCVelw 12115f757f3fSDimitry Andric : Predicate<"Subtarget->hasVendorXCVelw()">, 12125f757f3fSDimitry Andric AssemblerPredicate<(any_of FeatureVendorXCVelw), 12135f757f3fSDimitry Andric "'XCVelw' (CORE-V Event Load Word)">; 12145f757f3fSDimitry Andric 121506c3fb27SDimitry Andricdef FeatureVendorXCVbitmanip 1216*0fca6ea1SDimitry Andric : RISCVExtension<"xcvbitmanip", 1, 0, 121706c3fb27SDimitry Andric "'XCVbitmanip' (CORE-V Bit Manipulation)">; 12187a6dacacSDimitry Andricdef HasVendorXCVbitmanip 12197a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXCVbitmanip()">, 122006c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXCVbitmanip), 122106c3fb27SDimitry Andric "'XCVbitmanip' (CORE-V Bit Manipulation)">; 122206c3fb27SDimitry Andric 122306c3fb27SDimitry Andricdef FeatureVendorXCVmac 1224*0fca6ea1SDimitry Andric : RISCVExtension<"xcvmac", 1, 0, 122506c3fb27SDimitry Andric "'XCVmac' (CORE-V Multiply-Accumulate)">; 12267a6dacacSDimitry Andricdef HasVendorXCVmac 12277a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXCVmac()">, 122806c3fb27SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXCVmac), 122906c3fb27SDimitry Andric "'XCVmac' (CORE-V Multiply-Accumulate)">; 123006c3fb27SDimitry Andric 12315f757f3fSDimitry Andricdef FeatureVendorXCVmem 1232*0fca6ea1SDimitry Andric : RISCVExtension<"xcvmem", 1, 0, 12335f757f3fSDimitry Andric "'XCVmem' (CORE-V Post-incrementing Load & Store)">; 12345f757f3fSDimitry Andricdef HasVendorXCVmem 12355f757f3fSDimitry Andric : Predicate<"Subtarget->hasVendorXCVmem()">, 12365f757f3fSDimitry Andric AssemblerPredicate<(any_of FeatureVendorXCVmem), 12375f757f3fSDimitry Andric "'XCVmem' (CORE-V Post-incrementing Load & Store)">; 12385f757f3fSDimitry Andric 12395f757f3fSDimitry Andricdef FeatureVendorXCValu 1240*0fca6ea1SDimitry Andric : RISCVExtension<"xcvalu", 1, 0, 12415f757f3fSDimitry Andric "'XCValu' (CORE-V ALU Operations)">; 12427a6dacacSDimitry Andricdef HasVendorXCValu 12437a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXCValu()">, 12445f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXCValu), 12455f757f3fSDimitry Andric "'XCValu' (CORE-V ALU Operations)">; 12465f757f3fSDimitry Andric 12475f757f3fSDimitry Andricdef FeatureVendorXCVsimd 1248*0fca6ea1SDimitry Andric : RISCVExtension<"xcvsimd", 1, 0, 12495f757f3fSDimitry Andric "'XCVsimd' (CORE-V SIMD ALU)">; 12505f757f3fSDimitry Andricdef HasVendorXCVsimd 12515f757f3fSDimitry Andric : Predicate<"Subtarget->hasVendorXCVsimd()">, 12525f757f3fSDimitry Andric AssemblerPredicate<(any_of FeatureVendorXCVsimd), 12535f757f3fSDimitry Andric "'XCVsimd' (CORE-V SIMD ALU)">; 12545f757f3fSDimitry Andric 12555f757f3fSDimitry Andricdef FeatureVendorXCVbi 1256*0fca6ea1SDimitry Andric : RISCVExtension<"xcvbi", 1, 0, 12575f757f3fSDimitry Andric "'XCVbi' (CORE-V Immediate Branching)">; 12587a6dacacSDimitry Andricdef HasVendorXCVbi 12597a6dacacSDimitry Andric : Predicate<"Subtarget->hasVendorXCVbi()">, 12605f757f3fSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXCVbi), 12615f757f3fSDimitry Andric "'XCVbi' (CORE-V Immediate Branching)">; 12625f757f3fSDimitry Andric 1263*0fca6ea1SDimitry Andric// WCH / Nanjing Qinheng Microelectronics Extension(s) 1264*0fca6ea1SDimitry Andric 1265*0fca6ea1SDimitry Andricdef FeatureVendorXwchc 1266*0fca6ea1SDimitry Andric : RISCVExtension<"xwchc", 2, 2, 1267*0fca6ea1SDimitry Andric "'Xwchc' (WCH/QingKe additional compressed opcodes)">; 1268*0fca6ea1SDimitry Andricdef HasVendorXwchc 1269*0fca6ea1SDimitry Andric : Predicate<"Subtarget->hasVendorXwchc()">, 1270*0fca6ea1SDimitry Andric AssemblerPredicate<(all_of FeatureVendorXwchc), 1271*0fca6ea1SDimitry Andric "'Xwchc' (WCH/QingKe additional compressed opcodes)">; 1272*0fca6ea1SDimitry Andric 1273bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 1274bdd1243dSDimitry Andric// LLVM specific features and extensions 1275bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 1276bdd1243dSDimitry Andric 1277bdd1243dSDimitry Andric// Feature32Bit exists to mark CPUs that support RV32 to distinquish them from 1278bdd1243dSDimitry Andric// tuning CPU names. 1279bdd1243dSDimitry Andricdef Feature32Bit 128006c3fb27SDimitry Andric : SubtargetFeature<"32bit", "IsRV32", "true", "Implements RV32">; 1281bdd1243dSDimitry Andricdef Feature64Bit 128206c3fb27SDimitry Andric : SubtargetFeature<"64bit", "IsRV64", "true", "Implements RV64">; 1283bdd1243dSDimitry Andricdef IsRV64 : Predicate<"Subtarget->is64Bit()">, 1284bdd1243dSDimitry Andric AssemblerPredicate<(all_of Feature64Bit), 1285bdd1243dSDimitry Andric "RV64I Base Instruction Set">; 1286bdd1243dSDimitry Andricdef IsRV32 : Predicate<"!Subtarget->is64Bit()">, 1287bdd1243dSDimitry Andric AssemblerPredicate<(all_of (not Feature64Bit)), 1288bdd1243dSDimitry Andric "RV32I Base Instruction Set">; 1289bdd1243dSDimitry Andric 1290bdd1243dSDimitry Andricdefvar RV32 = DefaultMode; 129106c3fb27SDimitry Andricdef RV64 : HwMode<"+64bit", [IsRV64]>; 1292bdd1243dSDimitry Andric 1293bdd1243dSDimitry Andricdef FeatureRelax 1294bdd1243dSDimitry Andric : SubtargetFeature<"relax", "EnableLinkerRelax", "true", 1295bdd1243dSDimitry Andric "Enable Linker relaxation.">; 1296bdd1243dSDimitry Andric 1297bdd1243dSDimitry Andricforeach i = {1-31} in 1298bdd1243dSDimitry Andric def FeatureReserveX#i : 1299bdd1243dSDimitry Andric SubtargetFeature<"reserve-x"#i, "UserReservedRegister[RISCV::X"#i#"]", 1300bdd1243dSDimitry Andric "true", "Reserve X"#i>; 1301bdd1243dSDimitry Andric 1302bdd1243dSDimitry Andricdef FeatureSaveRestore : SubtargetFeature<"save-restore", "EnableSaveRestore", 1303bdd1243dSDimitry Andric "true", "Enable save/restore.">; 1304bdd1243dSDimitry Andric 1305*0fca6ea1SDimitry Andricdef FeatureNoTrailingSeqCstFence : SubtargetFeature<"no-trailing-seq-cst-fence", 1306*0fca6ea1SDimitry Andric "EnableTrailingSeqCstFence", 1307*0fca6ea1SDimitry Andric "false", 1308*0fca6ea1SDimitry Andric "Disable trailing fence for seq-cst store.">; 1309bdd1243dSDimitry Andric 13103a079333SDimitry Andricdef FeatureUnalignedScalarMem 13113a079333SDimitry Andric : SubtargetFeature<"unaligned-scalar-mem", "EnableUnalignedScalarMem", 13123a079333SDimitry Andric "true", "Has reasonably performant unaligned scalar " 13133a079333SDimitry Andric "loads and stores">; 13143a079333SDimitry Andric 1315*0fca6ea1SDimitry Andricdef FeatureUnalignedVectorMem 1316*0fca6ea1SDimitry Andric : SubtargetFeature<"unaligned-vector-mem", "EnableUnalignedVectorMem", 1317*0fca6ea1SDimitry Andric "true", "Has reasonably performant unaligned vector " 1318*0fca6ea1SDimitry Andric "loads and stores">; 1319*0fca6ea1SDimitry Andric 13205f757f3fSDimitry Andricdef FeaturePostRAScheduler : SubtargetFeature<"use-postra-scheduler", 13215f757f3fSDimitry Andric "UsePostRAScheduler", "true", "Schedule again after register allocation">; 132206c3fb27SDimitry Andric 1323*0fca6ea1SDimitry Andricdef FeaturePredictableSelectIsExpensive 1324*0fca6ea1SDimitry Andric : SubtargetFeature<"predictable-select-expensive", "PredictableSelectIsExpensive", "true", 1325*0fca6ea1SDimitry Andric "Prefer likely predicted branches over selects">; 1326*0fca6ea1SDimitry Andric 1327*0fca6ea1SDimitry Andricdef TuneOptimizedZeroStrideLoad 1328*0fca6ea1SDimitry Andric : SubtargetFeature<"optimized-zero-stride-load", "HasOptimizedZeroStrideLoad", 1329*0fca6ea1SDimitry Andric "true", "Optimized (perform fewer memory operations)" 1330bdd1243dSDimitry Andric "zero-stride vector load">; 1331bdd1243dSDimitry Andric 1332cb14a3feSDimitry Andricdef Experimental 1333cb14a3feSDimitry Andric : SubtargetFeature<"experimental", "HasExperimental", 1334cb14a3feSDimitry Andric "true", "Experimental intrinsics">; 1335cb14a3feSDimitry Andric 133606c3fb27SDimitry Andric// Some vector hardware implementations do not process all VLEN bits in parallel 133706c3fb27SDimitry Andric// and instead split over multiple cycles. DLEN refers to the datapath width 133806c3fb27SDimitry Andric// that can be done in parallel. 133906c3fb27SDimitry Andricdef TuneDLenFactor2 134006c3fb27SDimitry Andric : SubtargetFeature<"dlen-factor-2", "DLenFactor2", "true", 134106c3fb27SDimitry Andric "Vector unit DLEN(data path width) is half of VLEN">; 134206c3fb27SDimitry Andric 1343bdd1243dSDimitry Andricdef TuneNoDefaultUnroll 1344bdd1243dSDimitry Andric : SubtargetFeature<"no-default-unroll", "EnableDefaultUnroll", "false", 1345bdd1243dSDimitry Andric "Disable default unroll preference.">; 1346bdd1243dSDimitry Andric 1347bdd1243dSDimitry Andric// SiFive 7 is able to fuse integer ALU operations with a preceding branch 1348bdd1243dSDimitry Andric// instruction. 1349bdd1243dSDimitry Andricdef TuneShortForwardBranchOpt 1350bdd1243dSDimitry Andric : SubtargetFeature<"short-forward-branch-opt", "HasShortForwardBranchOpt", 1351bdd1243dSDimitry Andric "true", "Enable short forward branch optimization">; 1352bdd1243dSDimitry Andricdef HasShortForwardBranchOpt : Predicate<"Subtarget->hasShortForwardBranchOpt()">; 1353bdd1243dSDimitry Andricdef NoShortForwardBranchOpt : Predicate<"!Subtarget->hasShortForwardBranchOpt()">; 1354bdd1243dSDimitry Andric 1355*0fca6ea1SDimitry Andric// Some subtargets require a S2V transfer buffer to move scalars into vectors. 1356*0fca6ea1SDimitry Andric// FIXME: Forming .vx/.vf/.wx/.wf can reduce register pressure. 1357*0fca6ea1SDimitry Andricdef TuneNoSinkSplatOperands 1358*0fca6ea1SDimitry Andric : SubtargetFeature<"no-sink-splat-operands", "SinkSplatOperands", 1359*0fca6ea1SDimitry Andric "false", "Disable sink splat operands to enable .vx, .vf," 1360*0fca6ea1SDimitry Andric ".wx, and .wf instructions">; 1361*0fca6ea1SDimitry Andric 1362*0fca6ea1SDimitry Andricdef TunePreferWInst 1363*0fca6ea1SDimitry Andric : SubtargetFeature<"prefer-w-inst", "PreferWInst", "true", 1364*0fca6ea1SDimitry Andric "Prefer instructions with W suffix">; 1365*0fca6ea1SDimitry Andric 13661db9f3b2SDimitry Andricdef TuneConditionalCompressedMoveFusion 13671db9f3b2SDimitry Andric : SubtargetFeature<"conditional-cmv-fusion", "HasConditionalCompressedMoveFusion", 13681db9f3b2SDimitry Andric "true", "Enable branch+c.mv fusion">; 13691db9f3b2SDimitry Andricdef HasConditionalMoveFusion : Predicate<"Subtarget->hasConditionalMoveFusion()">; 13701db9f3b2SDimitry Andricdef NoConditionalMoveFusion : Predicate<"!Subtarget->hasConditionalMoveFusion()">; 13711db9f3b2SDimitry Andric 1372bdd1243dSDimitry Andricdef TuneSiFive7 : SubtargetFeature<"sifive7", "RISCVProcFamily", "SiFive7", 1373bdd1243dSDimitry Andric "SiFive 7-Series processors", 1374bdd1243dSDimitry Andric [TuneNoDefaultUnroll, 1375bdd1243dSDimitry Andric TuneShortForwardBranchOpt]>; 1376bdd1243dSDimitry Andric 1377cb14a3feSDimitry Andricdef TuneVentanaVeyron : SubtargetFeature<"ventana-veyron", "RISCVProcFamily", "VentanaVeyron", 1378cb14a3feSDimitry Andric "Ventana Veyron-Series processors">; 13795f757f3fSDimitry Andric 1380bdd1243dSDimitry Andric// Assume that lock-free native-width atomics are available, even if the target 1381bdd1243dSDimitry Andric// and operating system combination would not usually provide them. The user 1382bdd1243dSDimitry Andric// is responsible for providing any necessary __sync implementations. Code 1383bdd1243dSDimitry Andric// built with this feature is not ABI-compatible with code built without this 1384bdd1243dSDimitry Andric// feature, if atomic variables are exposed across the ABI boundary. 1385bdd1243dSDimitry Andricdef FeatureForcedAtomics : SubtargetFeature< 1386bdd1243dSDimitry Andric "forced-atomics", "HasForcedAtomics", "true", 1387bdd1243dSDimitry Andric "Assume that lock-free native-width atomics are available">; 1388bdd1243dSDimitry Andricdef HasAtomicLdSt 1389bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtA() || Subtarget->hasForcedAtomics()">; 1390bdd1243dSDimitry Andric 1391bdd1243dSDimitry Andricdef FeatureTaggedGlobals : SubtargetFeature<"tagged-globals", 1392bdd1243dSDimitry Andric "AllowTaggedGlobals", 1393bdd1243dSDimitry Andric "true", "Use an instruction sequence for taking the address of a global " 1394bdd1243dSDimitry Andric "that allows a memory tag in the upper address bits">; 1395*0fca6ea1SDimitry Andric 1396*0fca6ea1SDimitry Andricdef FeatureForcedSWShadowStack : SubtargetFeature< 1397*0fca6ea1SDimitry Andric "forced-sw-shadow-stack", "HasForcedSWShadowStack", "true", 1398*0fca6ea1SDimitry Andric "Implement shadow stack with software.">; 1399*0fca6ea1SDimitry Andricdef HasForcedSWShadowStack : Predicate<"Subtarget->hasForcedSWShadowStack()">; 1400