blob: 9078e4ba533f92e8b223b52b06b6aabcc00385f8 [file] [log] [blame]
Evan Cheng0bf77de2010-04-01 08:25:26 +00001; RUN: llc < %s -mattr=+sse2 -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=SSE2
Evan Cheng0bf77de2010-04-01 08:25:26 +00002; RUN: llc < %s -mattr=-sse -mtriple=i686-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=NOSSE
Evan Cheng3ea97552010-04-01 20:27:45 +00003; RUN: llc < %s -mtriple=x86_64-apple-darwin -mcpu=core2 | FileCheck %s -check-prefix=X86-64
Evan Chengd86323e2008-05-22 21:19:19 +00004
Evan Chengc3b0c342010-04-08 07:37:57 +00005@.str = 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"
6@.str2 = internal constant [30 x i8] c"xxxxxxxxxxxxxxxxxxxxxxxxxxxxx\00", align 4
Evan Chengd86323e2008-05-22 21:19:19 +00007
Evan Cheng255f20f2010-04-01 06:04:33 +00008define void @t1(i32 %argc, i8** %argv) nounwind {
Evan Chengd86323e2008-05-22 21:19:19 +00009entry:
Evan Cheng255f20f2010-04-01 06:04:33 +000010; SSE2: t1:
Evan Chengc3b0c342010-04-08 07:37:57 +000011; SSE2: movaps _.str, %xmm0
Evan Cheng255f20f2010-04-01 06:04:33 +000012; SSE2: movaps %xmm0
13; SSE2: movb $0
14; SSE2: movl $0
15; SSE2: movl $0
16
Evan Cheng255f20f2010-04-01 06:04:33 +000017; NOSSE: t1:
18; NOSSE: movb $0
19; NOSSE: movl $0
20; NOSSE: movl $0
21; NOSSE: movl $0
22; NOSSE: movl $0
23; NOSSE: movl $101
24; NOSSE: movl $1734438249
Evan Cheng3ea97552010-04-01 20:27:45 +000025
26; X86-64: t1:
Evan Chengc3b0c342010-04-08 07:37:57 +000027; X86-64: movaps _.str(%rip), %xmm0
Evan Cheng3ea97552010-04-01 20:27:45 +000028; X86-64: movaps %xmm0
29; X86-64: movb $0
30; X86-64: movq $0
Evan Chengc3b0c342010-04-08 07:37:57 +000031 %tmp1 = alloca [25 x i8]
32 %tmp2 = bitcast [25 x i8]* %tmp1 to i8*
33 call void @llvm.memcpy.i32( i8* %tmp2, i8* getelementptr ([25 x i8]* @.str, i32 0, i32 0), i32 25, i32 1 ) nounwind
34 unreachable
Evan Chengd86323e2008-05-22 21:19:19 +000035}
Evan Cheng255f20f2010-04-01 06:04:33 +000036
37;rdar://7774704
38%struct.s0 = type { [2 x double] }
39
40define void @t2(%struct.s0* nocapture %a, %struct.s0* nocapture %b) nounwind ssp {
41entry:
42; SSE2: t2:
43; SSE2: movaps (%eax), %xmm0
44; SSE2: movaps %xmm0, (%eax)
45
Evan Cheng255f20f2010-04-01 06:04:33 +000046; NOSSE: t2:
47; NOSSE: movl
48; NOSSE: movl
49; NOSSE: movl
50; NOSSE: movl
51; NOSSE: movl
52; NOSSE: movl
53; NOSSE: movl
54; NOSSE: movl
55; NOSSE: movl
56; NOSSE: movl
Evan Cheng3ea97552010-04-01 20:27:45 +000057
58; X86-64: t2:
59; X86-64: movaps (%rsi), %xmm0
60; X86-64: movaps %xmm0, (%rdi)
Evan Cheng255f20f2010-04-01 06:04:33 +000061 %tmp2 = bitcast %struct.s0* %a to i8* ; <i8*> [#uses=1]
62 %tmp3 = bitcast %struct.s0* %b to i8* ; <i8*> [#uses=1]
63 tail call void @llvm.memcpy.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 16)
64 ret void
65}
66
67define void @t3(%struct.s0* nocapture %a, %struct.s0* nocapture %b) nounwind ssp {
68entry:
69; SSE2: t3:
Evan Cheng461f1fc2011-01-06 07:58:36 +000070; SSE2: movups (%eax), %xmm0
71; SSE2: movups %xmm0, (%eax)
Evan Cheng255f20f2010-04-01 06:04:33 +000072
73; NOSSE: t3:
74; NOSSE: movl
75; NOSSE: movl
76; NOSSE: movl
77; NOSSE: movl
78; NOSSE: movl
79; NOSSE: movl
80; NOSSE: movl
81; NOSSE: movl
82; NOSSE: movl
83; NOSSE: movl
Evan Cheng3ea97552010-04-01 20:27:45 +000084
85; X86-64: t3:
Evan Cheng461f1fc2011-01-06 07:58:36 +000086; X86-64: movups (%rsi), %xmm0
87; X86-64: movups %xmm0, (%rdi)
Evan Cheng255f20f2010-04-01 06:04:33 +000088 %tmp2 = bitcast %struct.s0* %a to i8* ; <i8*> [#uses=1]
89 %tmp3 = bitcast %struct.s0* %b to i8* ; <i8*> [#uses=1]
90 tail call void @llvm.memcpy.i32(i8* %tmp2, i8* %tmp3, i32 16, i32 8)
91 ret void
92}
93
Evan Chengc3b0c342010-04-08 07:37:57 +000094define void @t4() nounwind {
95entry:
96; SSE2: t4:
Evan Cheng461f1fc2011-01-06 07:58:36 +000097; SSE2: movups _.str2, %xmm0
98; SSE2: movaps %xmm0, (%esp)
99; SSE2: movw $120, 28(%esp)
Evan Chengc3b0c342010-04-08 07:37:57 +0000100; SSE2: movl $2021161080
101; SSE2: movl $2021161080
102; SSE2: movl $2021161080
Evan Chengc3b0c342010-04-08 07:37:57 +0000103
104; NOSSE: t4:
105; NOSSE: movw $120
106; NOSSE: movl $2021161080
107; NOSSE: movl $2021161080
108; NOSSE: movl $2021161080
109; NOSSE: movl $2021161080
110; NOSSE: movl $2021161080
111; NOSSE: movl $2021161080
112; NOSSE: movl $2021161080
113
114; X86-64: t4:
115; X86-64: movabsq $8680820740569200760, %rax
116; X86-64: movq %rax
Evan Cheng461f1fc2011-01-06 07:58:36 +0000117; X86-64: movups _.str2(%rip), %xmm0
118; X86-64: movaps %xmm0, -40(%rsp)
Evan Chengc3b0c342010-04-08 07:37:57 +0000119; X86-64: movw $120
120; X86-64: movl $2021161080
121 %tmp1 = alloca [30 x i8]
122 %tmp2 = bitcast [30 x i8]* %tmp1 to i8*
123 call void @llvm.memcpy.i32(i8* %tmp2, i8* getelementptr inbounds ([30 x i8]* @.str2, i32 0, i32 0), i32 30, i32 1)
124 unreachable
125}
126
Evan Cheng255f20f2010-04-01 06:04:33 +0000127declare void @llvm.memcpy.i32(i8* nocapture, i8* nocapture, i32, i32) nounwind