In 64-bit mode, use i64 to lower memcpy / memset instead of f64.
[oota-llvm.git] / test / CodeGen / X86 / memcpy-2.ll
1 ; RUN: llc < %s -mattr=+sse2      -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=SSE2
2 ; RUN: llc < %s -mattr=+sse,-sse2 -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=SSE1
3 ; RUN: llc < %s -mattr=-sse       -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=NOSSE
4 ; RUN: llc < %s                 -mtriple=x86_64-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=X86-64
5
6         %struct.ParmT = type { [25 x i8], i8, i8* }
7 @.str12 = internal constant [25 x i8] c"image\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"              ; <[25 x i8]*> [#uses=1]
8
9 define void @t1(i32 %argc, i8** %argv) nounwind  {
10 entry:
11 ; SSE2: t1:
12 ; SSE2: movaps _.str12, %xmm0
13 ; SSE2: movaps %xmm0
14 ; SSE2: movb $0
15 ; SSE2: movl $0
16 ; SSE2: movl $0
17
18 ; SSE1: t1:
19 ; SSE1: movaps _.str12, %xmm0
20 ; SSE1: movaps %xmm0
21 ; SSE1: movb $0
22 ; SSE1: movl $0
23 ; SSE1: movl $0
24
25 ; NOSSE: t1:
26 ; NOSSE: movb $0
27 ; NOSSE: movl $0
28 ; NOSSE: movl $0
29 ; NOSSE: movl $0
30 ; NOSSE: movl $0
31 ; NOSSE: movl $101
32 ; NOSSE: movl $1734438249
33
34 ; X86-64: t1:
35 ; X86-64: movaps _.str12(%rip), %xmm0
36 ; X86-64: movaps %xmm0
37 ; X86-64: movb $0
38 ; X86-64: movq $0
39         %parms.i = alloca [13 x %struct.ParmT]          ; <[13 x %struct.ParmT]*> [#uses=1]
40         %parms1.i = getelementptr [13 x %struct.ParmT]* %parms.i, i32 0, i32 0, i32 0, i32 0            ; <i8*> [#uses=1]
41         call void @llvm.memcpy.i32( i8* %parms1.i, i8* getelementptr ([25 x i8]* @.str12, i32 0, i32 0), i32 25, i32 1 ) nounwind 
42         unreachable
43 }
44
45 ;rdar://7774704
46 %struct.s0 = type { [2 x double] }
47
48 define void @t2(%struct.s0* nocapture %a, %struct.s0* nocapture %b) nounwind ssp {
49 entry:
50 ; SSE2: t2:
51 ; SSE2: movaps (%eax), %xmm0
52 ; SSE2: movaps %xmm0, (%eax)
53
54 ; SSE1: t2:
55 ; SSE1: movaps (%eax), %xmm0
56 ; SSE1: movaps %xmm0, (%eax)
57
58 ; NOSSE: t2:
59 ; NOSSE: movl
60 ; NOSSE: movl
61 ; NOSSE: movl
62 ; NOSSE: movl
63 ; NOSSE: movl
64 ; NOSSE: movl
65 ; NOSSE: movl
66 ; NOSSE: movl
67 ; NOSSE: movl
68 ; NOSSE: movl
69
70 ; X86-64: t2:
71 ; X86-64: movaps (%rsi), %xmm0
72 ; X86-64: movaps %xmm0, (%rdi)
73   %tmp2 = bitcast %struct.s0* %a to i8*           ; <i8*> [#uses=1]
74   %tmp3 = bitcast %struct.s0* %b to i8*           ; <i8*> [#uses=1]
75   tail call void @llvm.memcpy.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 16)
76   ret void
77 }
78
79 define void @t3(%struct.s0* nocapture %a, %struct.s0* nocapture %b) nounwind ssp {
80 entry:
81 ; SSE2: t3:
82 ; SSE2: movsd (%eax), %xmm0
83 ; SSE2: movsd 8(%eax), %xmm1
84 ; SSE2: movsd %xmm1, 8(%eax)
85 ; SSE2: movsd %xmm0, (%eax)
86
87 ; SSE1: t3:
88 ; SSE1: movl
89 ; SSE1: movl
90 ; SSE1: movl
91 ; SSE1: movl
92 ; SSE1: movl
93 ; SSE1: movl
94 ; SSE1: movl
95 ; SSE1: movl
96 ; SSE1: movl
97 ; SSE1: movl
98
99 ; NOSSE: t3:
100 ; NOSSE: movl
101 ; NOSSE: movl
102 ; NOSSE: movl
103 ; NOSSE: movl
104 ; NOSSE: movl
105 ; NOSSE: movl
106 ; NOSSE: movl
107 ; NOSSE: movl
108 ; NOSSE: movl
109 ; NOSSE: movl
110
111 ; X86-64: t3:
112 ; X86-64: movq (%rsi), %rax
113 ; X86-64: movq 8(%rsi), %rcx
114 ; X86-64: movq %rcx, 8(%rdi)
115 ; X86-64: movq %rax, (%rdi)
116   %tmp2 = bitcast %struct.s0* %a to i8*           ; <i8*> [#uses=1]
117   %tmp3 = bitcast %struct.s0* %b to i8*           ; <i8*> [#uses=1]
118   tail call void @llvm.memcpy.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 8)
119   ret void
120 }
121
122 declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind