1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s
4 ; In the following 4 tests, the existing call to VZU/VZA ensures clean state before
5 ; the call to the unknown, so we don't need to insert a second VZU at that point.
7 define <4 x float> @zeroupper_v4f32(ptr%x, <8 x float> %y) nounwind {
8 ; CHECK-LABEL: zeroupper_v4f32:
10 ; CHECK-NEXT: pushq %rbx
11 ; CHECK-NEXT: subq $32, %rsp
12 ; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
13 ; CHECK-NEXT: movq %rdi, %rbx
14 ; CHECK-NEXT: vzeroupper
15 ; CHECK-NEXT: callq the_unknown@PLT
16 ; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
17 ; CHECK-NEXT: vaddps (%rbx), %ymm0, %ymm0
18 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
19 ; CHECK-NEXT: vaddps %xmm1, %xmm0, %xmm0
20 ; CHECK-NEXT: addq $32, %rsp
21 ; CHECK-NEXT: popq %rbx
22 ; CHECK-NEXT: vzeroupper
24 call void @llvm.x86.avx.vzeroupper()
25 call void @the_unknown()
26 %loadx = load <8 x float>, ptr%x, align 32
27 %sum = fadd <8 x float> %loadx, %y
28 %lo = shufflevector <8 x float> %sum, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
29 %hi = shufflevector <8 x float> %sum, <8 x float> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
30 %res = fadd <4 x float> %lo, %hi
34 define <8 x float> @zeroupper_v8f32(<8 x float> %x) nounwind {
35 ; CHECK-LABEL: zeroupper_v8f32:
37 ; CHECK-NEXT: subq $40, %rsp
38 ; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
39 ; CHECK-NEXT: vzeroupper
40 ; CHECK-NEXT: callq the_unknown@PLT
41 ; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
42 ; CHECK-NEXT: addq $40, %rsp
44 call void @llvm.x86.avx.vzeroupper()
45 call void @the_unknown()
49 define <4 x float> @zeroall_v4f32(ptr%x, <8 x float> %y) nounwind {
50 ; CHECK-LABEL: zeroall_v4f32:
52 ; CHECK-NEXT: pushq %rbx
53 ; CHECK-NEXT: subq $32, %rsp
54 ; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
55 ; CHECK-NEXT: movq %rdi, %rbx
56 ; CHECK-NEXT: vzeroall
57 ; CHECK-NEXT: callq the_unknown@PLT
58 ; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
59 ; CHECK-NEXT: vaddps (%rbx), %ymm0, %ymm0
60 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
61 ; CHECK-NEXT: vaddps %xmm1, %xmm0, %xmm0
62 ; CHECK-NEXT: addq $32, %rsp
63 ; CHECK-NEXT: popq %rbx
64 ; CHECK-NEXT: vzeroupper
66 call void @llvm.x86.avx.vzeroall()
67 call void @the_unknown()
68 %loadx = load <8 x float>, ptr%x, align 32
69 %sum = fadd <8 x float> %loadx, %y
70 %lo = shufflevector <8 x float> %sum, <8 x float> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
71 %hi = shufflevector <8 x float> %sum, <8 x float> undef, <4 x i32> <i32 4, i32 5, i32 6, i32 7>
72 %res = fadd <4 x float> %lo, %hi
76 define <8 x float> @zeroall_v8f32(<8 x float> %x) nounwind {
77 ; CHECK-LABEL: zeroall_v8f32:
79 ; CHECK-NEXT: subq $40, %rsp
80 ; CHECK-NEXT: vmovups %ymm0, (%rsp) # 32-byte Spill
81 ; CHECK-NEXT: vzeroall
82 ; CHECK-NEXT: callq the_unknown@PLT
83 ; CHECK-NEXT: vmovups (%rsp), %ymm0 # 32-byte Reload
84 ; CHECK-NEXT: addq $40, %rsp
86 call void @llvm.x86.avx.vzeroall()
87 call void @the_unknown()
91 declare void @llvm.x86.avx.vzeroupper() nounwind readnone
92 declare void @llvm.x86.avx.vzeroall() nounwind readnone
93 declare void @the_unknown() nounwind