Shortened code in shuffle masks
[oota-llvm.git] / test / CodeGen / X86 / avx-win64.ll
1 ; RUN: llc < %s -mcpu=corei7-avx -mattr=+avx | FileCheck %s
2 ; PR11862
3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4 target triple = "x86_64-pc-win32"
5
6 ; This function has live ymm registers across a win64 call.
7 ; The ymm6-15 registers are still call-clobbered even if xmm6-15 are callee-saved.
8 ; Verify that callee-saved registers are not being used.
9
10 ; CHECK: f___vyf
11 ; CHECK: pushq %rbp
12 ; CHECK-NOT: vmovaps{{.*}}(%r
13 ; CHECK: vmovmsk
14 ; CHECK: vmovaps %ymm{{.*}}(%r
15 ; CHECK: vmovaps %ymm{{.*}}(%r
16 ; CHECK: call
17 ; Two reloads. It's OK if these get folded.
18 ; CHECK: vmovaps {{.*\(%r.*}}, %ymm
19 ; CHECK: vmovaps {{.*\(%r.*}}, %ymm
20 ; CHECK: blend
21 define <8 x float> @f___vyf(<8 x float> %x, <8 x i32> %__mask) nounwind readnone {
22 allocas:
23   %bincmp = fcmp oeq <8 x float> %x, zeroinitializer
24   %val_to_boolvec32 = sext <8 x i1> %bincmp to <8 x i32>
25   %"~test" = xor <8 x i32> %val_to_boolvec32, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
26   %"internal_mask&function_mask25" = and <8 x i32> %"~test", %__mask
27   %floatmask.i46 = bitcast <8 x i32> %"internal_mask&function_mask25" to <8 x float>
28   %v.i47 = call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %floatmask.i46) nounwind readnone
29   %any_mm_cmp27 = icmp eq i32 %v.i47, 0
30   br i1 %any_mm_cmp27, label %safe_if_after_false, label %safe_if_run_false
31
32 safe_if_run_false:                                ; preds = %allocas
33   %binop = fadd <8 x float> %x, <float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00, float -1.000000e+00>
34   %calltmp = call <8 x float> @f___vyf(<8 x float> %binop, <8 x i32> %"internal_mask&function_mask25")
35   %binop33 = fadd <8 x float> %calltmp, %x
36   %mask_as_float.i48 = bitcast <8 x i32> %"~test" to <8 x float>
37   %blend.i52 = call <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float> %x, <8 x float> %binop33, <8 x float> %mask_as_float.i48) nounwind
38   br label %safe_if_after_false
39
40 safe_if_after_false:                              ; preds = %safe_if_run_false, %allocas
41   %0 = phi <8 x float> [ %x, %allocas ], [ %blend.i52, %safe_if_run_false ]
42   ret <8 x float> %0
43 }
44
45 declare i32 @llvm.x86.avx.movmsk.ps.256(<8 x float>) nounwind readnone
46 declare <8 x float> @llvm.x86.avx.maskload.ps.256(i8*, <8 x float>) nounwind readonly
47 declare void @llvm.x86.avx.maskstore.ps.256(i8*, <8 x float>, <8 x float>) nounwind
48 declare <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>, <8 x float>, <8 x float>) nounwind readnone