Introduce a pass to insert vzeroupper instructions to avoid AVX to
[oota-llvm.git] / test / CodeGen / X86 / avx-vzeroupper.ll
1 ; RUN: llc < %s -x86-use-vzeroupper -mtriple=x86_64-apple-darwin -mcpu=corei7-avx -mattr=+avx | FileCheck %s
2
3 define <4 x float> @do_sse_local(<4 x float> %a) nounwind uwtable readnone ssp {
4 entry:
5   %add.i = fadd <4 x float> %a, %a
6   ret <4 x float> %add.i
7 }
8
9 ; CHECK: _test00
10 define <4 x float> @test00(<4 x float> %a, <4 x float> %b) nounwind uwtable ssp {
11 entry:
12   %add.i = fadd <4 x float> %a, %b
13   ; CHECK: vzeroupper
14   ; CHECK-NEXT: callq _do_sse
15   %call3 = tail call <4 x float> @do_sse(<4 x float> %add.i) nounwind
16   %sub.i = fsub <4 x float> %call3, %add.i
17   ; CHECK-NOT: vzeroupper
18   ; CHECK: callq _do_sse_local
19   %call8 = tail call <4 x float> @do_sse_local(<4 x float> %sub.i)
20   ; CHECK: vzeroupper
21   ; CHECK-NEXT: jmp _do_sse
22   %call10 = tail call <4 x float> @do_sse(<4 x float> %call8) nounwind
23   ret <4 x float> %call10
24 }
25
26 declare <4 x float> @do_sse(<4 x float>)