xref: /freebsd/contrib/llvm-project/llvm/lib/Target/X86/X86InstrPredicates.td (revision cb14a3fe5122c879eae1fb480ed7ce82a699ddb6)
1//===---X86InstrPredicates.td - X86 Predicate Definitions --*- tablegen -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9def TruePredicate : Predicate<"true">;
10
11def HasEGPR      : Predicate<"Subtarget->hasEGPR()">;
12def NoEGPR       : Predicate<"!Subtarget->hasEGPR()">;
13def HasCMOV      : Predicate<"Subtarget->canUseCMOV()">;
14def NoCMOV       : Predicate<"!Subtarget->canUseCMOV()">;
15def HasNOPL      : Predicate<"Subtarget->hasNOPL()">;
16def HasMMX       : Predicate<"Subtarget->hasMMX()">;
17def Has3DNow     : Predicate<"Subtarget->hasThreeDNow()">;
18def Has3DNowA    : Predicate<"Subtarget->hasThreeDNowA()">;
19def HasSSE1      : Predicate<"Subtarget->hasSSE1()">;
20def UseSSE1      : Predicate<"Subtarget->hasSSE1() && !Subtarget->hasAVX()">;
21def HasSSE2      : Predicate<"Subtarget->hasSSE2()">;
22def UseSSE2      : Predicate<"Subtarget->hasSSE2() && !Subtarget->hasAVX()">;
23def HasSSE3      : Predicate<"Subtarget->hasSSE3()">;
24def UseSSE3      : Predicate<"Subtarget->hasSSE3() && !Subtarget->hasAVX()">;
25def HasSSSE3     : Predicate<"Subtarget->hasSSSE3()">;
26def UseSSSE3     : Predicate<"Subtarget->hasSSSE3() && !Subtarget->hasAVX()">;
27def HasSSE41     : Predicate<"Subtarget->hasSSE41()">;
28def NoSSE41      : Predicate<"!Subtarget->hasSSE41()">;
29def UseSSE41     : Predicate<"Subtarget->hasSSE41() && !Subtarget->hasAVX()">;
30def HasSSE42     : Predicate<"Subtarget->hasSSE42()">;
31def UseSSE42     : Predicate<"Subtarget->hasSSE42() && !Subtarget->hasAVX()">;
32def HasSSE4A     : Predicate<"Subtarget->hasSSE4A()">;
33def NoAVX        : Predicate<"!Subtarget->hasAVX()">;
34def HasAVX       : Predicate<"Subtarget->hasAVX()">;
35def HasAVX2      : Predicate<"Subtarget->hasAVX2()">;
36def HasAVX1Only  : Predicate<"Subtarget->hasAVX() && !Subtarget->hasAVX2()">;
37def HasEVEX512   : Predicate<"Subtarget->hasEVEX512()">;
38def HasAVX10_1   : Predicate<"Subtarget->hasAVX10_1()">;
39def HasAVX10_1_512 : Predicate<"Subtarget->hasAVX10_1_512()">;
40def HasAVX512    : Predicate<"Subtarget->hasAVX512()">;
41def UseAVX       : Predicate<"Subtarget->hasAVX() && !Subtarget->hasAVX512()">;
42def UseAVX2      : Predicate<"Subtarget->hasAVX2() && !Subtarget->hasAVX512()">;
43def NoAVX512     : Predicate<"!Subtarget->hasAVX512()">;
44def HasCDI       : Predicate<"Subtarget->hasCDI()">;
45def HasVPOPCNTDQ : Predicate<"Subtarget->hasVPOPCNTDQ()">;
46def HasPFI       : Predicate<"Subtarget->hasPFI()">;
47def HasERI       : Predicate<"Subtarget->hasERI()">;
48def HasDQI       : Predicate<"Subtarget->hasDQI()">;
49def NoDQI        : Predicate<"!Subtarget->hasDQI()">;
50def HasBWI       : Predicate<"Subtarget->hasBWI()">;
51def NoBWI        : Predicate<"!Subtarget->hasBWI()">;
52def HasVLX       : Predicate<"Subtarget->hasVLX()">;
53def NoVLX        : Predicate<"!Subtarget->hasVLX()">;
54def NoVLX_Or_NoBWI : Predicate<"!Subtarget->hasVLX() || !Subtarget->hasBWI()">;
55def NoVLX_Or_NoDQI : Predicate<"!Subtarget->hasVLX() || !Subtarget->hasDQI()">;
56def HasPKU       : Predicate<"Subtarget->hasPKU()">;
57def HasVNNI      : Predicate<"Subtarget->hasVNNI()">;
58def HasVP2INTERSECT : Predicate<"Subtarget->hasVP2INTERSECT()">;
59def HasBF16      : Predicate<"Subtarget->hasBF16()">;
60def HasFP16      : Predicate<"Subtarget->hasFP16()">;
61def HasAVXVNNIINT16 : Predicate<"Subtarget->hasAVXVNNIINT16()">;
62def HasAVXVNNIINT8 : Predicate<"Subtarget->hasAVXVNNIINT8()">;
63def HasAVXVNNI : Predicate <"Subtarget->hasAVXVNNI()">;
64def NoVLX_Or_NoVNNI : Predicate<"!Subtarget->hasVLX() || !Subtarget->hasVNNI()">;
65
66def HasBITALG    : Predicate<"Subtarget->hasBITALG()">;
67def HasPOPCNT    : Predicate<"Subtarget->hasPOPCNT()">;
68def HasAES       : Predicate<"Subtarget->hasAES()">;
69def HasVAES      : Predicate<"Subtarget->hasVAES()">;
70def NoVLX_Or_NoVAES : Predicate<"!Subtarget->hasVLX() || !Subtarget->hasVAES()">;
71def HasFXSR      : Predicate<"Subtarget->hasFXSR()">;
72def HasX87       : Predicate<"Subtarget->hasX87()">;
73def HasXSAVE     : Predicate<"Subtarget->hasXSAVE()">;
74def HasXSAVEOPT  : Predicate<"Subtarget->hasXSAVEOPT()">;
75def HasXSAVEC    : Predicate<"Subtarget->hasXSAVEC()">;
76def HasXSAVES    : Predicate<"Subtarget->hasXSAVES()">;
77def HasPCLMUL    : Predicate<"Subtarget->hasPCLMUL()">;
78def NoVLX_Or_NoVPCLMULQDQ :
79                    Predicate<"!Subtarget->hasVLX() || !Subtarget->hasVPCLMULQDQ()">;
80def HasVPCLMULQDQ : Predicate<"Subtarget->hasVPCLMULQDQ()">;
81def HasGFNI      : Predicate<"Subtarget->hasGFNI()">;
82def HasFMA       : Predicate<"Subtarget->hasFMA()">;
83def HasFMA4      : Predicate<"Subtarget->hasFMA4()">;
84def NoFMA4       : Predicate<"!Subtarget->hasFMA4()">;
85def HasXOP       : Predicate<"Subtarget->hasXOP()">;
86def HasTBM       : Predicate<"Subtarget->hasTBM()">;
87def NoTBM        : Predicate<"!Subtarget->hasTBM()">;
88def HasLWP       : Predicate<"Subtarget->hasLWP()">;
89def HasMOVBE     : Predicate<"Subtarget->hasMOVBE()">;
90def HasRDRAND    : Predicate<"Subtarget->hasRDRAND()">;
91def HasF16C      : Predicate<"Subtarget->hasF16C()">;
92def HasFSGSBase  : Predicate<"Subtarget->hasFSGSBase()">;
93def HasLZCNT     : Predicate<"Subtarget->hasLZCNT()">;
94def HasBMI       : Predicate<"Subtarget->hasBMI()">;
95def HasBMI2      : Predicate<"Subtarget->hasBMI2()">;
96def NoBMI2       : Predicate<"!Subtarget->hasBMI2()">;
97def HasVBMI      : Predicate<"Subtarget->hasVBMI()">;
98def HasVBMI2     : Predicate<"Subtarget->hasVBMI2()">;
99def HasIFMA      : Predicate<"Subtarget->hasIFMA()">;
100def HasAVXIFMA   : Predicate<"Subtarget->hasAVXIFMA()">;
101def NoVLX_Or_NoIFMA : Predicate<"!Subtarget->hasVLX() || !Subtarget->hasIFMA()">;
102def HasRTM       : Predicate<"Subtarget->hasRTM()">;
103def HasADX       : Predicate<"Subtarget->hasADX()">;
104def HasSHA       : Predicate<"Subtarget->hasSHA()">;
105def HasSHA512    : Predicate<"Subtarget->hasSHA512()">;
106def HasSGX       : Predicate<"Subtarget->hasSGX()">;
107def HasSM3       : Predicate<"Subtarget->hasSM3()">;
108def HasRDSEED    : Predicate<"Subtarget->hasRDSEED()">;
109def HasSSEPrefetch : Predicate<"Subtarget->hasSSEPrefetch()">;
110def NoSSEPrefetch : Predicate<"!Subtarget->hasSSEPrefetch()">;
111def HasPRFCHW    : Predicate<"Subtarget->hasPRFCHW()">;
112def HasPREFETCHI : Predicate<"Subtarget->hasPREFETCHI()">;
113def HasPrefetchW : Predicate<"Subtarget->hasPrefetchW()">;
114def HasPREFETCHWT1 : Predicate<"Subtarget->hasPREFETCHWT1()">;
115def HasLAHFSAHF  : Predicate<"Subtarget->hasLAHFSAHF()">;
116def HasLAHFSAHF64 : Predicate<"Subtarget->hasLAHFSAHF64()">;
117def HasMWAITX    : Predicate<"Subtarget->hasMWAITX()">;
118def HasCLZERO    : Predicate<"Subtarget->hasCLZERO()">;
119def HasCLDEMOTE  : Predicate<"Subtarget->hasCLDEMOTE()">;
120def HasMOVDIRI   : Predicate<"Subtarget->hasMOVDIRI()">;
121def HasMOVDIR64B : Predicate<"Subtarget->hasMOVDIR64B()">;
122def HasPTWRITE   : Predicate<"Subtarget->hasPTWRITE()">;
123def FPStackf32   : Predicate<"!Subtarget->hasSSE1()">;
124def FPStackf64   : Predicate<"!Subtarget->hasSSE2()">;
125def HasSHSTK     : Predicate<"Subtarget->hasSHSTK()">;
126def HasSM4       : Predicate<"Subtarget->hasSM4()">;
127def HasCLFLUSH   : Predicate<"Subtarget->hasCLFLUSH()">;
128def HasCLFLUSHOPT : Predicate<"Subtarget->hasCLFLUSHOPT()">;
129def HasCLWB      : Predicate<"Subtarget->hasCLWB()">;
130def HasWBNOINVD  : Predicate<"Subtarget->hasWBNOINVD()">;
131def HasRDPID     : Predicate<"Subtarget->hasRDPID()">;
132def HasRDPRU     : Predicate<"Subtarget->hasRDPRU()">;
133def HasWAITPKG   : Predicate<"Subtarget->hasWAITPKG()">;
134def HasINVPCID   : Predicate<"Subtarget->hasINVPCID()">;
135def HasCX8       : Predicate<"Subtarget->hasCX8()">;
136def HasCX16      : Predicate<"Subtarget->hasCX16()">;
137def HasPCONFIG   : Predicate<"Subtarget->hasPCONFIG()">;
138def HasENQCMD    : Predicate<"Subtarget->hasENQCMD()">;
139def HasAMXFP16   : Predicate<"Subtarget->hasAMXFP16()">;
140def HasCMPCCXADD : Predicate<"Subtarget->hasCMPCCXADD()">;
141def HasAVXNECONVERT : Predicate<"Subtarget->hasAVXNECONVERT()">;
142def HasKL        : Predicate<"Subtarget->hasKL()">;
143def HasRAOINT    : Predicate<"Subtarget->hasRAOINT()">;
144def HasWIDEKL    : Predicate<"Subtarget->hasWIDEKL()">;
145def HasHRESET    : Predicate<"Subtarget->hasHRESET()">;
146def HasSERIALIZE : Predicate<"Subtarget->hasSERIALIZE()">;
147def HasTSXLDTRK  : Predicate<"Subtarget->hasTSXLDTRK()">;
148def HasAMXTILE   : Predicate<"Subtarget->hasAMXTILE()">;
149def HasAMXBF16   : Predicate<"Subtarget->hasAMXBF16()">;
150def HasAMXINT8   : Predicate<"Subtarget->hasAMXINT8()">;
151def HasAMXCOMPLEX : Predicate<"Subtarget->hasAMXCOMPLEX()">;
152def HasUINTR     : Predicate<"Subtarget->hasUINTR()">;
153def HasUSERMSR   : Predicate<"Subtarget->hasUSERMSR()">;
154def HasCRC32     : Predicate<"Subtarget->hasCRC32()">;
155
156def HasX86_64    : Predicate<"Subtarget->hasX86_64()">;
157def Not64BitMode : Predicate<"!Subtarget->is64Bit()">,
158                             AssemblerPredicate<(all_of (not Is64Bit)), "Not 64-bit mode">;
159def In64BitMode  : Predicate<"Subtarget->is64Bit()">,
160                             AssemblerPredicate<(all_of Is64Bit), "64-bit mode">;
161def IsLP64  : Predicate<"Subtarget->isTarget64BitLP64()">;
162def NotLP64 : Predicate<"!Subtarget->isTarget64BitLP64()">;
163def In16BitMode  : Predicate<"Subtarget->is16Bit()">,
164                             AssemblerPredicate<(all_of Is16Bit), "16-bit mode">;
165def Not16BitMode : Predicate<"!Subtarget->is16Bit()">,
166                             AssemblerPredicate<(all_of (not Is16Bit)), "Not 16-bit mode">;
167def In32BitMode  : Predicate<"Subtarget->is32Bit()">,
168                             AssemblerPredicate<(all_of Is32Bit), "32-bit mode">;
169def IsWin64      : Predicate<"Subtarget->isTargetWin64()">;
170def NotWin64     : Predicate<"!Subtarget->isTargetWin64()">;
171def NotWin64WithoutFP : Predicate<"!Subtarget->isTargetWin64() ||"
172                                  "Subtarget->getFrameLowering()->hasFP(*MF)"> {
173  let RecomputePerFunction = 1;
174}
175def IsPS         : Predicate<"Subtarget->isTargetPS()">;
176def NotPS        : Predicate<"!Subtarget->isTargetPS()">;
177def IsNaCl       : Predicate<"Subtarget->isTargetNaCl()">;
178def NotNaCl      : Predicate<"!Subtarget->isTargetNaCl()">;
179def SmallCode    : Predicate<"TM.getCodeModel() == CodeModel::Small">;
180def KernelCode   : Predicate<"TM.getCodeModel() == CodeModel::Kernel">;
181def NearData     : Predicate<"TM.getCodeModel() == CodeModel::Small ||"
182                             "TM.getCodeModel() == CodeModel::Kernel">;
183def IsNotPIC     : Predicate<"!TM.isPositionIndependent()">;
184
185// We could compute these on a per-module basis but doing so requires accessing
186// the Function object through the <Target>Subtarget and objections were raised
187// to that (see post-commit review comments for r301750).
188let RecomputePerFunction = 1 in {
189  def OptForSize   : Predicate<"shouldOptForSize(MF)">;
190  def OptForMinSize : Predicate<"MF->getFunction().hasMinSize()">;
191  def OptForSpeed  : Predicate<"!shouldOptForSize(MF)">;
192  def UseIncDec : Predicate<"!Subtarget->slowIncDec() || "
193                            "shouldOptForSize(MF)">;
194  def NoSSE41_Or_OptForSize : Predicate<"shouldOptForSize(MF) || "
195                                        "!Subtarget->hasSSE41()">;
196}
197
198def CallImmAddr  : Predicate<"Subtarget->isLegalToCallImmediateAddr()">;
199def FavorMemIndirectCall  : Predicate<"!Subtarget->slowTwoMemOps()">;
200def HasFastMem32 : Predicate<"!Subtarget->isUnalignedMem32Slow()">;
201def HasFastLZCNT : Predicate<"Subtarget->hasFastLZCNT()">;
202def HasFastSHLDRotate : Predicate<"Subtarget->hasFastSHLDRotate()">;
203def HasERMSB : Predicate<"Subtarget->hasERMSB()">;
204def HasFSRM : Predicate<"Subtarget->hasFSRM()">;
205def HasMFence    : Predicate<"Subtarget->hasMFence()">;
206def UseIndirectThunkCalls : Predicate<"Subtarget->useIndirectThunkCalls()">;
207def NotUseIndirectThunkCalls : Predicate<"!Subtarget->useIndirectThunkCalls()">;
208