1 //===-- X86SchedPredicates.td - X86 Scheduling Predicates --*- tablegen -*-===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines scheduling predicate definitions that are common to
10 // all X86 subtargets.
12 //===----------------------------------------------------------------------===//
14 // A predicate used to identify dependency-breaking instructions that clear the
15 // content of the destination register. Note that this predicate only checks if
16 // input registers are the same. This predicate doesn't make any assumptions on
17 // the expected instruction opcodes, because different processors may implement
18 // different zero-idioms.
19 def ZeroIdiomPredicate : CheckSameRegOperand<1, 2>;
21 // A predicate used to identify VPERM that have bits 3 and 7 of their mask set.
22 // On some processors, these VPERM instructions are zero-idioms.
23 def ZeroIdiomVPERMPredicate : CheckAll<[
25 CheckImmOperand<3, 0x88>
28 // A predicate used to check if a LEA instruction uses all three source
29 // operands: base, index, and offset.
30 def IsThreeOperandsLEAPredicate: CheckAll<[
33 CheckNot<CheckInvalidRegOperand<1>>,
35 // isRegOperand(Index)
37 CheckNot<CheckInvalidRegOperand<3>>,
39 // hasLEAOffset(Offset)
43 CheckNot<CheckZeroOperand<4>>
45 CheckNonPortable<"MI.getOperand(4).isGlobal()">
49 def LEACases : MCOpcodeSwitchCase<
50 [LEA32r, LEA64r, LEA64_32r, LEA16r],
51 MCReturnStatement<IsThreeOperandsLEAPredicate>
54 // Used to generate the body of a TII member function.
55 def IsThreeOperandsLEABody :
56 MCOpcodeSwitchStatement<[LEACases], MCReturnStatement<FalsePred>>;
58 // This predicate evaluates to true only if the input machine instruction is a
59 // 3-operands LEA. Tablegen automatically generates a new method for it in
61 def IsThreeOperandsLEAFn :
62 TIIPredicate<"isThreeOperandsLEA", IsThreeOperandsLEABody>;
64 // A predicate to check for COND_A and COND_BE CMOVs which have an extra uop
65 // on recent Intel CPUs.
66 def IsCMOVArr_Or_CMOVBErr : CheckAny<[
67 CheckImmOperand_s<3, "X86::COND_A">,
68 CheckImmOperand_s<3, "X86::COND_BE">
71 def IsCMOVArm_Or_CMOVBErm : CheckAny<[
72 CheckImmOperand_s<7, "X86::COND_A">,
73 CheckImmOperand_s<7, "X86::COND_BE">
76 // A predicate to check for COND_A and COND_BE SETCCs which have an extra uop
77 // on recent Intel CPUs.
78 def IsSETAr_Or_SETBEr : CheckAny<[
79 CheckImmOperand_s<1, "X86::COND_A">,
80 CheckImmOperand_s<1, "X86::COND_BE">
83 def IsSETAm_Or_SETBEm : CheckAny<[
84 CheckImmOperand_s<5, "X86::COND_A">,
85 CheckImmOperand_s<5, "X86::COND_BE">