llvm.org GIT mirror llvm / 9aa1beb
[globalisel] Fix long lines from r323342 They would be fixed in a later patch but they shouldn't have been introduced. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@323372 91177308-0d34-0410-b5e6-96231b3b80d8 Daniel Sanders 2 years ago
1 changed file(s) with 56 addition(s) and 32 deletion(s). Raw diff Collapse all Expand all
6060 for (unsigned opcode : {G_ADD, G_SUB}) {
6161 // Check we infer the correct types and actually do what we're told.
6262 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(8)}}),
63 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
63 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
64 LLT::scalar(32)));
6465 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(16)}}),
65 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
66 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(32)}}),
67 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
68 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(64)}}),
69 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
66 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
67 LLT::scalar(32)));
68 ASSERT_EQ(
69 L.getAction({opcode, {LLT::scalar(32)}}),
70 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
71 ASSERT_EQ(
72 L.getAction({opcode, {LLT::scalar(64)}}),
73 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
7074
7175 // Make sure the default for over-sized types applies.
7276 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(128)}}),
73 LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0, LLT::scalar(64)));
77 LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0,
78 LLT::scalar(64)));
7479 // Make sure we also handle unusual sizes
7580 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(1)}}),
76 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
81 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
82 LLT::scalar(32)));
7783 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(31)}}),
78 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
84 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
85 LLT::scalar(32)));
7986 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(33)}}),
80 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(64)));
87 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
88 LLT::scalar(64)));
8189 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(63)}}),
82 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(64)));
90 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
91 LLT::scalar(64)));
8392 ASSERT_EQ(L.getAction({opcode, {LLT::scalar(65)}}),
84 LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0, LLT::scalar(64)));
93 LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0,
94 LLT::scalar(64)));
8595 }
8696 }
8797
108118 ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(8, 8)}}),
109119 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
110120 ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(8, 7)}}),
111 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::vector(8, 8)));
121 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
122 LLT::vector(8, 8)));
112123 ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(2, 8)}}),
113 LegalizerInfo::LegalizeActionStep(LegalizerInfo::MoreElements, 0, LLT::vector(8, 8)));
124 LegalizerInfo::LegalizeActionStep(LegalizerInfo::MoreElements, 0,
125 LLT::vector(8, 8)));
114126 ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(8, 32)}}),
115 LegalizerInfo::LegalizeActionStep(LegalizerInfo::FewerElements, 0, LLT::vector(4, 32)));
127 LegalizerInfo::LegalizeActionStep(LegalizerInfo::FewerElements, 0,
128 LLT::vector(4, 32)));
116129 // Check a few non-power-of-2 sizes:
117130 ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(3, 3)}}),
118 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::vector(3, 8)));
131 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
132 LLT::vector(3, 8)));
119133 ASSERT_EQ(L.getAction({G_ADD, {LLT::vector(3, 8)}}),
120 LegalizerInfo::LegalizeActionStep(LegalizerInfo::MoreElements, 0, LLT::vector(8, 8)));
134 LegalizerInfo::LegalizeActionStep(LegalizerInfo::MoreElements, 0,
135 LLT::vector(8, 8)));
121136 }
122137
123138 TEST(LegalizerInfoTest, MultipleTypes) {
143158 ASSERT_EQ(
144159 L.getAction({G_PTRTOINT, {LLT::scalar(65), s64}}),
145160 LegalizerInfo::LegalizeActionStep(LegalizerInfo::NarrowScalar, 0, s64));
146 ASSERT_EQ(
147 L.getAction({G_PTRTOINT, {s64, LLT::pointer(0, 32)}}),
148 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Unsupported, 1, LLT::pointer(0, 32)));
161 ASSERT_EQ(L.getAction({G_PTRTOINT, {s64, LLT::pointer(0, 32)}}),
162 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Unsupported, 1,
163 LLT::pointer(0, 32)));
149164 }
150165
151166 TEST(LegalizerInfoTest, MultipleSteps) {
162177 L.computeTables();
163178
164179 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(16)}}),
165 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
180 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
181 LLT::scalar(32)));
166182 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(32)}}),
167 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Lower, 0, LLT::scalar(32)));
183 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Lower, 0,
184 LLT::scalar(32)));
168185 }
169186
170187 TEST(LegalizerInfoTest, SizeChangeStrategy) {
179196
180197 // Check we infer the correct types and actually do what we're told.
181198 for (unsigned Size : {1, 8, 16, 32}) {
182 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(Size)}}),
183 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
199 ASSERT_EQ(
200 L.getAction({G_UREM, {LLT::scalar(Size)}}),
201 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Legal, 0, LLT{}));
184202 }
185203 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(2)}}),
186 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(8)));
204 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
205 LLT::scalar(8)));
187206 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(7)}}),
188 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(8)));
207 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
208 LLT::scalar(8)));
189209 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(9)}}),
190 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(16)));
210 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
211 LLT::scalar(16)));
191212 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(17)}}),
192 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
213 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
214 LLT::scalar(32)));
193215 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(31)}}),
194 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0, LLT::scalar(32)));
216 LegalizerInfo::LegalizeActionStep(LegalizerInfo::WidenScalar, 0,
217 LLT::scalar(32)));
195218 ASSERT_EQ(L.getAction({G_UREM, {LLT::scalar(33)}}),
196 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Unsupported, 0, LLT::scalar(33)));
197 }
198 }
219 LegalizerInfo::LegalizeActionStep(LegalizerInfo::Unsupported, 0,
220 LLT::scalar(33)));
221 }
222 }