Change memcpy/memset/memmove to have dest and source alignments.
[oota-llvm.git] / test / CodeGen / X86 / memset-sse-stack-realignment.ll
1 ; Make sure that we realign the stack. Mingw32 uses 4 byte stack alignment, we
2 ; need 16 bytes for SSE and 32 bytes for AVX.
3
4 ; RUN: llc < %s -mtriple=i386-pc-mingw32 -mcpu=pentium2 | FileCheck %s -check-prefix=NOSSE
5 ; RUN: llc < %s -mtriple=i386-pc-mingw32 -mcpu=pentium3 | FileCheck %s -check-prefix=SSE1
6 ; RUN: llc < %s -mtriple=i386-pc-mingw32 -mcpu=yonah | FileCheck %s -check-prefix=SSE2
7 ; RUN: llc < %s -mtriple=i386-pc-mingw32 -mcpu=corei7-avx | FileCheck %s -check-prefix=AVX1
8 ; RUN: llc < %s -mtriple=i386-pc-mingw32 -mcpu=core-avx2 | FileCheck %s -check-prefix=AVX2
9
10 define void @test1(i32 %t) nounwind {
11   %tmp1210 = alloca i8, i32 32, align 4
12   call void @llvm.memset.p0i8.i64(i8* %tmp1210, i8 0, i64 32, i1 false)
13   %x = alloca i8, i32 %t
14   call void @dummy(i8* %x)
15   ret void
16
17 ; NOSSE-LABEL: test1:
18 ; NOSSE-NOT: and
19 ; NOSSE: movl $0
20
21 ; SSE1-LABEL: test1:
22 ; SSE1: andl $-16
23 ; SSE1: movl %esp, %esi
24 ; SSE1: movaps
25
26 ; SSE2-LABEL: test1:
27 ; SSE2: andl $-16
28 ; SSE2: movl %esp, %esi
29 ; SSE2: movaps
30
31 ; AVX1-LABEL: test1:
32 ; AVX1: andl $-32
33 ; AVX1: movl %esp, %esi
34 ; AVX1: vmovaps %ymm
35
36 ; AVX2-LABEL: test1:
37 ; AVX2: andl $-32
38 ; AVX2: movl %esp, %esi
39 ; AVX2: vmovaps %ymm
40
41 }
42
43 define void @test2(i32 %t) nounwind {
44   %tmp1210 = alloca i8, i32 16, align 4
45   call void @llvm.memset.p0i8.i64(i8* %tmp1210, i8 0, i64 16, i1 false)
46   %x = alloca i8, i32 %t
47   call void @dummy(i8* %x)
48   ret void
49
50 ; NOSSE-LABEL: test2:
51 ; NOSSE-NOT: and
52 ; NOSSE: movl $0
53
54 ; SSE1-LABEL: test2:
55 ; SSE1: andl $-16
56 ; SSE1: movl %esp, %esi
57 ; SSE1: movaps
58
59 ; SSE2-LABEL: test2:
60 ; SSE2: andl $-16
61 ; SSE2: movl %esp, %esi
62 ; SSE2: movaps
63
64 ; AVX1-LABEL: test2:
65 ; AVX1: andl $-16
66 ; AVX1: movl %esp, %esi
67 ; AVX1: vmovaps %xmm
68
69 ; AVX2-LABEL: test2:
70 ; AVX2: andl $-16
71 ; AVX2: movl %esp, %esi
72 ; AVX2: vmovaps %xmm
73 }
74
75 declare void @dummy(i8*)
76
77 declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i1) nounwind