[InstCombine] Signed saturation tests. NFC
[llvm-complete.git] / lib / Target / ARM / ARMPredicates.td
blobb008d3e2e29621ca42848866267657059271d17a
1 //===-- ARMPredicates.td - ARM Instruction Predicates ------*- 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 //===----------------------------------------------------------------------===//
9 def HasV4T           : Predicate<"Subtarget->hasV4TOps()">,
10                                  AssemblerPredicate<"HasV4TOps", "armv4t">;
11 def NoV4T            : Predicate<"!Subtarget->hasV4TOps()">;
12 def HasV5T           : Predicate<"Subtarget->hasV5TOps()">,
13                                  AssemblerPredicate<"HasV5TOps", "armv5t">;
14 def NoV5T            : Predicate<"!Subtarget->hasV5TOps()">;
15 def HasV5TE          : Predicate<"Subtarget->hasV5TEOps()">,
16                                  AssemblerPredicate<"HasV5TEOps", "armv5te">;
17 def HasV6            : Predicate<"Subtarget->hasV6Ops()">,
18                                  AssemblerPredicate<"HasV6Ops", "armv6">;
19 def NoV6             : Predicate<"!Subtarget->hasV6Ops()">;
20 def HasV6M           : Predicate<"Subtarget->hasV6MOps()">,
21                                  AssemblerPredicate<"HasV6MOps",
22                                                     "armv6m or armv6t2">;
23 def HasV8MBaseline   : Predicate<"Subtarget->hasV8MBaselineOps()">,
24                                  AssemblerPredicate<"HasV8MBaselineOps",
25                                                     "armv8m.base">;
26 def HasV8MMainline   : Predicate<"Subtarget->hasV8MMainlineOps()">,
27                                  AssemblerPredicate<"HasV8MMainlineOps",
28                                                     "armv8m.main">;
29 def HasV8_1MMainline : Predicate<"Subtarget->hasV8_1MMainlineOps()">,
30                                  AssemblerPredicate<"HasV8_1MMainlineOps",
31                                                     "armv8.1m.main">;
32 def HasMVEInt        : Predicate<"Subtarget->hasMVEIntegerOps()">,
33                                  AssemblerPredicate<"HasMVEIntegerOps",
34                                                     "mve">;
35 def HasMVEFloat      : Predicate<"Subtarget->hasMVEFloatOps()">,
36                                  AssemblerPredicate<"HasMVEFloatOps",
37                                                     "mve.fp">;
38 def HasFPRegs        : Predicate<"Subtarget->hasFPRegs()">,
39                                  AssemblerPredicate<"FeatureFPRegs",
40                                                     "fp registers">;
41 def HasFPRegs16      : Predicate<"Subtarget->hasFPRegs16()">,
42                                  AssemblerPredicate<"FeatureFPRegs16",
43                                                     "16-bit fp registers">;
44 def HasFPRegs64      : Predicate<"Subtarget->hasFPRegs64()">,
45                                  AssemblerPredicate<"FeatureFPRegs64",
46                                                     "64-bit fp registers">;
47 def HasFPRegsV8_1M   : Predicate<"Subtarget->hasFPRegs() && Subtarget->hasV8_1MMainlineOps()">,
48                                  AssemblerPredicate<"FeatureFPRegs,HasV8_1MMainlineOps",
49                                                     "armv8.1m.main with FP or MVE">;
50 def HasV6T2          : Predicate<"Subtarget->hasV6T2Ops()">,
51                                  AssemblerPredicate<"HasV6T2Ops", "armv6t2">;
52 def NoV6T2           : Predicate<"!Subtarget->hasV6T2Ops()">;
53 def HasV6K           : Predicate<"Subtarget->hasV6KOps()">,
54                                  AssemblerPredicate<"HasV6KOps", "armv6k">;
55 def NoV6K            : Predicate<"!Subtarget->hasV6KOps()">;
56 def HasV7            : Predicate<"Subtarget->hasV7Ops()">,
57                                  AssemblerPredicate<"HasV7Ops", "armv7">;
58 def HasV8            : Predicate<"Subtarget->hasV8Ops()">,
59                                  AssemblerPredicate<"HasV8Ops", "armv8">;
60 def PreV8            : Predicate<"!Subtarget->hasV8Ops()">,
61                                  AssemblerPredicate<"!HasV8Ops", "armv7 or earlier">;
62 def HasV8_1a         : Predicate<"Subtarget->hasV8_1aOps()">,
63                                  AssemblerPredicate<"HasV8_1aOps", "armv8.1a">;
64 def HasV8_2a         : Predicate<"Subtarget->hasV8_2aOps()">,
65                                  AssemblerPredicate<"HasV8_2aOps", "armv8.2a">;
66 def HasV8_3a         : Predicate<"Subtarget->hasV8_3aOps()">,
67                                  AssemblerPredicate<"HasV8_3aOps", "armv8.3a">;
68 def HasV8_4a         : Predicate<"Subtarget->hasV8_4aOps()">,
69                                  AssemblerPredicate<"HasV8_4aOps", "armv8.4a">;
70 def HasV8_5a         : Predicate<"Subtarget->hasV8_5aOps()">,
71                                  AssemblerPredicate<"HasV8_5aOps", "armv8.5a">;
72 def NoVFP            : Predicate<"!Subtarget->hasVFP2Base()">;
73 def HasVFP2          : Predicate<"Subtarget->hasVFP2Base()">,
74                                  AssemblerPredicate<"FeatureVFP2_SP", "VFP2">;
75 def HasVFP3          : Predicate<"Subtarget->hasVFP3Base()">,
76                                  AssemblerPredicate<"FeatureVFP3_D16_SP", "VFP3">;
77 def HasVFP4          : Predicate<"Subtarget->hasVFP4Base()">,
78                                  AssemblerPredicate<"FeatureVFP4_D16_SP", "VFP4">;
79 def HasDPVFP         : Predicate<"Subtarget->hasFP64()">,
80                                  AssemblerPredicate<"FeatureFP64",
81                                                     "double precision VFP">;
82 def HasFPARMv8       : Predicate<"Subtarget->hasFPARMv8Base()">,
83                                  AssemblerPredicate<"FeatureFPARMv8_D16_SP", "FPARMv8">;
84 def HasNEON          : Predicate<"Subtarget->hasNEON()">,
85                                  AssemblerPredicate<"FeatureNEON", "NEON">;
86 def HasSHA2          : Predicate<"Subtarget->hasSHA2()">,
87                                  AssemblerPredicate<"FeatureSHA2", "sha2">;
88 def HasAES           : Predicate<"Subtarget->hasAES()">,
89                                  AssemblerPredicate<"FeatureAES", "aes">;
90 def HasCrypto        : Predicate<"Subtarget->hasCrypto()">,
91                                  AssemblerPredicate<"FeatureCrypto", "crypto">;
92 def HasDotProd       : Predicate<"Subtarget->hasDotProd()">,
93                                  AssemblerPredicate<"FeatureDotProd", "dotprod">;
94 def HasCRC           : Predicate<"Subtarget->hasCRC()">,
95                                  AssemblerPredicate<"FeatureCRC", "crc">;
96 def HasRAS           : Predicate<"Subtarget->hasRAS()">,
97                                  AssemblerPredicate<"FeatureRAS", "ras">;
98 def HasLOB           : Predicate<"Subtarget->hasLOB()">,
99                                  AssemblerPredicate<"FeatureLOB", "lob">;
100 def HasFP16          : Predicate<"Subtarget->hasFP16()">,
101                                  AssemblerPredicate<"FeatureFP16","half-float conversions">;
102 def HasFullFP16      : Predicate<"Subtarget->hasFullFP16()">,
103                                  AssemblerPredicate<"FeatureFullFP16","full half-float">;
104 def HasFP16FML       : Predicate<"Subtarget->hasFP16FML()">,
105                                  AssemblerPredicate<"FeatureFP16FML","full half-float fml">;
106 def HasDivideInThumb : Predicate<"Subtarget->hasDivideInThumbMode()">,
107                                  AssemblerPredicate<"FeatureHWDivThumb", "divide in THUMB">;
108 def HasDivideInARM   : Predicate<"Subtarget->hasDivideInARMMode()">,
109                                  AssemblerPredicate<"FeatureHWDivARM", "divide in ARM">;
110 def HasDSP           : Predicate<"Subtarget->hasDSP()">,
111                                  AssemblerPredicate<"FeatureDSP", "dsp">;
112 def HasDB            : Predicate<"Subtarget->hasDataBarrier()">,
113                                  AssemblerPredicate<"FeatureDB",
114                                                     "data-barriers">;
115 def HasDFB           : Predicate<"Subtarget->hasFullDataBarrier()">,
116                                  AssemblerPredicate<"FeatureDFB",
117                                                     "full-data-barrier">;
118 def HasV7Clrex  : Predicate<"Subtarget->hasV7Clrex()">,
119                             AssemblerPredicate<"FeatureV7Clrex",
120                                                "v7 clrex">;
121 def HasAcquireRelease : Predicate<"Subtarget->hasAcquireRelease()">,
122                                   AssemblerPredicate<"FeatureAcquireRelease",
123                                                      "acquire/release">;
124 def HasMP            : Predicate<"Subtarget->hasMPExtension()">,
125                                  AssemblerPredicate<"FeatureMP",
126                                                     "mp-extensions">;
127 def HasVirtualization: Predicate<"false">,
128                                  AssemblerPredicate<"FeatureVirtualization",
129                                                    "virtualization-extensions">;
130 def HasTrustZone     : Predicate<"Subtarget->hasTrustZone()">,
131                                  AssemblerPredicate<"FeatureTrustZone",
132                                                     "TrustZone">;
133 def Has8MSecExt      : Predicate<"Subtarget->has8MSecExt()">,
134                                  AssemblerPredicate<"Feature8MSecExt",
135                                                     "ARMv8-M Security Extensions">;
136 def HasZCZ           : Predicate<"Subtarget->hasZeroCycleZeroing()">;
137 def UseNEONForFP     : Predicate<"Subtarget->useNEONForSinglePrecisionFP()">;
138 def DontUseNEONForFP : Predicate<"!Subtarget->useNEONForSinglePrecisionFP()">;
139 def IsThumb          : Predicate<"Subtarget->isThumb()">,
140                                  AssemblerPredicate<"ModeThumb", "thumb">;
141 def IsThumb1Only     : Predicate<"Subtarget->isThumb1Only()">;
142 def IsThumb2         : Predicate<"Subtarget->isThumb2()">,
143                                  AssemblerPredicate<"ModeThumb,FeatureThumb2",
144                                                     "thumb2">;
145 def IsMClass         : Predicate<"Subtarget->isMClass()">,
146                                  AssemblerPredicate<"FeatureMClass", "armv*m">;
147 def IsNotMClass      : Predicate<"!Subtarget->isMClass()">,
148                                  AssemblerPredicate<"!FeatureMClass",
149                                                     "!armv*m">;
150 def IsARM            : Predicate<"!Subtarget->isThumb()">,
151                                  AssemblerPredicate<"!ModeThumb", "arm-mode">;
152 def IsMachO          : Predicate<"Subtarget->isTargetMachO()">;
153 def IsNotMachO       : Predicate<"!Subtarget->isTargetMachO()">;
154 def IsNaCl           : Predicate<"Subtarget->isTargetNaCl()">;
155 def IsWindows        : Predicate<"Subtarget->isTargetWindows()">;
156 def IsNotWindows     : Predicate<"!Subtarget->isTargetWindows()">;
157 def IsReadTPHard     : Predicate<"Subtarget->isReadTPHard()">;
158 def IsReadTPSoft     : Predicate<"!Subtarget->isReadTPHard()">;
159 def UseNaClTrap      : Predicate<"Subtarget->useNaClTrap()">,
160                                  AssemblerPredicate<"FeatureNaClTrap", "NaCl">;
161 def DontUseNaClTrap  : Predicate<"!Subtarget->useNaClTrap()">;
163 def UseNegativeImmediates :
164   Predicate<"false">,
165             AssemblerPredicate<"!FeatureNoNegativeImmediates",
166                                "NegativeImmediates">;
168 // FIXME: Eventually this will be just "hasV6T2Ops".
169 let RecomputePerFunction = 1 in {
170   def UseMovt          : Predicate<"Subtarget->useMovt()">;
171   def DontUseMovt      : Predicate<"!Subtarget->useMovt()">;
172   def UseMovtInPic     : Predicate<"Subtarget->useMovt() && Subtarget->allowPositionIndependentMovt()">;
173   def DontUseMovtInPic : Predicate<"!Subtarget->useMovt() || !Subtarget->allowPositionIndependentMovt()">;
175   def UseFPVMLx: Predicate<"((Subtarget->useFPVMLx() &&"
176                            "  TM.Options.AllowFPOpFusion != FPOpFusion::Fast) ||"
177                            "Subtarget->hasMinSize())">;
179 def UseMulOps        : Predicate<"Subtarget->useMulOps()">;
181 // Prefer fused MAC for fp mul + add over fp VMLA / VMLS if they are available.
182 // But only select them if more precision in FP computation is allowed, and when
183 // they are not slower than a mul + add sequence.
184 // Do not use them for Darwin platforms.
185 def UseFusedMAC      : Predicate<"(TM.Options.AllowFPOpFusion =="
186                                  " FPOpFusion::Fast && "
187                                  " Subtarget->hasVFP4Base()) && "
188                                  "!Subtarget->isTargetDarwin() &&"
189                                  "Subtarget->useFPVMLx()">;
191 def HasFastVGETLNi32 : Predicate<"!Subtarget->hasSlowVGETLNi32()">;
192 def HasSlowVGETLNi32 : Predicate<"Subtarget->hasSlowVGETLNi32()">;
194 def HasFastVDUP32 : Predicate<"!Subtarget->hasSlowVDUP32()">;
195 def HasSlowVDUP32 : Predicate<"Subtarget->hasSlowVDUP32()">;
197 def UseVMOVSR : Predicate<"Subtarget->preferVMOVSR() ||"
198                           "!Subtarget->useNEONForSinglePrecisionFP()">;
199 def DontUseVMOVSR : Predicate<"!Subtarget->preferVMOVSR() &&"
200                               "Subtarget->useNEONForSinglePrecisionFP()">;
202 let RecomputePerFunction = 1 in {
203   def IsLE             : Predicate<"MF->getDataLayout().isLittleEndian()">;
204   def IsBE             : Predicate<"MF->getDataLayout().isBigEndian()">;
207 def GenExecuteOnly : Predicate<"Subtarget->genExecuteOnly()">;
209 // Armv8.5-A extensions
210 def HasSB            : Predicate<"Subtarget->hasSB()">,
211                        AssemblerPredicate<"FeatureSB", "sb">;