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
5 define void @foo(ptr %P) {
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)
16 ; X64-NEXT: xorps %xmm0, %xmm0
17 ; X64-NEXT: addps (%rdi), %xmm0
18 ; X64-NEXT: movaps %xmm0, (%rdi)
20 %T = load <4 x float>, ptr %P
21 %S = fadd <4 x float> zeroinitializer, %T
22 store <4 x float> %S, ptr %P
26 define void @bar(ptr %P) {
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)
37 ; X64-NEXT: pxor %xmm0, %xmm0
38 ; X64-NEXT: psubd (%rdi), %xmm0
39 ; X64-NEXT: movdqa %xmm0, (%rdi)
41 %T = load <4 x i32>, ptr %P
42 %S = sub <4 x i32> zeroinitializer, %T
43 store <4 x i32> %S, ptr %P
47 ; Without any type hints from operations, we fall back to the smaller xorps.
48 ; The IR type <4 x i32> is ignored.
49 define void @untyped_zero(ptr %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)
57 ; X64-LABEL: untyped_zero:
58 ; X64: # %bb.0: # %entry
59 ; X64-NEXT: xorps %xmm0, %xmm0
60 ; X64-NEXT: movaps %xmm0, (%rdi)
63 store <4 x i32> zeroinitializer, ptr %p, align 16