Andrea Di Biagio | b6022aa | 2018-07-19 16:42:15 +0000 | [diff] [blame] | 1 | //===-- X86SchedPredicates.td - X86 Scheduling Predicates --*- tablegen -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // This file defines scheduling predicate definitions that are common to |
| 11 | // all X86 subtargets. |
| 12 | // |
| 13 | //===----------------------------------------------------------------------===// |
| 14 | |
| 15 | // A predicate used to identify dependency-breaking instructions that clear the |
| 16 | // content of the destination register. Note that this predicate only checks if |
| 17 | // input registers are the same. This predicate doesn't make any assumptions on |
| 18 | // the expected instruction opcodes, because different processors may implement |
| 19 | // different zero-idioms. |
| 20 | def ZeroIdiomPredicate : CheckSameRegOperand<1, 2>; |
| 21 | |
Andrea Di Biagio | 24ea163 | 2018-10-01 10:35:13 +0000 | [diff] [blame] | 22 | // A predicate used to identify VPERM that have bits 3 and 7 of their mask set. |
| 23 | // On some processors, these VPERM instructions are zero-idioms. |
| 24 | def ZeroIdiomVPERMPredicate : CheckAll<[ |
| 25 | ZeroIdiomPredicate, |
| 26 | CheckImmOperand<3, 0x88> |
| 27 | ]>; |
| 28 | |
Andrea Di Biagio | f3bde04 | 2018-08-09 15:32:48 +0000 | [diff] [blame] | 29 | // A predicate used to check if a LEA instruction uses all three source |
| 30 | // operands: base, index, and offset. |
Andrea Di Biagio | b6022aa | 2018-07-19 16:42:15 +0000 | [diff] [blame] | 31 | def IsThreeOperandsLEAPredicate: CheckAll<[ |
Andrea Di Biagio | b6022aa | 2018-07-19 16:42:15 +0000 | [diff] [blame] | 32 | // isRegOperand(Base) |
| 33 | CheckIsRegOperand<1>, |
| 34 | CheckNot<CheckInvalidRegOperand<1>>, |
| 35 | |
| 36 | // isRegOperand(Index) |
| 37 | CheckIsRegOperand<3>, |
| 38 | CheckNot<CheckInvalidRegOperand<3>>, |
| 39 | |
| 40 | // hasLEAOffset(Offset) |
| 41 | CheckAny<[ |
| 42 | CheckAll<[ |
| 43 | CheckIsImmOperand<4>, |
| 44 | CheckNot<CheckZeroOperand<4>> |
| 45 | ]>, |
| 46 | CheckNonPortable<"MI.getOperand(4).isGlobal()"> |
| 47 | ]> |
| 48 | ]>; |
| 49 | |
Andrea Di Biagio | f3bde04 | 2018-08-09 15:32:48 +0000 | [diff] [blame] | 50 | def LEACases : MCOpcodeSwitchCase< |
| 51 | [LEA32r, LEA64r, LEA64_32r, LEA16r], |
| 52 | MCReturnStatement<IsThreeOperandsLEAPredicate> |
| 53 | >; |
| 54 | |
| 55 | // Used to generate the body of a TII member function. |
| 56 | def IsThreeOperandsLEABody : |
| 57 | MCOpcodeSwitchStatement<[LEACases], MCReturnStatement<FalsePred>>; |
| 58 | |
Andrea Di Biagio | b6022aa | 2018-07-19 16:42:15 +0000 | [diff] [blame] | 59 | // This predicate evaluates to true only if the input machine instruction is a |
| 60 | // 3-operands LEA. Tablegen automatically generates a new method for it in |
| 61 | // X86GenInstrInfo. |
| 62 | def IsThreeOperandsLEAFn : |
Andrea Di Biagio | 9eaf5aa | 2018-08-14 18:36:54 +0000 | [diff] [blame] | 63 | TIIPredicate<"isThreeOperandsLEA", IsThreeOperandsLEABody>; |