1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -O3 -disable-peephole -mtriple=i686-apple-macosx10.9.0 -mcpu=corei7-avx -mattr=+avx | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -O3 -disable-peephole -mtriple=x86_64-apple-macosx10.9.0 -mcpu=corei7-avx -mattr=+avx | FileCheck %s --check-prefix=X64
4
5; Function Attrs: nounwind ssp uwtable
6define void @test1(float* %A, float* %C) #0 {
7; X86-LABEL: test1:
8; X86:       ## %bb.0:
9; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
10; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
11; X86-NEXT:    vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
12; X86-NEXT:    vandps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
13; X86-NEXT:    vmovss %xmm0, (%eax)
14; X86-NEXT:    retl
15;
16; X64-LABEL: test1:
17; X64:       ## %bb.0:
18; X64-NEXT:    vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
19; X64-NEXT:    vandps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
20; X64-NEXT:    vmovss %xmm0, (%rsi)
21; X64-NEXT:    retq
22  %tmp1 = bitcast float* %A to <8 x float>*
23  %tmp2 = load <8 x float>, <8 x float>* %tmp1, align 32
24  %tmp3 = bitcast <8 x float> %tmp2 to <8 x i32>
25  %tmp4 = and <8 x i32> %tmp3, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
26  %tmp5 = bitcast <8 x i32> %tmp4 to <8 x float>
27  %tmp6 = extractelement <8 x float> %tmp5, i32 0
28  store float %tmp6, float* %C
29  ret void
30}
31
32; Function Attrs: nounwind ssp uwtable
33define void @test2(float* %A, float* %C) #0 {
34; X86-LABEL: test2:
35; X86:       ## %bb.0:
36; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
37; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
38; X86-NEXT:    vmovaps (%ecx), %xmm0
39; X86-NEXT:    vorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
40; X86-NEXT:    vmovss %xmm0, (%eax)
41; X86-NEXT:    retl
42;
43; X64-LABEL: test2:
44; X64:       ## %bb.0:
45; X64-NEXT:    vmovaps (%rdi), %xmm0
46; X64-NEXT:    vorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
47; X64-NEXT:    vmovss %xmm0, (%rsi)
48; X64-NEXT:    retq
49  %tmp1 = bitcast float* %A to <8 x float>*
50  %tmp2 = load <8 x float>, <8 x float>* %tmp1, align 32
51  %tmp3 = bitcast <8 x float> %tmp2 to <8 x i32>
52  %tmp4 = or <8 x i32> %tmp3, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
53  %tmp5 = bitcast <8 x i32> %tmp4 to <8 x float>
54  %tmp6 = extractelement <8 x float> %tmp5, i32 0
55  store float %tmp6, float* %C
56  ret void
57}
58
59; Function Attrs: nounwind ssp uwtable
60define void @test3(float* %A, float* %C) #0 {
61; X86-LABEL: test3:
62; X86:       ## %bb.0:
63; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
64; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
65; X86-NEXT:    vmovaps (%ecx), %xmm0
66; X86-NEXT:    vxorps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
67; X86-NEXT:    vmovss %xmm0, (%eax)
68; X86-NEXT:    retl
69;
70; X64-LABEL: test3:
71; X64:       ## %bb.0:
72; X64-NEXT:    vmovaps (%rdi), %xmm0
73; X64-NEXT:    vxorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
74; X64-NEXT:    vmovss %xmm0, (%rsi)
75; X64-NEXT:    retq
76  %tmp1 = bitcast float* %A to <8 x float>*
77  %tmp2 = load <8 x float>, <8 x float>* %tmp1, align 32
78  %tmp3 = bitcast <8 x float> %tmp2 to <8 x i32>
79  %tmp4 = xor <8 x i32> %tmp3, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
80  %tmp5 = bitcast <8 x i32> %tmp4 to <8 x float>
81  %tmp6 = extractelement <8 x float> %tmp5, i32 0
82  store float %tmp6, float* %C
83  ret void
84}
85
86define void @test4(float* %A, float* %C) #0 {
87; X86-LABEL: test4:
88; X86:       ## %bb.0:
89; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
90; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
91; X86-NEXT:    vmovaps (%ecx), %xmm0
92; X86-NEXT:    vandnps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0, %xmm0
93; X86-NEXT:    vmovss %xmm0, (%eax)
94; X86-NEXT:    retl
95;
96; X64-LABEL: test4:
97; X64:       ## %bb.0:
98; X64-NEXT:    vmovaps (%rdi), %xmm0
99; X64-NEXT:    vandnps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
100; X64-NEXT:    vmovss %xmm0, (%rsi)
101; X64-NEXT:    retq
102  %tmp1 = bitcast float* %A to <8 x float>*
103  %tmp2 = load <8 x float>, <8 x float>* %tmp1, align 32
104  %tmp3 = bitcast <8 x float> %tmp2 to <8 x i32>
105  %tmp4 = xor <8 x i32> %tmp3, <i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1, i32 -1>
106  %tmp5 = and <8 x i32> %tmp4, <i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647, i32 2147483647>
107  %tmp6 = bitcast <8 x i32> %tmp5 to <8 x float>
108  %tmp7 = extractelement <8 x float> %tmp6, i32 0
109  store float %tmp7, float * %C
110  ret void
111}
112