llvm.org GIT mirror llvm / aeafce5
[NFC][Reassociate] Add unary FNeg tests to fast-ReassociateVector.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364232 91177308-0d34-0410-b5e6-96231b3b80d8 Cameron McInally 2 months ago
1 changed file(s) with 57 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
231231 ret <2 x double> %4
232232 }
233233
234 define <2 x double> @test9_unary_fneg(<2 x double> %b, <2 x double> %a) {
235 ; CHECK-LABEL: @test9_unary_fneg(
236 ; CHECK-NEXT: [[TMP1:%.*]] = fneg fast <2 x double> [[A:%.*]]
237 ; CHECK-NEXT: [[TMP2:%.*]] = fadd fast <2 x double> [[B:%.*]],
238 ; CHECK-NEXT: ret <2 x double> [[TMP2]]
239 ;
240 %1 = fadd fast <2 x double> %a,
241 %2 = fadd fast <2 x double> %b, %1
242 %3 = fneg fast <2 x double> %a
243 %4 = fadd fast <2 x double> %2, %3
244 ret <2 x double> %4
245 }
246
234247 ; Check (b+(a+1234))+-a -> b+1234 - minimum FMF subset version
235248
236249 define <2 x double> @test9_reassoc(<2 x double> %b, <2 x double> %a) {
248261 ret <2 x double> %4
249262 }
250263
264 define <2 x double> @test9_reassoc_unary_fneg(<2 x double> %b, <2 x double> %a) {
265 ; CHECK-LABEL: @test9_reassoc_unary_fneg(
266 ; CHECK-NEXT: [[TMP1:%.*]] = fadd reassoc <2 x double> [[A:%.*]],
267 ; CHECK-NEXT: [[TMP2:%.*]] = fadd reassoc <2 x double> [[B:%.*]], [[TMP1]]
268 ; CHECK-NEXT: [[TMP3:%.*]] = fneg reassoc <2 x double> [[A]]
269 ; CHECK-NEXT: [[TMP4:%.*]] = fadd reassoc <2 x double> [[TMP3]], [[TMP2]]
270 ; CHECK-NEXT: ret <2 x double> [[TMP4]]
271 ;
272 %1 = fadd reassoc <2 x double> %a,
273 %2 = fadd reassoc <2 x double> %b, %1
274 %3 = fneg reassoc <2 x double> %a
275 %4 = fadd reassoc <2 x double> %2, %3
276 ret <2 x double> %4
277 }
278
251279 ; Check -(-(z*40)*a) -> a*40*z.
252280
253281 define <2 x float> @test10(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
261289 %c = fsub fast <2 x float> , %d
262290 %e = fmul fast <2 x float> %a, %c
263291 %f = fsub fast <2 x float> , %e
292 ret <2 x float> %f
293 }
294
295 define <2 x float> @test10_unary_fneg(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
296 ; CHECK-LABEL: @test10_unary_fneg(
297 ; CHECK-NEXT: [[TMP1:%.*]] = fneg fast <2 x float> zeroinitializer
298 ; CHECK-NEXT: [[E:%.*]] = fmul fast <2 x float> [[A:%.*]],
299 ; CHECK-NEXT: [[F:%.*]] = fmul fast <2 x float> [[E]], [[Z:%.*]]
300 ; CHECK-NEXT: ret <2 x float> [[F]]
301 ;
302 %d = fmul fast <2 x float> %z,
303 %c = fneg fast <2 x float> %d
304 %e = fmul fast <2 x float> %a, %c
305 %f = fneg fast <2 x float> %e
264306 ret <2 x float> %f
265307 }
266308
281323 ret <2 x float> %f
282324 }
283325
326 define <2 x float> @test10_reassoc_unary_fneg(<2 x float> %a, <2 x float> %b, <2 x float> %z) {
327 ; CHECK-LABEL: @test10_reassoc_unary_fneg(
328 ; CHECK-NEXT: [[D:%.*]] = fmul reassoc <2 x float> [[Z:%.*]],
329 ; CHECK-NEXT: [[C:%.*]] = fneg reassoc <2 x float> [[D]]
330 ; CHECK-NEXT: [[E:%.*]] = fmul reassoc <2 x float> [[A:%.*]], [[C]]
331 ; CHECK-NEXT: [[F:%.*]] = fneg reassoc <2 x float> [[E]]
332 ; CHECK-NEXT: ret <2 x float> [[F]]
333 ;
334 %d = fmul reassoc <2 x float> %z,
335 %c = fneg reassoc <2 x float> %d
336 %e = fmul reassoc <2 x float> %a, %c
337 %f = fneg reassoc <2 x float> %e
338 ret <2 x float> %f
339 }
340
284341 ; Check x*y+y*x -> x*y*2.
285342
286343 define <2 x double> @test11(<2 x double> %x, <2 x double> %y) {