Skip to content

Commit 3e52deb

Browse files
committedJun 18, 2018
[x86] regenerate checks and adjust tests
2 of these tests were clearly not doing what the comments said they were doing. The last test was added at rL177933 with no assertions (presumably it used to crash). But either we don't have that problem anymore, or this test is folded sooner, so we don't hit the bug that was fixed by disabling late FP constant creation. Looking at this as part of reviewing D48289. llvm-svn: 334977
1 parent a563843 commit 3e52deb

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed
 
Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,70 @@
1-
; RUN: llc < %s -enable-unsafe-fp-math -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck %s
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2+
; RUN: llc < %s -enable-unsafe-fp-math -mtriple=x86_64-apple-darwin -mcpu=corei7-avx | FileCheck %s
23

34

45
; rdar://13126763
56
; Expression "x + x*x" was mistakenly transformed into "x * 3.0f".
67

78
define float @test1(float %x) {
9+
; CHECK-LABEL: test1:
10+
; CHECK: ## %bb.0:
11+
; CHECK-NEXT: vmulss %xmm0, %xmm0, %xmm1
12+
; CHECK-NEXT: vaddss %xmm0, %xmm1, %xmm0
13+
; CHECK-NEXT: retq
814
%t1 = fmul fast float %x, %x
915
%t2 = fadd fast float %t1, %x
1016
ret float %t2
11-
; CHECK: test1
12-
; CHECK: vaddss
1317
}
1418

1519
; (x + x) + x => x * 3.0
1620
define float @test2(float %x) {
21+
; CHECK-LABEL: test2:
22+
; CHECK: ## %bb.0:
23+
; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
24+
; CHECK-NEXT: retq
1725
%t1 = fadd fast float %x, %x
1826
%t2 = fadd fast float %t1, %x
1927
ret float %t2
20-
; CHECK: .long 1077936128
21-
; CHECK: test2
22-
; CHECK: vmulss LCPI1_0(%rip), %xmm0, %xmm0
2328
}
2429

2530
; x + (x + x) => x * 3.0
2631
define float @test3(float %x) {
32+
; CHECK-LABEL: test3:
33+
; CHECK: ## %bb.0:
34+
; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
35+
; CHECK-NEXT: retq
2736
%t1 = fadd fast float %x, %x
28-
%t2 = fadd fast float %t1, %x
37+
%t2 = fadd fast float %x, %t1
2938
ret float %t2
30-
; CHECK: .long 1077936128
31-
; CHECK: test3
32-
; CHECK: vmulss LCPI2_0(%rip), %xmm0, %xmm0
3339
}
3440

3541
; (y + x) + x != x * 3.0
3642
define float @test4(float %x, float %y) {
43+
; CHECK-LABEL: test4:
44+
; CHECK: ## %bb.0:
45+
; CHECK-NEXT: vaddss %xmm1, %xmm0, %xmm1
46+
; CHECK-NEXT: vaddss %xmm0, %xmm1, %xmm0
47+
; CHECK-NEXT: retq
3748
%t1 = fadd fast float %x, %y
3849
%t2 = fadd fast float %t1, %x
3950
ret float %t2
40-
; CHECK: test4
41-
; CHECK: vaddss
4251
}
4352

4453
; rdar://13445387
45-
; "x + x + x => 3.0 * x" should be disabled after legalization because
54+
; "x + x + x => 3.0 * x" should be disabled after legalization because
4655
; Instruction-Selection doesn't know how to handle "3.0"
47-
;
48-
define float @test5() {
49-
%mul.i.i151 = fmul <4 x float> zeroinitializer, zeroinitializer
50-
%vecext.i8.i152 = extractelement <4 x float> %mul.i.i151, i32 1
51-
%vecext1.i9.i153 = extractelement <4 x float> %mul.i.i151, i32 0
52-
%add.i10.i154 = fadd float %vecext1.i9.i153, %vecext.i8.i152
53-
%vecext.i7.i155 = extractelement <4 x float> %mul.i.i151, i32 2
54-
%add.i.i156 = fadd float %vecext.i7.i155, %add.i10.i154
55-
ret float %add.i.i156
56+
;
57+
define float @test5(<4 x float> %x) {
58+
; CHECK-LABEL: test5:
59+
; CHECK: ## %bb.0:
60+
; CHECK-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
61+
; CHECK-NEXT: retq
62+
%splat = shufflevector <4 x float> %x, <4 x float> undef, <4 x i32> zeroinitializer
63+
%v1 = extractelement <4 x float> %splat, i32 1
64+
%v0 = extractelement <4 x float> %splat, i32 0
65+
%add1 = fadd float %v0, %v1
66+
%v2 = extractelement <4 x float> %splat, i32 2
67+
%add2 = fadd float %v2, %add1
68+
ret float %add2
5669
}
70+

0 commit comments

Comments
 (0)