1
1
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
- ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse -enable-unsafe-fp-math -enable- no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-verify-pattern-order=true < %s | FileCheck %s --check-prefix=SSE
3
- ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx -enable-unsafe-fp-math -enable- no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-verify-pattern-order=true < %s | FileCheck %s --check-prefixes=AVX,AVX1
4
- ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx512vl -enable-unsafe-fp-math -enable- no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-verify-pattern-order=true < %s | FileCheck %s --check-prefixes=AVX,AVX512
2
+ ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-verify-pattern-order=true < %s | FileCheck %s --check-prefix=SSE
3
+ ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-verify-pattern-order=true < %s | FileCheck %s --check-prefixes=AVX,AVX1
4
+ ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx512vl -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-verify-pattern-order=true < %s | FileCheck %s --check-prefixes=AVX,AVX512
5
5
6
6
; Incremental updates of the instruction depths should be enough for this test
7
7
; case.
8
- ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=sse - enable-unsafe-fp-math -enable- no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-inc-threshold=0 < %s | FileCheck %s --check-prefix=SSE
9
- ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx - enable-unsafe-fp-math -enable- no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-inc-threshold=0 < %s | FileCheck %s --check-prefixes=AVX,AVX1
10
- ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -mattr=avx512vl - enable-unsafe-fp-math -enable- no-nans-fp-math -enable-no-signed-zeros-fp-math -machine-combiner-inc-threshold=0 < %s | FileCheck %s --check-prefixes=AVX,AVX512
8
+ ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -mattr=sse -machine-combiner-inc-threshold=0 < %s | FileCheck %s --check-prefix=SSE
9
+ ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -mattr=avx -machine-combiner-inc-threshold=0 < %s | FileCheck %s --check-prefixes=AVX,AVX1
10
+ ; RUN: llc -mtriple=x86_64-unknown-unknown -mcpu=x86-64 -enable-no-nans-fp-math -enable-no-signed-zeros-fp-math -mattr=avx512vl -machine-combiner-inc-threshold=0 < %s | FileCheck %s --check-prefixes=AVX,AVX512
11
11
12
12
; Verify that the first two adds are independent regardless of how the inputs are
13
13
; commuted. The destination registers are used as source registers for the third add.
@@ -26,9 +26,9 @@ define float @reassociate_adds1(float %x0, float %x1, float %x2, float %x3) {
26
26
; AVX-NEXT: vaddss %xmm3, %xmm2, %xmm1
27
27
; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0
28
28
; AVX-NEXT: retq
29
- %t0 = fadd float %x0 , %x1
30
- %t1 = fadd float %t0 , %x2
31
- %t2 = fadd float %t1 , %x3
29
+ %t0 = fadd reassoc nsz float %x0 , %x1
30
+ %t1 = fadd reassoc nsz float %t0 , %x2
31
+ %t2 = fadd reassoc nsz float %t1 , %x3
32
32
ret float %t2
33
33
}
34
34
@@ -46,9 +46,9 @@ define float @reassociate_adds2(float %x0, float %x1, float %x2, float %x3) {
46
46
; AVX-NEXT: vaddss %xmm3, %xmm2, %xmm1
47
47
; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0
48
48
; AVX-NEXT: retq
49
- %t0 = fadd float %x0 , %x1
50
- %t1 = fadd float %x2 , %t0
51
- %t2 = fadd float %t1 , %x3
49
+ %t0 = fadd reassoc nsz float %x0 , %x1
50
+ %t1 = fadd reassoc nsz float %x2 , %t0
51
+ %t2 = fadd reassoc nsz float %t1 , %x3
52
52
ret float %t2
53
53
}
54
54
@@ -66,9 +66,9 @@ define float @reassociate_adds3(float %x0, float %x1, float %x2, float %x3) {
66
66
; AVX-NEXT: vaddss %xmm3, %xmm2, %xmm1
67
67
; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0
68
68
; AVX-NEXT: retq
69
- %t0 = fadd float %x0 , %x1
70
- %t1 = fadd float %t0 , %x2
71
- %t2 = fadd float %x3 , %t1
69
+ %t0 = fadd reassoc nsz float %x0 , %x1
70
+ %t1 = fadd reassoc nsz float %t0 , %x2
71
+ %t2 = fadd reassoc nsz float %x3 , %t1
72
72
ret float %t2
73
73
}
74
74
@@ -86,9 +86,9 @@ define float @reassociate_adds4(float %x0, float %x1, float %x2, float %x3) {
86
86
; AVX-NEXT: vaddss %xmm3, %xmm2, %xmm1
87
87
; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0
88
88
; AVX-NEXT: retq
89
- %t0 = fadd float %x0 , %x1
90
- %t1 = fadd float %x2 , %t0
91
- %t2 = fadd float %x3 , %t1
89
+ %t0 = fadd reassoc nsz float %x0 , %x1
90
+ %t1 = fadd reassoc nsz float %x2 , %t0
91
+ %t2 = fadd reassoc nsz float %x3 , %t1
92
92
ret float %t2
93
93
}
94
94
@@ -117,13 +117,13 @@ define float @reassociate_adds5(float %x0, float %x1, float %x2, float %x3, floa
117
117
; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0
118
118
; AVX-NEXT: vaddss %xmm7, %xmm0, %xmm0
119
119
; AVX-NEXT: retq
120
- %t0 = fadd float %x0 , %x1
121
- %t1 = fadd float %t0 , %x2
122
- %t2 = fadd float %t1 , %x3
123
- %t3 = fadd float %t2 , %x4
124
- %t4 = fadd float %t3 , %x5
125
- %t5 = fadd float %t4 , %x6
126
- %t6 = fadd float %t5 , %x7
120
+ %t0 = fadd reassoc nsz float %x0 , %x1
121
+ %t1 = fadd reassoc nsz float %t0 , %x2
122
+ %t2 = fadd reassoc nsz float %t1 , %x3
123
+ %t3 = fadd reassoc nsz float %t2 , %x4
124
+ %t4 = fadd reassoc nsz float %t3 , %x5
125
+ %t5 = fadd reassoc nsz float %t4 , %x6
126
+ %t6 = fadd reassoc nsz float %t5 , %x7
127
127
ret float %t6
128
128
}
129
129
@@ -146,9 +146,9 @@ define float @reassociate_adds6(float %x0, float %x1, float %x2, float %x3) {
146
146
; AVX-NEXT: vaddss %xmm3, %xmm2, %xmm1
147
147
; AVX-NEXT: vaddss %xmm1, %xmm0, %xmm0
148
148
; AVX-NEXT: retq
149
- %t0 = fdiv float %x0 , %x1
150
- %t1 = fadd float %x2 , %t0
151
- %t2 = fadd float %x3 , %t1
149
+ %t0 = fdiv reassoc nsz float %x0 , %x1
150
+ %t1 = fadd reassoc nsz float %x2 , %t0
151
+ %t2 = fadd reassoc nsz float %x3 , %t1
152
152
ret float %t2
153
153
}
154
154
@@ -168,9 +168,9 @@ define float @reassociate_muls1(float %x0, float %x1, float %x2, float %x3) {
168
168
; AVX-NEXT: vmulss %xmm3, %xmm2, %xmm1
169
169
; AVX-NEXT: vmulss %xmm1, %xmm0, %xmm0
170
170
; AVX-NEXT: retq
171
- %t0 = fdiv float %x0 , %x1
172
- %t1 = fmul float %x2 , %t0
173
- %t2 = fmul float %x3 , %t1
171
+ %t0 = fdiv reassoc nsz float %x0 , %x1
172
+ %t1 = fmul reassoc nsz float %x2 , %t0
173
+ %t2 = fmul reassoc nsz float %x3 , %t1
174
174
ret float %t2
175
175
}
176
176
@@ -190,9 +190,9 @@ define double @reassociate_adds_double(double %x0, double %x1, double %x2, doubl
190
190
; AVX-NEXT: vaddsd %xmm3, %xmm2, %xmm1
191
191
; AVX-NEXT: vaddsd %xmm1, %xmm0, %xmm0
192
192
; AVX-NEXT: retq
193
- %t0 = fdiv double %x0 , %x1
194
- %t1 = fadd double %x2 , %t0
195
- %t2 = fadd double %x3 , %t1
193
+ %t0 = fdiv reassoc nsz double %x0 , %x1
194
+ %t1 = fadd reassoc nsz double %x2 , %t0
195
+ %t2 = fadd reassoc nsz double %x3 , %t1
196
196
ret double %t2
197
197
}
198
198
@@ -212,9 +212,9 @@ define double @reassociate_muls_double(double %x0, double %x1, double %x2, doubl
212
212
; AVX-NEXT: vmulsd %xmm3, %xmm2, %xmm1
213
213
; AVX-NEXT: vmulsd %xmm1, %xmm0, %xmm0
214
214
; AVX-NEXT: retq
215
- %t0 = fdiv double %x0 , %x1
216
- %t1 = fmul double %x2 , %t0
217
- %t2 = fmul double %x3 , %t1
215
+ %t0 = fdiv reassoc nsz double %x0 , %x1
216
+ %t1 = fmul reassoc nsz double %x2 , %t0
217
+ %t2 = fmul reassoc nsz double %x3 , %t1
218
218
ret double %t2
219
219
}
220
220
@@ -240,9 +240,9 @@ define <4 x float> @reassociate_adds_v4f32(<4 x float> %x0, <4 x float> %x1, <4
240
240
; AVX512-NEXT: vfmadd213ps {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
241
241
; AVX512-NEXT: vaddps %xmm0, %xmm3, %xmm0
242
242
; AVX512-NEXT: retq
243
- %t0 = fmul <4 x float > %x0 , %x1
244
- %t1 = fadd <4 x float > %x2 , %t0
245
- %t2 = fadd <4 x float > %x3 , %t1
243
+ %t0 = fmul reassoc nsz <4 x float > %x0 , %x1
244
+ %t1 = fadd reassoc nsz <4 x float > %x2 , %t0
245
+ %t2 = fadd reassoc nsz <4 x float > %x3 , %t1
246
246
ret <4 x float > %t2
247
247
}
248
248
@@ -268,9 +268,9 @@ define <2 x double> @reassociate_adds_v2f64(<2 x double> %x0, <2 x double> %x1,
268
268
; AVX512-NEXT: vfmadd213pd {{.*#+}} xmm0 = (xmm1 * xmm0) + xmm2
269
269
; AVX512-NEXT: vaddpd %xmm0, %xmm3, %xmm0
270
270
; AVX512-NEXT: retq
271
- %t0 = fmul <2 x double > %x0 , %x1
272
- %t1 = fadd <2 x double > %x2 , %t0
273
- %t2 = fadd <2 x double > %x3 , %t1
271
+ %t0 = fmul reassoc nsz <2 x double > %x0 , %x1
272
+ %t1 = fadd reassoc nsz <2 x double > %x2 , %t0
273
+ %t2 = fadd reassoc nsz <2 x double > %x3 , %t1
274
274
ret <2 x double > %t2
275
275
}
276
276
@@ -290,9 +290,9 @@ define <4 x float> @reassociate_muls_v4f32(<4 x float> %x0, <4 x float> %x1, <4
290
290
; AVX-NEXT: vmulps %xmm3, %xmm2, %xmm1
291
291
; AVX-NEXT: vmulps %xmm1, %xmm0, %xmm0
292
292
; AVX-NEXT: retq
293
- %t0 = fadd <4 x float > %x0 , %x1
294
- %t1 = fmul <4 x float > %x2 , %t0
295
- %t2 = fmul <4 x float > %x3 , %t1
293
+ %t0 = fadd reassoc nsz <4 x float > %x0 , %x1
294
+ %t1 = fmul reassoc nsz <4 x float > %x2 , %t0
295
+ %t2 = fmul reassoc nsz <4 x float > %x3 , %t1
296
296
ret <4 x float > %t2
297
297
}
298
298
@@ -312,9 +312,9 @@ define <2 x double> @reassociate_muls_v2f64(<2 x double> %x0, <2 x double> %x1,
312
312
; AVX-NEXT: vmulpd %xmm3, %xmm2, %xmm1
313
313
; AVX-NEXT: vmulpd %xmm1, %xmm0, %xmm0
314
314
; AVX-NEXT: retq
315
- %t0 = fadd <2 x double > %x0 , %x1
316
- %t1 = fmul <2 x double > %x2 , %t0
317
- %t2 = fmul <2 x double > %x3 , %t1
315
+ %t0 = fadd reassoc nsz <2 x double > %x0 , %x1
316
+ %t1 = fmul reassoc nsz <2 x double > %x2 , %t0
317
+ %t2 = fmul reassoc nsz <2 x double > %x3 , %t1
318
318
ret <2 x double > %t2
319
319
}
320
320
@@ -343,9 +343,9 @@ define <8 x float> @reassociate_adds_v8f32(<8 x float> %x0, <8 x float> %x1, <8
343
343
; AVX512-NEXT: vfmadd213ps {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
344
344
; AVX512-NEXT: vaddps %ymm0, %ymm3, %ymm0
345
345
; AVX512-NEXT: retq
346
- %t0 = fmul <8 x float > %x0 , %x1
347
- %t1 = fadd <8 x float > %x2 , %t0
348
- %t2 = fadd <8 x float > %x3 , %t1
346
+ %t0 = fmul reassoc nsz <8 x float > %x0 , %x1
347
+ %t1 = fadd reassoc nsz <8 x float > %x2 , %t0
348
+ %t2 = fadd reassoc nsz <8 x float > %x3 , %t1
349
349
ret <8 x float > %t2
350
350
}
351
351
@@ -374,9 +374,9 @@ define <4 x double> @reassociate_adds_v4f64(<4 x double> %x0, <4 x double> %x1,
374
374
; AVX512-NEXT: vfmadd213pd {{.*#+}} ymm0 = (ymm1 * ymm0) + ymm2
375
375
; AVX512-NEXT: vaddpd %ymm0, %ymm3, %ymm0
376
376
; AVX512-NEXT: retq
377
- %t0 = fmul <4 x double > %x0 , %x1
378
- %t1 = fadd <4 x double > %x2 , %t0
379
- %t2 = fadd <4 x double > %x3 , %t1
377
+ %t0 = fmul reassoc nsz <4 x double > %x0 , %x1
378
+ %t1 = fadd reassoc nsz <4 x double > %x2 , %t0
379
+ %t2 = fadd reassoc nsz <4 x double > %x3 , %t1
380
380
ret <4 x double > %t2
381
381
}
382
382
@@ -399,9 +399,9 @@ define <8 x float> @reassociate_muls_v8f32(<8 x float> %x0, <8 x float> %x1, <8
399
399
; AVX-NEXT: vmulps %ymm3, %ymm2, %ymm1
400
400
; AVX-NEXT: vmulps %ymm1, %ymm0, %ymm0
401
401
; AVX-NEXT: retq
402
- %t0 = fadd <8 x float > %x0 , %x1
403
- %t1 = fmul <8 x float > %x2 , %t0
404
- %t2 = fmul <8 x float > %x3 , %t1
402
+ %t0 = fadd reassoc nsz <8 x float > %x0 , %x1
403
+ %t1 = fmul reassoc nsz <8 x float > %x2 , %t0
404
+ %t2 = fmul reassoc nsz <8 x float > %x3 , %t1
405
405
ret <8 x float > %t2
406
406
}
407
407
@@ -424,9 +424,9 @@ define <4 x double> @reassociate_muls_v4f64(<4 x double> %x0, <4 x double> %x1,
424
424
; AVX-NEXT: vmulpd %ymm3, %ymm2, %ymm1
425
425
; AVX-NEXT: vmulpd %ymm1, %ymm0, %ymm0
426
426
; AVX-NEXT: retq
427
- %t0 = fadd <4 x double > %x0 , %x1
428
- %t1 = fmul <4 x double > %x2 , %t0
429
- %t2 = fmul <4 x double > %x3 , %t1
427
+ %t0 = fadd reassoc nsz <4 x double > %x0 , %x1
428
+ %t1 = fmul reassoc nsz <4 x double > %x2 , %t0
429
+ %t2 = fmul reassoc nsz <4 x double > %x3 , %t1
430
430
ret <4 x double > %t2
431
431
}
432
432
@@ -464,9 +464,9 @@ define <16 x float> @reassociate_adds_v16f32(<16 x float> %x0, <16 x float> %x1,
464
464
; AVX512-NEXT: vfmadd213ps {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
465
465
; AVX512-NEXT: vaddps %zmm0, %zmm3, %zmm0
466
466
; AVX512-NEXT: retq
467
- %t0 = fmul <16 x float > %x0 , %x1
468
- %t1 = fadd <16 x float > %x2 , %t0
469
- %t2 = fadd <16 x float > %x3 , %t1
467
+ %t0 = fmul reassoc nsz <16 x float > %x0 , %x1
468
+ %t1 = fadd reassoc nsz <16 x float > %x2 , %t0
469
+ %t2 = fadd reassoc nsz <16 x float > %x3 , %t1
470
470
ret <16 x float > %t2
471
471
}
472
472
@@ -504,9 +504,9 @@ define <8 x double> @reassociate_adds_v8f64(<8 x double> %x0, <8 x double> %x1,
504
504
; AVX512-NEXT: vfmadd213pd {{.*#+}} zmm0 = (zmm1 * zmm0) + zmm2
505
505
; AVX512-NEXT: vaddpd %zmm0, %zmm3, %zmm0
506
506
; AVX512-NEXT: retq
507
- %t0 = fmul <8 x double > %x0 , %x1
508
- %t1 = fadd <8 x double > %x2 , %t0
509
- %t2 = fadd <8 x double > %x3 , %t1
507
+ %t0 = fmul reassoc nsz <8 x double > %x0 , %x1
508
+ %t1 = fadd reassoc nsz <8 x double > %x2 , %t0
509
+ %t2 = fadd reassoc nsz <8 x double > %x3 , %t1
510
510
ret <8 x double > %t2
511
511
}
512
512
@@ -545,9 +545,9 @@ define <16 x float> @reassociate_muls_v16f32(<16 x float> %x0, <16 x float> %x1,
545
545
; AVX512-NEXT: vmulps %zmm3, %zmm2, %zmm1
546
546
; AVX512-NEXT: vmulps %zmm1, %zmm0, %zmm0
547
547
; AVX512-NEXT: retq
548
- %t0 = fadd <16 x float > %x0 , %x1
549
- %t1 = fmul <16 x float > %x2 , %t0
550
- %t2 = fmul <16 x float > %x3 , %t1
548
+ %t0 = fadd reassoc nsz <16 x float > %x0 , %x1
549
+ %t1 = fmul reassoc nsz <16 x float > %x2 , %t0
550
+ %t2 = fmul reassoc nsz <16 x float > %x3 , %t1
551
551
ret <16 x float > %t2
552
552
}
553
553
@@ -586,9 +586,9 @@ define <8 x double> @reassociate_muls_v8f64(<8 x double> %x0, <8 x double> %x1,
586
586
; AVX512-NEXT: vmulpd %zmm3, %zmm2, %zmm1
587
587
; AVX512-NEXT: vmulpd %zmm1, %zmm0, %zmm0
588
588
; AVX512-NEXT: retq
589
- %t0 = fadd <8 x double > %x0 , %x1
590
- %t1 = fmul <8 x double > %x2 , %t0
591
- %t2 = fmul <8 x double > %x3 , %t1
589
+ %t0 = fadd reassoc nsz <8 x double > %x0 , %x1
590
+ %t1 = fmul reassoc nsz <8 x double > %x2 , %t0
591
+ %t2 = fmul reassoc nsz <8 x double > %x3 , %t1
592
592
ret <8 x double > %t2
593
593
}
594
594
@@ -1114,9 +1114,9 @@ define double @reassociate_adds_from_calls() {
1114
1114
%x1 = call double @bar ()
1115
1115
%x2 = call double @bar ()
1116
1116
%x3 = call double @bar ()
1117
- %t0 = fadd double %x0 , %x1
1118
- %t1 = fadd double %t0 , %x2
1119
- %t2 = fadd double %t1 , %x3
1117
+ %t0 = fadd reassoc nsz double %x0 , %x1
1118
+ %t1 = fadd reassoc nsz double %t0 , %x2
1119
+ %t2 = fadd reassoc nsz double %t1 , %x3
1120
1120
ret double %t2
1121
1121
}
1122
1122
@@ -1165,9 +1165,9 @@ define double @already_reassociated() {
1165
1165
%x1 = call double @bar ()
1166
1166
%x2 = call double @bar ()
1167
1167
%x3 = call double @bar ()
1168
- %t0 = fadd double %x0 , %x1
1169
- %t1 = fadd double %x2 , %x3
1170
- %t2 = fadd double %t0 , %t1
1168
+ %t0 = fadd reassoc nsz double %x0 , %x1
1169
+ %t1 = fadd reassoc nsz double %x2 , %x3
1170
+ %t2 = fadd reassoc nsz double %t0 , %t1
1171
1171
ret double %t2
1172
1172
}
1173
1173
0 commit comments