1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- -mattr=+sse2 | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s --check-prefix=X64
4
5define void @foo(<4 x float>* %P) {
6; X86-LABEL: foo:
7; X86:       # %bb.0:
8; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
9; X86-NEXT:    xorps %xmm0, %xmm0
10; X86-NEXT:    addps (%eax), %xmm0
11; X86-NEXT:    movaps %xmm0, (%eax)
12; X86-NEXT:    retl
13;
14; X64-LABEL: foo:
15; X64:       # %bb.0:
16; X64-NEXT:    xorps %xmm0, %xmm0
17; X64-NEXT:    addps (%rdi), %xmm0
18; X64-NEXT:    movaps %xmm0, (%rdi)
19; X64-NEXT:    retq
20  %T = load <4 x float>, <4 x float>* %P
21  %S = fadd <4 x float> zeroinitializer, %T
22  store <4 x float> %S, <4 x float>* %P
23  ret void
24}
25
26define void @bar(<4 x i32>* %P) {
27; X86-LABEL: bar:
28; X86:       # %bb.0:
29; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
30; X86-NEXT:    pxor %xmm0, %xmm0
31; X86-NEXT:    psubd (%eax), %xmm0
32; X86-NEXT:    movdqa %xmm0, (%eax)
33; X86-NEXT:    retl
34;
35; X64-LABEL: bar:
36; X64:       # %bb.0:
37; X64-NEXT:    pxor %xmm0, %xmm0
38; X64-NEXT:    psubd (%rdi), %xmm0
39; X64-NEXT:    movdqa %xmm0, (%rdi)
40; X64-NEXT:    retq
41  %T = load <4 x i32>, <4 x i32>* %P
42  %S = sub <4 x i32> zeroinitializer, %T
43  store <4 x i32> %S, <4 x i32>* %P
44  ret void
45}
46
47; Without any type hints from operations, we fall back to the smaller xorps.
48; The IR type <4 x i32> is ignored.
49define void @untyped_zero(<4 x i32>* %p) {
50; X86-LABEL: untyped_zero:
51; X86:       # %bb.0: # %entry
52; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
53; X86-NEXT:    xorps %xmm0, %xmm0
54; X86-NEXT:    movaps %xmm0, (%eax)
55; X86-NEXT:    retl
56;
57; X64-LABEL: untyped_zero:
58; X64:       # %bb.0: # %entry
59; X64-NEXT:    xorps %xmm0, %xmm0
60; X64-NEXT:    movaps %xmm0, (%rdi)
61; X64-NEXT:    retq
62entry:
63  store <4 x i32> zeroinitializer, <4 x i32>* %p, align 16
64  ret void
65}
66