xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/avx-win64.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mcpu=corei7-avx -mattr=+avx | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; PR11862
3*9880d681SAndroid Build Coastguard Workertarget 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*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-pc-win32"
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; This function has live ymm registers across a win64 call.
7*9880d681SAndroid Build Coastguard Worker; The ymm6-15 registers are still call-clobbered even if xmm6-15 are callee-saved.
8*9880d681SAndroid Build Coastguard Worker; Verify that callee-saved registers are not being used.
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; CHECK: f___vyf
11*9880d681SAndroid Build Coastguard Worker; CHECK: pushq %rbp
12*9880d681SAndroid Build Coastguard Worker; CHECK: vmovmsk
13*9880d681SAndroid Build Coastguard Worker; CHECK: vmovaps %ymm{{.*}}(%r
14*9880d681SAndroid Build Coastguard Worker; CHECK: vmovaps %ymm{{.*}}(%r
15*9880d681SAndroid Build Coastguard Worker; CHECK: call
16*9880d681SAndroid Build Coastguard Worker; Two reloads. It's OK if these get folded.
17*9880d681SAndroid Build Coastguard Worker; CHECK: vmovaps {{.*\(%r.*}}, %ymm
18*9880d681SAndroid Build Coastguard Worker; CHECK: vmovaps {{.*\(%r.*}}, %ymm
19*9880d681SAndroid Build Coastguard Worker; CHECK: blend
20*9880d681SAndroid Build Coastguard Workerdefine <8 x float> @f___vyf(<8 x float> %x, <8 x i32> %__mask) nounwind readnone {
21*9880d681SAndroid Build Coastguard Workerallocas:
22*9880d681SAndroid Build Coastguard Worker  %bincmp = fcmp oeq <8 x float> %x, zeroinitializer
23*9880d681SAndroid Build Coastguard Worker  %val_to_boolvec32 = sext <8 x i1> %bincmp to <8 x i32>
24*9880d681SAndroid Build Coastguard Worker  %"~test" = xor <8 x i32> %val_to_boolvec32, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
25*9880d681SAndroid Build Coastguard Worker  %"internal_mask&function_mask25" = and <8 x i32> %"~test", %__mask
26*9880d681SAndroid Build Coastguard Worker  %floatmask.i46 = bitcast <8 x i32> %"internal_mask&function_mask25" to <8 x float>
27*9880d681SAndroid Build Coastguard Worker  %v.i47 = call i32 @llvm.x86.avx.movmsk.ps.256(<8 x float> %floatmask.i46) nounwind readnone
28*9880d681SAndroid Build Coastguard Worker  %any_mm_cmp27 = icmp eq i32 %v.i47, 0
29*9880d681SAndroid Build Coastguard Worker  br i1 %any_mm_cmp27, label %safe_if_after_false, label %safe_if_run_false
30*9880d681SAndroid Build Coastguard Worker
31*9880d681SAndroid Build Coastguard Workersafe_if_run_false:                                ; preds = %allocas
32*9880d681SAndroid Build Coastguard Worker  %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>
33*9880d681SAndroid Build Coastguard Worker  %calltmp = call <8 x float> @f___vyf(<8 x float> %binop, <8 x i32> %"internal_mask&function_mask25")
34*9880d681SAndroid Build Coastguard Worker  %binop33 = fadd <8 x float> %calltmp, %x
35*9880d681SAndroid Build Coastguard Worker  %mask_as_float.i48 = bitcast <8 x i32> %"~test" to <8 x float>
36*9880d681SAndroid Build Coastguard Worker  %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
37*9880d681SAndroid Build Coastguard Worker  br label %safe_if_after_false
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Workersafe_if_after_false:                              ; preds = %safe_if_run_false, %allocas
40*9880d681SAndroid Build Coastguard Worker  %0 = phi <8 x float> [ %x, %allocas ], [ %blend.i52, %safe_if_run_false ]
41*9880d681SAndroid Build Coastguard Worker  ret <8 x float> %0
42*9880d681SAndroid Build Coastguard Worker}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.x86.avx.movmsk.ps.256(<8 x float>) nounwind readnone
45*9880d681SAndroid Build Coastguard Workerdeclare <8 x float> @llvm.x86.avx.blendv.ps.256(<8 x float>, <8 x float>, <8 x float>) nounwind readnone
46