1*bdd1243dSDimitry Andric//===-- RISCVFeatures.td - RISCV Features and Extensions ---*- tablegen -*-===// 2*bdd1243dSDimitry Andric// 3*bdd1243dSDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4*bdd1243dSDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 5*bdd1243dSDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6*bdd1243dSDimitry Andric// 7*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 8*bdd1243dSDimitry Andric 9*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 10*bdd1243dSDimitry Andric// RISC-V subtarget features and instruction predicates. 11*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 12*bdd1243dSDimitry Andric 13*bdd1243dSDimitry Andricdef FeatureStdExtM 14*bdd1243dSDimitry Andric : SubtargetFeature<"m", "HasStdExtM", "true", 15*bdd1243dSDimitry Andric "'M' (Integer Multiplication and Division)">; 16*bdd1243dSDimitry Andricdef HasStdExtM : Predicate<"Subtarget->hasStdExtM()">, 17*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtM), 18*bdd1243dSDimitry Andric "'M' (Integer Multiplication and Division)">; 19*bdd1243dSDimitry Andric 20*bdd1243dSDimitry Andricdef FeatureStdExtZmmul 21*bdd1243dSDimitry Andric : SubtargetFeature<"zmmul", "HasStdExtZmmul", "true", 22*bdd1243dSDimitry Andric "'Zmmul' (Integer Multiplication)">; 23*bdd1243dSDimitry Andric 24*bdd1243dSDimitry Andricdef HasStdExtMOrZmmul 25*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtM() || Subtarget->hasStdExtZmmul()">, 26*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtM, FeatureStdExtZmmul), 27*bdd1243dSDimitry Andric "'M' (Integer Multiplication and Division) or " 28*bdd1243dSDimitry Andric "'Zmmul' (Integer Multiplication)">; 29*bdd1243dSDimitry Andric 30*bdd1243dSDimitry Andricdef FeatureStdExtA 31*bdd1243dSDimitry Andric : SubtargetFeature<"a", "HasStdExtA", "true", 32*bdd1243dSDimitry Andric "'A' (Atomic Instructions)">; 33*bdd1243dSDimitry Andricdef HasStdExtA : Predicate<"Subtarget->hasStdExtA()">, 34*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtA), 35*bdd1243dSDimitry Andric "'A' (Atomic Instructions)">; 36*bdd1243dSDimitry Andric 37*bdd1243dSDimitry Andricdef FeatureStdExtF 38*bdd1243dSDimitry Andric : SubtargetFeature<"f", "HasStdExtF", "true", 39*bdd1243dSDimitry Andric "'F' (Single-Precision Floating-Point)">; 40*bdd1243dSDimitry Andricdef HasStdExtF : Predicate<"Subtarget->hasStdExtF()">, 41*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtF), 42*bdd1243dSDimitry Andric "'F' (Single-Precision Floating-Point)">; 43*bdd1243dSDimitry Andric 44*bdd1243dSDimitry Andricdef FeatureStdExtD 45*bdd1243dSDimitry Andric : SubtargetFeature<"d", "HasStdExtD", "true", 46*bdd1243dSDimitry Andric "'D' (Double-Precision Floating-Point)", 47*bdd1243dSDimitry Andric [FeatureStdExtF]>; 48*bdd1243dSDimitry Andricdef HasStdExtD : Predicate<"Subtarget->hasStdExtD()">, 49*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtD), 50*bdd1243dSDimitry Andric "'D' (Double-Precision Floating-Point)">; 51*bdd1243dSDimitry Andric 52*bdd1243dSDimitry Andricdef FeatureStdExtH 53*bdd1243dSDimitry Andric : SubtargetFeature<"h", "HasStdExtH", "true", 54*bdd1243dSDimitry Andric "'H' (Hypervisor)">; 55*bdd1243dSDimitry Andric 56*bdd1243dSDimitry Andricdef HasStdExtH : Predicate<"Subtarget->hasStdExtH()">, 57*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtH), 58*bdd1243dSDimitry Andric "'H' (Hypervisor)">; 59*bdd1243dSDimitry Andric 60*bdd1243dSDimitry Andricdef FeatureStdExtZihintpause 61*bdd1243dSDimitry Andric : SubtargetFeature<"zihintpause", "HasStdExtZihintpause", "true", 62*bdd1243dSDimitry Andric "'zihintpause' (Pause Hint)">; 63*bdd1243dSDimitry Andricdef HasStdExtZihintpause : Predicate<"Subtarget->hasStdExtZihintpause()">, 64*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZihintpause), 65*bdd1243dSDimitry Andric "'Zihintpause' (Pause Hint)">; 66*bdd1243dSDimitry Andric 67*bdd1243dSDimitry Andricdef FeatureStdExtZihintntl 68*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-zihintntl", "HasStdExtZihintntl", "true", 69*bdd1243dSDimitry Andric "'zihintntl' (Non-Temporal Locality Hints)">; 70*bdd1243dSDimitry Andricdef HasStdExtZihintntl : Predicate<"Subtarget->hasStdExtZihintntl()">, 71*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZihintntl), 72*bdd1243dSDimitry Andric "'Zihintntl' (Non-Temporal Locality Hints)">; 73*bdd1243dSDimitry Andric 74*bdd1243dSDimitry Andricdef FeatureStdExtZfhmin 75*bdd1243dSDimitry Andric : SubtargetFeature<"zfhmin", "HasStdExtZfhmin", "true", 76*bdd1243dSDimitry Andric "'Zfhmin' (Half-Precision Floating-Point Minimal)", 77*bdd1243dSDimitry Andric [FeatureStdExtF]>; 78*bdd1243dSDimitry Andricdef HasStdExtZfhmin : Predicate<"Subtarget->hasStdExtZfhmin()">, 79*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfhmin), 80*bdd1243dSDimitry Andric "'Zfhmin' (Half-Precision Floating-Point Minimal)">; 81*bdd1243dSDimitry Andric 82*bdd1243dSDimitry Andricdef FeatureStdExtZfh 83*bdd1243dSDimitry Andric : SubtargetFeature<"zfh", "HasStdExtZfh", "true", 84*bdd1243dSDimitry Andric "'Zfh' (Half-Precision Floating-Point)", 85*bdd1243dSDimitry Andric [FeatureStdExtF]>; 86*bdd1243dSDimitry Andricdef HasStdExtZfh : Predicate<"Subtarget->hasStdExtZfh()">, 87*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfh), 88*bdd1243dSDimitry Andric "'Zfh' (Half-Precision Floating-Point)">; 89*bdd1243dSDimitry Andricdef NoStdExtZfh : Predicate<"!Subtarget->hasStdExtZfh()">; 90*bdd1243dSDimitry Andric 91*bdd1243dSDimitry Andricdef HasStdExtZfhOrZfhmin 92*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtZfh() || Subtarget->hasStdExtZfhmin()">, 93*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZfh, FeatureStdExtZfhmin), 94*bdd1243dSDimitry Andric "'Zfh' (Half-Precision Floating-Point) or " 95*bdd1243dSDimitry Andric "'Zfhmin' (Half-Precision Floating-Point Minimal)">; 96*bdd1243dSDimitry Andric 97*bdd1243dSDimitry Andricdef FeatureStdExtZfinx 98*bdd1243dSDimitry Andric : SubtargetFeature<"zfinx", "HasStdExtZfinx", "true", 99*bdd1243dSDimitry Andric "'Zfinx' (Float in Integer)">; 100*bdd1243dSDimitry Andricdef HasStdExtZfinx : Predicate<"Subtarget->hasStdExtZfinx()">, 101*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZfinx), 102*bdd1243dSDimitry Andric "'Zfinx' (Float in Integer)">; 103*bdd1243dSDimitry Andric 104*bdd1243dSDimitry Andricdef FeatureStdExtZdinx 105*bdd1243dSDimitry Andric : SubtargetFeature<"zdinx", "HasStdExtZdinx", "true", 106*bdd1243dSDimitry Andric "'Zdinx' (Double in Integer)", 107*bdd1243dSDimitry Andric [FeatureStdExtZfinx]>; 108*bdd1243dSDimitry Andricdef HasStdExtZdinx : Predicate<"Subtarget->hasStdExtZdinx()">, 109*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZdinx), 110*bdd1243dSDimitry Andric "'Zdinx' (Double in Integer)">; 111*bdd1243dSDimitry Andric 112*bdd1243dSDimitry Andricdef FeatureStdExtZhinxmin 113*bdd1243dSDimitry Andric : SubtargetFeature<"zhinxmin", "HasStdExtZhinxmin", "true", 114*bdd1243dSDimitry Andric "'Zhinxmin' (Half Float in Integer Minimal)", 115*bdd1243dSDimitry Andric [FeatureStdExtZfinx]>; 116*bdd1243dSDimitry Andricdef HasStdExtZhinxmin : Predicate<"Subtarget->hasStdExtZhinxmin()">, 117*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZhinxmin), 118*bdd1243dSDimitry Andric "'Zhinxmin' (Half Float in Integer Minimal)">; 119*bdd1243dSDimitry Andric 120*bdd1243dSDimitry Andricdef FeatureStdExtZhinx 121*bdd1243dSDimitry Andric : SubtargetFeature<"zhinx", "HasStdExtZhinx", "true", 122*bdd1243dSDimitry Andric "'Zhinx' (Half Float in Integer)", 123*bdd1243dSDimitry Andric [FeatureStdExtZfinx]>; 124*bdd1243dSDimitry Andricdef HasStdExtZhinx : Predicate<"Subtarget->hasStdExtZhinx()">, 125*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZhinx), 126*bdd1243dSDimitry Andric "'Zhinx' (Half Float in Integer)">; 127*bdd1243dSDimitry Andric 128*bdd1243dSDimitry Andricdef HasStdExtZhinxOrZhinxmin 129*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtZhinx() || Subtarget->hasStdExtZhinxmin()">, 130*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZhinx, FeatureStdExtZhinxmin), 131*bdd1243dSDimitry Andric "'Zhinx' (Half Float in Integer) or " 132*bdd1243dSDimitry Andric "'Zhinxmin' (Half Float in Integer Minimal)">; 133*bdd1243dSDimitry Andric 134*bdd1243dSDimitry Andricdef FeatureStdExtC 135*bdd1243dSDimitry Andric : SubtargetFeature<"c", "HasStdExtC", "true", 136*bdd1243dSDimitry Andric "'C' (Compressed Instructions)">; 137*bdd1243dSDimitry Andricdef HasStdExtC : Predicate<"Subtarget->hasStdExtC()">, 138*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtC), 139*bdd1243dSDimitry Andric "'C' (Compressed Instructions)">; 140*bdd1243dSDimitry Andric 141*bdd1243dSDimitry Andricdef FeatureStdExtZba 142*bdd1243dSDimitry Andric : SubtargetFeature<"zba", "HasStdExtZba", "true", 143*bdd1243dSDimitry Andric "'Zba' (Address Generation Instructions)">; 144*bdd1243dSDimitry Andricdef HasStdExtZba : Predicate<"Subtarget->hasStdExtZba()">, 145*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZba), 146*bdd1243dSDimitry Andric "'Zba' (Address Generation Instructions)">; 147*bdd1243dSDimitry Andricdef NotHasStdExtZba : Predicate<"!Subtarget->hasStdExtZba()">; 148*bdd1243dSDimitry Andric 149*bdd1243dSDimitry Andricdef FeatureStdExtZbb 150*bdd1243dSDimitry Andric : SubtargetFeature<"zbb", "HasStdExtZbb", "true", 151*bdd1243dSDimitry Andric "'Zbb' (Basic Bit-Manipulation)">; 152*bdd1243dSDimitry Andricdef HasStdExtZbb : Predicate<"Subtarget->hasStdExtZbb()">, 153*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbb), 154*bdd1243dSDimitry Andric "'Zbb' (Basic Bit-Manipulation)">; 155*bdd1243dSDimitry Andric 156*bdd1243dSDimitry Andricdef FeatureStdExtZbc 157*bdd1243dSDimitry Andric : SubtargetFeature<"zbc", "HasStdExtZbc", "true", 158*bdd1243dSDimitry Andric "'Zbc' (Carry-Less Multiplication)">; 159*bdd1243dSDimitry Andricdef HasStdExtZbc : Predicate<"Subtarget->hasStdExtZbc()">, 160*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbc), 161*bdd1243dSDimitry Andric "'Zbc' (Carry-Less Multiplication)">; 162*bdd1243dSDimitry Andric 163*bdd1243dSDimitry Andricdef FeatureStdExtZbs 164*bdd1243dSDimitry Andric : SubtargetFeature<"zbs", "HasStdExtZbs", "true", 165*bdd1243dSDimitry Andric "'Zbs' (Single-Bit Instructions)">; 166*bdd1243dSDimitry Andricdef HasStdExtZbs : Predicate<"Subtarget->hasStdExtZbs()">, 167*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbs), 168*bdd1243dSDimitry Andric "'Zbs' (Single-Bit Instructions)">; 169*bdd1243dSDimitry Andric 170*bdd1243dSDimitry Andricdef FeatureStdExtZbkb 171*bdd1243dSDimitry Andric : SubtargetFeature<"zbkb", "HasStdExtZbkb", "true", 172*bdd1243dSDimitry Andric "'Zbkb' (Bitmanip instructions for Cryptography)">; 173*bdd1243dSDimitry Andricdef HasStdExtZbkb : Predicate<"Subtarget->hasStdExtZbkb()">, 174*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbkb), 175*bdd1243dSDimitry Andric "'Zbkb' (Bitmanip instructions for Cryptography)">; 176*bdd1243dSDimitry Andric 177*bdd1243dSDimitry Andricdef FeatureStdExtZbkx 178*bdd1243dSDimitry Andric : SubtargetFeature<"zbkx", "HasStdExtZbkx", "true", 179*bdd1243dSDimitry Andric "'Zbkx' (Crossbar permutation instructions)">; 180*bdd1243dSDimitry Andricdef HasStdExtZbkx : Predicate<"Subtarget->hasStdExtZbkx()">, 181*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbkx), 182*bdd1243dSDimitry Andric "'Zbkx' (Crossbar permutation instructions)">; 183*bdd1243dSDimitry Andric 184*bdd1243dSDimitry Andricdef HasStdExtZbbOrZbkb 185*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtZbb() || Subtarget->hasStdExtZbkb()">, 186*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZbb, FeatureStdExtZbkb), 187*bdd1243dSDimitry Andric "'Zbb' (Basic Bit-Manipulation) or " 188*bdd1243dSDimitry Andric "'Zbkb' (Bitmanip instructions for Cryptography)">; 189*bdd1243dSDimitry Andric 190*bdd1243dSDimitry Andric// The Carry-less multiply subextension for cryptography is a subset of basic 191*bdd1243dSDimitry Andric// carry-less multiply subextension. The former should be enabled if the latter 192*bdd1243dSDimitry Andric// is enabled. 193*bdd1243dSDimitry Andricdef FeatureStdExtZbkc 194*bdd1243dSDimitry Andric : SubtargetFeature<"zbkc", "HasStdExtZbkc", "true", 195*bdd1243dSDimitry Andric "'Zbkc' (Carry-less multiply instructions for " 196*bdd1243dSDimitry Andric "Cryptography)">; 197*bdd1243dSDimitry Andricdef HasStdExtZbkc 198*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtZbkc()">, 199*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZbkc), 200*bdd1243dSDimitry Andric "'Zbkc' (Carry-less multiply instructions for Cryptography)">; 201*bdd1243dSDimitry Andric 202*bdd1243dSDimitry Andricdef HasStdExtZbcOrZbkc 203*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtZbc() || Subtarget->hasStdExtZbkc()">, 204*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZbc, FeatureStdExtZbkc), 205*bdd1243dSDimitry Andric "'Zbc' (Carry-Less Multiplication) or " 206*bdd1243dSDimitry Andric "'Zbkc' (Carry-less multiply instructions " 207*bdd1243dSDimitry Andric "for Cryptography)">; 208*bdd1243dSDimitry Andric 209*bdd1243dSDimitry Andricdef FeatureStdExtZknd 210*bdd1243dSDimitry Andric : SubtargetFeature<"zknd", "HasStdExtZknd", "true", 211*bdd1243dSDimitry Andric "'Zknd' (NIST Suite: AES Decryption)">; 212*bdd1243dSDimitry Andricdef HasStdExtZknd : Predicate<"Subtarget->hasStdExtZknd()">, 213*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZknd), 214*bdd1243dSDimitry Andric "'Zknd' (NIST Suite: AES Decryption)">; 215*bdd1243dSDimitry Andric 216*bdd1243dSDimitry Andricdef FeatureStdExtZkne 217*bdd1243dSDimitry Andric : SubtargetFeature<"zkne", "HasStdExtZkne", "true", 218*bdd1243dSDimitry Andric "'Zkne' (NIST Suite: AES Encryption)">; 219*bdd1243dSDimitry Andricdef HasStdExtZkne : Predicate<"Subtarget->hasStdExtZkne()">, 220*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZkne), 221*bdd1243dSDimitry Andric "'Zkne' (NIST Suite: AES Encryption)">; 222*bdd1243dSDimitry Andric 223*bdd1243dSDimitry Andric// Some instructions belong to both Zknd and Zkne subextensions. 224*bdd1243dSDimitry Andric// They should be enabled if either has been specified. 225*bdd1243dSDimitry Andricdef HasStdExtZkndOrZkne 226*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtZknd() || Subtarget->hasStdExtZkne()">, 227*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtZknd, FeatureStdExtZkne), 228*bdd1243dSDimitry Andric "'Zknd' (NIST Suite: AES Decryption) or " 229*bdd1243dSDimitry Andric "'Zkne' (NIST Suite: AES Encryption)">; 230*bdd1243dSDimitry Andric 231*bdd1243dSDimitry Andricdef FeatureStdExtZknh 232*bdd1243dSDimitry Andric : SubtargetFeature<"zknh", "HasStdExtZknh", "true", 233*bdd1243dSDimitry Andric "'Zknh' (NIST Suite: Hash Function Instructions)">; 234*bdd1243dSDimitry Andricdef HasStdExtZknh : Predicate<"Subtarget->hasStdExtZknh()">, 235*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZknh), 236*bdd1243dSDimitry Andric "'Zknh' (NIST Suite: Hash Function Instructions)">; 237*bdd1243dSDimitry Andric 238*bdd1243dSDimitry Andricdef FeatureStdExtZksed 239*bdd1243dSDimitry Andric : SubtargetFeature<"zksed", "HasStdExtZksed", "true", 240*bdd1243dSDimitry Andric "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)">; 241*bdd1243dSDimitry Andricdef HasStdExtZksed : Predicate<"Subtarget->hasStdExtZksed()">, 242*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZksed), 243*bdd1243dSDimitry Andric "'Zksed' (ShangMi Suite: SM4 Block Cipher Instructions)">; 244*bdd1243dSDimitry Andric 245*bdd1243dSDimitry Andricdef FeatureStdExtZksh 246*bdd1243dSDimitry Andric : SubtargetFeature<"zksh", "HasStdExtZksh", "true", 247*bdd1243dSDimitry Andric "'Zksh' (ShangMi Suite: SM3 Hash Function Instructions)">; 248*bdd1243dSDimitry Andricdef HasStdExtZksh : Predicate<"Subtarget->hasStdExtZksh()">, 249*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZksh), 250*bdd1243dSDimitry Andric "'Zksh' (ShangMi Suite: SM3 Hash Function " 251*bdd1243dSDimitry Andric "Instructions)">; 252*bdd1243dSDimitry Andric 253*bdd1243dSDimitry Andricdef FeatureStdExtZkr 254*bdd1243dSDimitry Andric : SubtargetFeature<"zkr", "HasStdExtZkr", "true", 255*bdd1243dSDimitry Andric "'Zkr' (Entropy Source Extension)">; 256*bdd1243dSDimitry Andricdef HasStdExtZkr : Predicate<"Subtarget->hasStdExtZkr()">, 257*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZkr), 258*bdd1243dSDimitry Andric "'Zkr' (Entropy Source Extension)">; 259*bdd1243dSDimitry Andric 260*bdd1243dSDimitry Andricdef FeatureStdExtZkn 261*bdd1243dSDimitry Andric : SubtargetFeature<"zkn", "HasStdExtZkn", "true", 262*bdd1243dSDimitry Andric "'Zkn' (NIST Algorithm Suite)", 263*bdd1243dSDimitry Andric [FeatureStdExtZbkb, 264*bdd1243dSDimitry Andric FeatureStdExtZbkc, 265*bdd1243dSDimitry Andric FeatureStdExtZbkx, 266*bdd1243dSDimitry Andric FeatureStdExtZkne, 267*bdd1243dSDimitry Andric FeatureStdExtZknd, 268*bdd1243dSDimitry Andric FeatureStdExtZknh]>; 269*bdd1243dSDimitry Andric 270*bdd1243dSDimitry Andricdef FeatureStdExtZks 271*bdd1243dSDimitry Andric : SubtargetFeature<"zks", "HasStdExtZks", "true", 272*bdd1243dSDimitry Andric "'Zks' (ShangMi Algorithm Suite)", 273*bdd1243dSDimitry Andric [FeatureStdExtZbkb, 274*bdd1243dSDimitry Andric FeatureStdExtZbkc, 275*bdd1243dSDimitry Andric FeatureStdExtZbkx, 276*bdd1243dSDimitry Andric FeatureStdExtZksed, 277*bdd1243dSDimitry Andric FeatureStdExtZksh]>; 278*bdd1243dSDimitry Andric 279*bdd1243dSDimitry Andricdef FeatureStdExtZkt 280*bdd1243dSDimitry Andric : SubtargetFeature<"zkt", "HasStdExtZkt", "true", 281*bdd1243dSDimitry Andric "'Zkt' (Data Independent Execution Latency)">; 282*bdd1243dSDimitry Andric 283*bdd1243dSDimitry Andricdef FeatureStdExtZk 284*bdd1243dSDimitry Andric : SubtargetFeature<"zk", "HasStdExtZk", "true", 285*bdd1243dSDimitry Andric "'Zk' (Standard scalar cryptography extension)", 286*bdd1243dSDimitry Andric [FeatureStdExtZkn, 287*bdd1243dSDimitry Andric FeatureStdExtZkr, 288*bdd1243dSDimitry Andric FeatureStdExtZkt]>; 289*bdd1243dSDimitry Andric 290*bdd1243dSDimitry Andricdef FeatureExtZca 291*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-zca", "HasStdExtZca", "true", 292*bdd1243dSDimitry Andric "'Zca' (part of the C extension, excluding compressed " 293*bdd1243dSDimitry Andric "floating point loads/stores)">; 294*bdd1243dSDimitry Andric 295*bdd1243dSDimitry Andricdef HasStdExtCOrZca 296*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtC() || Subtarget->hasStdExtZca()">, 297*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtC, FeatureExtZca), 298*bdd1243dSDimitry Andric "'C' (Compressed Instructions) or " 299*bdd1243dSDimitry Andric "'Zca' (part of the C extension, excluding " 300*bdd1243dSDimitry Andric "compressed floating point loads/stores)">; 301*bdd1243dSDimitry Andric 302*bdd1243dSDimitry Andricdef FeatureExtZcd 303*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-zcd", "HasStdExtZcd", "true", 304*bdd1243dSDimitry Andric "'Zcd' (Compressed Double-Precision Floating-Point Instructions)">; 305*bdd1243dSDimitry Andric 306*bdd1243dSDimitry Andricdef HasStdExtCOrZcd 307*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtC() || Subtarget->hasStdExtZcd()">, 308*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtC, FeatureExtZcd), 309*bdd1243dSDimitry Andric "'C' (Compressed Instructions) or " 310*bdd1243dSDimitry Andric "'Zcd' (Compressed Double-Precision Floating-Point Instructions)">; 311*bdd1243dSDimitry Andric 312*bdd1243dSDimitry Andricdef FeatureExtZcf 313*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-zcf", "HasStdExtZcf", "true", 314*bdd1243dSDimitry Andric "'Zcf' (Compressed Single-Precision Floating-Point Instructions)">; 315*bdd1243dSDimitry Andric 316*bdd1243dSDimitry Andricdef HasStdExtCOrZcf 317*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtC() || Subtarget->hasStdExtZcf()">, 318*bdd1243dSDimitry Andric AssemblerPredicate<(any_of FeatureStdExtC, FeatureExtZcf), 319*bdd1243dSDimitry Andric "'C' (Compressed Instructions) or " 320*bdd1243dSDimitry Andric "'Zcf' (Compressed Single-Precision Floating-Point Instructions)">; 321*bdd1243dSDimitry Andric 322*bdd1243dSDimitry Andricdef FeatureNoRVCHints 323*bdd1243dSDimitry Andric : SubtargetFeature<"no-rvc-hints", "EnableRVCHintInstrs", "false", 324*bdd1243dSDimitry Andric "Disable RVC Hint Instructions.">; 325*bdd1243dSDimitry Andricdef HasRVCHints : Predicate<"Subtarget->enableRVCHintInstrs()">, 326*bdd1243dSDimitry Andric AssemblerPredicate<(all_of(not FeatureNoRVCHints)), 327*bdd1243dSDimitry Andric "RVC Hint Instructions">; 328*bdd1243dSDimitry Andric 329*bdd1243dSDimitry Andricdef FeatureStdExtZvl32b : SubtargetFeature<"zvl32b", "ZvlLen", "32", 330*bdd1243dSDimitry Andric "'Zvl' (Minimum Vector Length) 32">; 331*bdd1243dSDimitry Andric 332*bdd1243dSDimitry Andricforeach i = { 6-16 } in { 333*bdd1243dSDimitry Andric defvar I = !shl(1, i); 334*bdd1243dSDimitry Andric def FeatureStdExtZvl#I#b : 335*bdd1243dSDimitry Andric SubtargetFeature<"zvl"#I#"b", "ZvlLen", !cast<string>(I), 336*bdd1243dSDimitry Andric "'Zvl' (Minimum Vector Length) "#I, 337*bdd1243dSDimitry Andric [!cast<SubtargetFeature>("FeatureStdExtZvl"#!srl(I, 1)#"b")]>; 338*bdd1243dSDimitry Andric} 339*bdd1243dSDimitry Andric 340*bdd1243dSDimitry Andricdef FeatureStdExtZve32x 341*bdd1243dSDimitry Andric : SubtargetFeature<"zve32x", "HasStdExtZve32x", "true", 342*bdd1243dSDimitry Andric "'Zve32x' (Vector Extensions for Embedded Processors " 343*bdd1243dSDimitry Andric "with maximal 32 EEW)", 344*bdd1243dSDimitry Andric [FeatureStdExtZvl32b]>; 345*bdd1243dSDimitry Andric 346*bdd1243dSDimitry Andricdef FeatureStdExtZve32f 347*bdd1243dSDimitry Andric : SubtargetFeature<"zve32f", "HasStdExtZve32f", "true", 348*bdd1243dSDimitry Andric "'Zve32f' (Vector Extensions for Embedded Processors " 349*bdd1243dSDimitry Andric "with maximal 32 EEW and F extension)", 350*bdd1243dSDimitry Andric [FeatureStdExtZve32x]>; 351*bdd1243dSDimitry Andric 352*bdd1243dSDimitry Andricdef FeatureStdExtZve64x 353*bdd1243dSDimitry Andric : SubtargetFeature<"zve64x", "HasStdExtZve64x", "true", 354*bdd1243dSDimitry Andric "'Zve64x' (Vector Extensions for Embedded Processors " 355*bdd1243dSDimitry Andric "with maximal 64 EEW)", 356*bdd1243dSDimitry Andric [FeatureStdExtZve32x, FeatureStdExtZvl64b]>; 357*bdd1243dSDimitry Andric 358*bdd1243dSDimitry Andricdef FeatureStdExtZve64f 359*bdd1243dSDimitry Andric : SubtargetFeature<"zve64f", "HasStdExtZve64f", "true", 360*bdd1243dSDimitry Andric "'Zve64f' (Vector Extensions for Embedded Processors " 361*bdd1243dSDimitry Andric "with maximal 64 EEW and F extension)", 362*bdd1243dSDimitry Andric [FeatureStdExtZve32f, FeatureStdExtZve64x]>; 363*bdd1243dSDimitry Andric 364*bdd1243dSDimitry Andricdef FeatureStdExtZve64d 365*bdd1243dSDimitry Andric : SubtargetFeature<"zve64d", "HasStdExtZve64d", "true", 366*bdd1243dSDimitry Andric "'Zve64d' (Vector Extensions for Embedded Processors " 367*bdd1243dSDimitry Andric "with maximal 64 EEW, F and D extension)", 368*bdd1243dSDimitry Andric [FeatureStdExtZve64f]>; 369*bdd1243dSDimitry Andric 370*bdd1243dSDimitry Andricdef FeatureStdExtV 371*bdd1243dSDimitry Andric : SubtargetFeature<"v", "HasStdExtV", "true", 372*bdd1243dSDimitry Andric "'V' (Vector Extension for Application Processors)", 373*bdd1243dSDimitry Andric [FeatureStdExtZvl128b, FeatureStdExtZve64d, 374*bdd1243dSDimitry Andric FeatureStdExtF, FeatureStdExtD]>; 375*bdd1243dSDimitry Andric 376*bdd1243dSDimitry Andricdef HasVInstructions : Predicate<"Subtarget->hasVInstructions()">, 377*bdd1243dSDimitry Andric AssemblerPredicate< 378*bdd1243dSDimitry Andric (any_of FeatureStdExtZve32x), 379*bdd1243dSDimitry Andric "'V' (Vector Extension for Application Processors), 'Zve32x' or " 380*bdd1243dSDimitry Andric "'Zve64x' (Vector Extensions for Embedded Processors)">; 381*bdd1243dSDimitry Andricdef HasVInstructionsI64 : Predicate<"Subtarget->hasVInstructionsI64()">, 382*bdd1243dSDimitry Andric AssemblerPredicate< 383*bdd1243dSDimitry Andric (any_of FeatureStdExtZve64x), 384*bdd1243dSDimitry Andric "'V' (Vector Extension for Application Processors) or 'Zve64x' " 385*bdd1243dSDimitry Andric "(Vector Extensions for Embedded Processors)">; 386*bdd1243dSDimitry Andricdef HasVInstructionsAnyF : Predicate<"Subtarget->hasVInstructionsAnyF()">, 387*bdd1243dSDimitry Andric AssemblerPredicate< 388*bdd1243dSDimitry Andric (any_of FeatureStdExtZve32f), 389*bdd1243dSDimitry Andric "'V' (Vector Extension for Application Processors), 'Zve32f', " 390*bdd1243dSDimitry Andric "'Zve64f' or 'Zve64d' (Vector Extensions for Embedded Processors)">; 391*bdd1243dSDimitry Andric 392*bdd1243dSDimitry Andricdef FeatureStdExtZvfh 393*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-zvfh", "HasStdExtZvfh", "true", 394*bdd1243dSDimitry Andric "'Zvfh' (Vector Half-Precision Floating-Point)", 395*bdd1243dSDimitry Andric [FeatureStdExtZve32f]>; 396*bdd1243dSDimitry Andric 397*bdd1243dSDimitry Andricdef FeatureStdExtZicbom 398*bdd1243dSDimitry Andric : SubtargetFeature<"zicbom", "HasStdExtZicbom", "true", 399*bdd1243dSDimitry Andric "'Zicbom' (Cache-Block Management Instructions)">; 400*bdd1243dSDimitry Andricdef HasStdExtZicbom : Predicate<"Subtarget->hasStdExtZicbom()">, 401*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicbom), 402*bdd1243dSDimitry Andric "'Zicbom' (Cache-Block Management Instructions)">; 403*bdd1243dSDimitry Andric 404*bdd1243dSDimitry Andricdef FeatureStdExtZicboz 405*bdd1243dSDimitry Andric : SubtargetFeature<"zicboz", "HasStdExtZicboz", "true", 406*bdd1243dSDimitry Andric "'Zicboz' (Cache-Block Zero Instructions)">; 407*bdd1243dSDimitry Andricdef HasStdExtZicboz : Predicate<"Subtarget->hasStdExtZicboz()">, 408*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicboz), 409*bdd1243dSDimitry Andric "'Zicboz' (Cache-Block Zero Instructions)">; 410*bdd1243dSDimitry Andric 411*bdd1243dSDimitry Andricdef FeatureStdExtZicbop 412*bdd1243dSDimitry Andric : SubtargetFeature<"zicbop", "HasStdExtZicbop", "true", 413*bdd1243dSDimitry Andric "'Zicbop' (Cache-Block Prefetch Instructions)">; 414*bdd1243dSDimitry Andricdef HasStdExtZicbop : Predicate<"Subtarget->hasStdExtZicbop()">, 415*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZicbop), 416*bdd1243dSDimitry Andric "'Zicbop' (Cache-Block Prefetch Instructions)">; 417*bdd1243dSDimitry Andric 418*bdd1243dSDimitry Andricdef FeatureStdExtSvnapot 419*bdd1243dSDimitry Andric : SubtargetFeature<"svnapot", "HasStdExtSvnapot", "true", 420*bdd1243dSDimitry Andric "'Svnapot' (NAPOT Translation Contiguity)">; 421*bdd1243dSDimitry Andric 422*bdd1243dSDimitry Andricdef FeatureStdExtSvpbmt 423*bdd1243dSDimitry Andric : SubtargetFeature<"svpbmt", "HasStdExtSvpbmt", "true", 424*bdd1243dSDimitry Andric "'Svpbmt' (Page-Based Memory Types)">; 425*bdd1243dSDimitry Andric 426*bdd1243dSDimitry Andricdef FeatureStdExtSvinval 427*bdd1243dSDimitry Andric : SubtargetFeature<"svinval", "HasStdExtSvinval", "true", 428*bdd1243dSDimitry Andric "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)">; 429*bdd1243dSDimitry Andricdef HasStdExtSvinval : Predicate<"Subtarget->hasStdExtSvinval()">, 430*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtSvinval), 431*bdd1243dSDimitry Andric "'Svinval' (Fine-Grained Address-Translation Cache Invalidation)">; 432*bdd1243dSDimitry Andric 433*bdd1243dSDimitry Andricdef FeatureStdExtZtso 434*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-ztso", "HasStdExtZtso", "true", 435*bdd1243dSDimitry Andric "'Ztso' (Memory Model - Total Store Order)">; 436*bdd1243dSDimitry Andricdef HasStdExtZtso : Predicate<"Subtarget->hasStdExtZTso()">, 437*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZtso), 438*bdd1243dSDimitry Andric "'Ztso' (Memory Model - Total Store Order)">; 439*bdd1243dSDimitry Andric 440*bdd1243dSDimitry Andricdef FeatureStdExtZawrs 441*bdd1243dSDimitry Andric : SubtargetFeature<"experimental-zawrs", "HasStdExtZawrs", "true", 442*bdd1243dSDimitry Andric "'Zawrs' (Wait on Reservation Set)">; 443*bdd1243dSDimitry Andricdef HasStdExtZawrs : Predicate<"Subtarget->hasStdExtZawrs()">, 444*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureStdExtZawrs), 445*bdd1243dSDimitry Andric "'Zawrs' (Wait on Reservation Set)">; 446*bdd1243dSDimitry Andric 447*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 448*bdd1243dSDimitry Andric// Vendor extensions 449*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 450*bdd1243dSDimitry Andric 451*bdd1243dSDimitry Andricdef FeatureVendorXVentanaCondOps 452*bdd1243dSDimitry Andric : SubtargetFeature<"xventanacondops", "HasVendorXVentanaCondOps", "true", 453*bdd1243dSDimitry Andric "'XVentanaCondOps' (Ventana Conditional Ops)">; 454*bdd1243dSDimitry Andricdef HasVendorXVentanaCondOps : Predicate<"Subtarget->hasVendorXVentanaCondOps()">, 455*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXVentanaCondOps), 456*bdd1243dSDimitry Andric "'XVentanaCondOps' (Ventana Conditional Ops)">; 457*bdd1243dSDimitry Andric 458*bdd1243dSDimitry Andricdef FeatureVendorXTHeadVdot 459*bdd1243dSDimitry Andric : SubtargetFeature<"xtheadvdot", "HasVendorXTHeadVdot", "true", 460*bdd1243dSDimitry Andric "'xtheadvdot' (T-Head Vector Extensions for Dot)", 461*bdd1243dSDimitry Andric [FeatureStdExtV]>; 462*bdd1243dSDimitry Andricdef HasVendorXTHeadVdot : Predicate<"Subtarget->hasVendorXTHeadVdot()">, 463*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureVendorXTHeadVdot), 464*bdd1243dSDimitry Andric "'xtheadvdot' (T-Head Vector Extensions for Dot)">; 465*bdd1243dSDimitry Andric 466*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 467*bdd1243dSDimitry Andric// LLVM specific features and extensions 468*bdd1243dSDimitry Andric//===----------------------------------------------------------------------===// 469*bdd1243dSDimitry Andric 470*bdd1243dSDimitry Andric// Feature32Bit exists to mark CPUs that support RV32 to distinquish them from 471*bdd1243dSDimitry Andric// tuning CPU names. 472*bdd1243dSDimitry Andricdef Feature32Bit 473*bdd1243dSDimitry Andric : SubtargetFeature<"32bit", "HasRV32", "true", "Implements RV32">; 474*bdd1243dSDimitry Andricdef Feature64Bit 475*bdd1243dSDimitry Andric : SubtargetFeature<"64bit", "HasRV64", "true", "Implements RV64">; 476*bdd1243dSDimitry Andricdef IsRV64 : Predicate<"Subtarget->is64Bit()">, 477*bdd1243dSDimitry Andric AssemblerPredicate<(all_of Feature64Bit), 478*bdd1243dSDimitry Andric "RV64I Base Instruction Set">; 479*bdd1243dSDimitry Andricdef IsRV32 : Predicate<"!Subtarget->is64Bit()">, 480*bdd1243dSDimitry Andric AssemblerPredicate<(all_of (not Feature64Bit)), 481*bdd1243dSDimitry Andric "RV32I Base Instruction Set">; 482*bdd1243dSDimitry Andric 483*bdd1243dSDimitry Andricdefvar RV32 = DefaultMode; 484*bdd1243dSDimitry Andricdef RV64 : HwMode<"+64bit">; 485*bdd1243dSDimitry Andric 486*bdd1243dSDimitry Andricdef FeatureRV32E 487*bdd1243dSDimitry Andric : SubtargetFeature<"e", "IsRV32E", "true", 488*bdd1243dSDimitry Andric "Implements RV32E (provides 16 rather than 32 GPRs)">; 489*bdd1243dSDimitry Andricdef IsRV32E : Predicate<"Subtarget->isRV32E()">, 490*bdd1243dSDimitry Andric AssemblerPredicate<(all_of FeatureRV32E)>; 491*bdd1243dSDimitry Andric 492*bdd1243dSDimitry Andricdef FeatureRelax 493*bdd1243dSDimitry Andric : SubtargetFeature<"relax", "EnableLinkerRelax", "true", 494*bdd1243dSDimitry Andric "Enable Linker relaxation.">; 495*bdd1243dSDimitry Andric 496*bdd1243dSDimitry Andricforeach i = {1-31} in 497*bdd1243dSDimitry Andric def FeatureReserveX#i : 498*bdd1243dSDimitry Andric SubtargetFeature<"reserve-x"#i, "UserReservedRegister[RISCV::X"#i#"]", 499*bdd1243dSDimitry Andric "true", "Reserve X"#i>; 500*bdd1243dSDimitry Andric 501*bdd1243dSDimitry Andricdef FeatureSaveRestore : SubtargetFeature<"save-restore", "EnableSaveRestore", 502*bdd1243dSDimitry Andric "true", "Enable save/restore.">; 503*bdd1243dSDimitry Andric 504*bdd1243dSDimitry Andricdef FeatureUnalignedScalarMem 505*bdd1243dSDimitry Andric : SubtargetFeature<"unaligned-scalar-mem", "EnableUnalignedScalarMem", 506*bdd1243dSDimitry Andric "true", "Has reasonably performant unaligned scalar " 507*bdd1243dSDimitry Andric "loads and stores">; 508*bdd1243dSDimitry Andric 509*bdd1243dSDimitry Andricdef TuneNoOptimizedZeroStrideLoad 510*bdd1243dSDimitry Andric : SubtargetFeature<"no-optimized-zero-stride-load", "HasOptimizedZeroStrideLoad", 511*bdd1243dSDimitry Andric "false", "Hasn't optimized (perform fewer memory operations)" 512*bdd1243dSDimitry Andric "zero-stride vector load">; 513*bdd1243dSDimitry Andric 514*bdd1243dSDimitry Andricdef TuneLUIADDIFusion 515*bdd1243dSDimitry Andric : SubtargetFeature<"lui-addi-fusion", "HasLUIADDIFusion", 516*bdd1243dSDimitry Andric "true", "Enable LUI+ADDI macrofusion">; 517*bdd1243dSDimitry Andric 518*bdd1243dSDimitry Andricdef TuneNoDefaultUnroll 519*bdd1243dSDimitry Andric : SubtargetFeature<"no-default-unroll", "EnableDefaultUnroll", "false", 520*bdd1243dSDimitry Andric "Disable default unroll preference.">; 521*bdd1243dSDimitry Andric 522*bdd1243dSDimitry Andric// SiFive 7 is able to fuse integer ALU operations with a preceding branch 523*bdd1243dSDimitry Andric// instruction. 524*bdd1243dSDimitry Andricdef TuneShortForwardBranchOpt 525*bdd1243dSDimitry Andric : SubtargetFeature<"short-forward-branch-opt", "HasShortForwardBranchOpt", 526*bdd1243dSDimitry Andric "true", "Enable short forward branch optimization">; 527*bdd1243dSDimitry Andricdef HasShortForwardBranchOpt : Predicate<"Subtarget->hasShortForwardBranchOpt()">; 528*bdd1243dSDimitry Andricdef NoShortForwardBranchOpt : Predicate<"!Subtarget->hasShortForwardBranchOpt()">; 529*bdd1243dSDimitry Andric 530*bdd1243dSDimitry Andricdef TuneSiFive7 : SubtargetFeature<"sifive7", "RISCVProcFamily", "SiFive7", 531*bdd1243dSDimitry Andric "SiFive 7-Series processors", 532*bdd1243dSDimitry Andric [TuneNoDefaultUnroll, 533*bdd1243dSDimitry Andric TuneShortForwardBranchOpt]>; 534*bdd1243dSDimitry Andric 535*bdd1243dSDimitry Andric// Assume that lock-free native-width atomics are available, even if the target 536*bdd1243dSDimitry Andric// and operating system combination would not usually provide them. The user 537*bdd1243dSDimitry Andric// is responsible for providing any necessary __sync implementations. Code 538*bdd1243dSDimitry Andric// built with this feature is not ABI-compatible with code built without this 539*bdd1243dSDimitry Andric// feature, if atomic variables are exposed across the ABI boundary. 540*bdd1243dSDimitry Andricdef FeatureForcedAtomics : SubtargetFeature< 541*bdd1243dSDimitry Andric "forced-atomics", "HasForcedAtomics", "true", 542*bdd1243dSDimitry Andric "Assume that lock-free native-width atomics are available">; 543*bdd1243dSDimitry Andricdef HasAtomicLdSt 544*bdd1243dSDimitry Andric : Predicate<"Subtarget->hasStdExtA() || Subtarget->hasForcedAtomics()">; 545*bdd1243dSDimitry Andric 546*bdd1243dSDimitry Andricdef FeatureTaggedGlobals : SubtargetFeature<"tagged-globals", 547*bdd1243dSDimitry Andric "AllowTaggedGlobals", 548*bdd1243dSDimitry Andric "true", "Use an instruction sequence for taking the address of a global " 549*bdd1243dSDimitry Andric "that allows a memory tag in the upper address bits">; 550