Revert r354244 "[DAGCombiner] Eliminate dead stores to stack."
[llvm-complete.git] / lib / Target / AArch64 / AArch64SchedPredExynos.td
blob150bff0e1a1dad645076abbd2f48387d1dc7ba06
1 //===- AArch64SchedPredExynos.td - AArch64 Sched Preds -----*- 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 //
9 // This file defines scheduling predicate definitions that are used by the
10 // AArch64 Exynos processors.
12 //===----------------------------------------------------------------------===//
14 // Auxiliary predicates.
16 // Check the shift in arithmetic and logic instructions.
17 def ExynosCheckShift : CheckAny<[CheckShiftBy0,
18                                  CheckAll<
19                                    [CheckShiftLSL,
20                                     CheckAny<
21                                       [CheckShiftBy1,
22                                        CheckShiftBy2,
23                                        CheckShiftBy3]>]>]>;
25 // Exynos predicates.
27 // Identify BLR specifying the LR register as the indirect target register.
28 def ExynosBranchLinkLRPred : MCSchedPredicate<
29                                CheckAll<[CheckOpcode<[BLR]>,
30                                          CheckRegOperand<0, LR>]>>;
32 // Identify arithmetic instructions without or with limited extension or shift.
33 def ExynosArithFn   : TIIPredicate<
34                         "isExynosArithFast",
35                         MCOpcodeSwitchStatement<
36                           [MCOpcodeSwitchCase<
37                              IsArithExtOp.ValidOpcodes,
38                              MCReturnStatement<
39                                CheckAny<[CheckExtBy0,
40                                          CheckAll<
41                                            [CheckAny<
42                                              [CheckExtUXTW,
43                                               CheckExtUXTX]>,
44                                             CheckAny<
45                                               [CheckExtBy1,
46                                                CheckExtBy2,
47                                                CheckExtBy3]>]>]>>>,
48                            MCOpcodeSwitchCase<
49                              IsArithShiftOp.ValidOpcodes,
50                              MCReturnStatement<ExynosCheckShift>>,
51                            MCOpcodeSwitchCase<
52                              IsArithUnshiftOp.ValidOpcodes,
53                              MCReturnStatement<TruePred>>],
54                           MCReturnStatement<FalsePred>>>;
55 def ExynosArithPred : MCSchedPredicate<ExynosArithFn>;
57 // Identify logic instructions with limited shift.
58 def ExynosLogicFn   : TIIPredicate<
59                         "isExynosLogicFast",
60                         MCOpcodeSwitchStatement<
61                           [MCOpcodeSwitchCase<
62                              IsLogicShiftOp.ValidOpcodes,
63                              MCReturnStatement<ExynosCheckShift>>,
64                            MCOpcodeSwitchCase<
65                              IsLogicUnshiftOp.ValidOpcodes,
66                              MCReturnStatement<TruePred>>],
67                           MCReturnStatement<FalsePred>>>;
68 def ExynosLogicPred : MCSchedPredicate<ExynosLogicFn>;
70 // Identify more logic instructions with limited shift.
71 def ExynosLogicExFn   : TIIPredicate<
72                           "isExynosLogicExFast",
73                           MCOpcodeSwitchStatement<
74                             [MCOpcodeSwitchCase<
75                                IsLogicShiftOp.ValidOpcodes,
76                                MCReturnStatement<
77                                  CheckAny<
78                                    [ExynosCheckShift,
79                                     CheckAll<
80                                      [CheckShiftLSL,
81                                       CheckShiftBy8]>]>>>,
82                              MCOpcodeSwitchCase<
83                                IsLogicUnshiftOp.ValidOpcodes,
84                                MCReturnStatement<TruePred>>],
85                             MCReturnStatement<FalsePred>>>;
86 def ExynosLogicExPred : MCSchedPredicate<ExynosLogicExFn>;
88 // Identify a load or store using the register offset addressing mode
89 // with a scaled non-extended register.
90 def ExynosScaledIdxFn   : TIIPredicate<"isExynosScaledAddr",
91                                        MCOpcodeSwitchStatement<
92                                          [MCOpcodeSwitchCase<
93                                             IsLoadStoreRegOffsetOp.ValidOpcodes,
94                                             MCReturnStatement<
95                                               CheckAny<
96                                                 [CheckMemExtSXTW,
97                                                  CheckMemExtUXTW,
98                                                  CheckMemScaled]>>>],
99                                          MCReturnStatement<FalsePred>>>;
100 def ExynosScaledIdxPred : MCSchedPredicate<ExynosScaledIdxFn>;
102 // Identify FP instructions.
103 def ExynosFPPred : MCSchedPredicate<CheckAny<[CheckDForm, CheckQForm]>>;
105 // Identify whether an instruction whose result is a long vector
106 // operates on the upper half of the input registers.
107 def ExynosLongVectorUpperFn   : TIIPredicate<
108                                   "isExynosLongVectorUpper",
109                                   MCOpcodeSwitchStatement<
110                                   [MCOpcodeSwitchCase<
111                                     IsLongVectorUpperOp.ValidOpcodes,
112                                     MCReturnStatement<TruePred>>],
113                                   MCReturnStatement<FalsePred>>>;
114 def ExynosLongVectorUpperPred : MCSchedPredicate<ExynosLongVectorUpperFn>;
116 // Identify 128-bit NEON instructions.
117 def ExynosQFormPred : MCSchedPredicate<CheckQForm>;
119 // Identify instructions that reset a register efficiently.
120 def ExynosResetFn   : TIIPredicate<
121                         "isExynosResetFast",
122                         MCOpcodeSwitchStatement<
123                           [MCOpcodeSwitchCase<
124                              [ADR, ADRP,
125                               MOVNWi, MOVNXi,
126                               MOVZWi, MOVZXi],
127                              MCReturnStatement<TruePred>>,
128                            MCOpcodeSwitchCase<
129                              [ORRWri, ORRXri],
130                              MCReturnStatement<
131                                CheckAll<
132                                  [CheckIsRegOperand<1>,
133                                   CheckAny<
134                                     [CheckRegOperand<1, WZR>,
135                                      CheckRegOperand<1, XZR>]>]>>>],
136                           MCReturnStatement<
137                             CheckAny<
138                               [IsCopyIdiomFn,
139                                IsZeroFPIdiomFn]>>>>;
140 def ExynosResetPred : MCSchedPredicate<ExynosResetFn>;
142 // Identify EXTR as the alias for ROR (immediate).
143 def ExynosRotateRightImmPred : MCSchedPredicate<
144                                  CheckAll<[CheckOpcode<[EXTRWrri, EXTRXrri]>,
145                                            CheckSameRegOperand<1, 2>]>>;
147 // Identify cheap arithmetic and logic immediate instructions.
148 def ExynosCheapFn : TIIPredicate<
149                       "isExynosCheapAsMove",
150                       MCOpcodeSwitchStatement<
151                         [MCOpcodeSwitchCase<
152                            IsArithLogicImmOp.ValidOpcodes,
153                            MCReturnStatement<TruePred>>],
154                         MCReturnStatement<
155                           CheckAny<
156                             [ExynosArithFn, ExynosResetFn, ExynosLogicFn]>>>>;