1; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -mcpu=corei7 -mattr=+sse2 -asm-instrumentation=address -asan-instrument-assembly | FileCheck %s
2
3target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
4target triple = "x86_64-unknown-linux-gnu"
5
6; CHECK-LABEL: mov1b
7; CHECK: leaq -128(%rsp), %rsp
8; CHECK-NEXT: pushq %rax
9; CHECK-NEXT: pushq %rdi
10; CHECK-NEXT: pushq %rcx
11; CHECK-NEXT: pushfq
12; CHECK-NEXT: leaq {{.*}}, %rdi
13; CHECK-NEXT: movq %rdi, %rax
14; CHECK-NEXT: shrq $3, %rax
15; CHECK-NEXT: movb 2147450880(%rax), %al
16; CHECK-NEXT: testb %al, %al
17; CHECK-NEXT: je [[A:.*]]
18; CHECK-NEXT: movl %edi, %ecx
19; CHECK-NEXT: andl $7, %ecx
20; CHECK-NEXT: movsbl %al, %eax
21; CHECK-NEXT: cmpl %eax, %ecx
22; CHECK-NEXT: jl {{.*}}
23; CHECK-NEXT: cld
24; CHECK-NEXT: emms
25; CHECK-NEXT: andq $-16, %rsp
26; CHECK-NEXT: callq __asan_report_load1@PLT
27; CHECK-NEXT: [[A]]:
28; CHECK-NEXT: popfq
29; CHECK-NEXT: popq %rcx
30; CHECK-NEXT: popq %rdi
31; CHECK-NEXT: popq %rax
32; CHECK-NEXT: leaq 128(%rsp), %rsp
33
34; CHECK: leaq -128(%rsp), %rsp
35; CHECK: callq __asan_report_store1@PLT
36; CHECK: leaq 128(%rsp), %rsp
37
38; CHECK: movb {{.*}}, {{.*}}
39define void @mov1b(i8* %dst, i8* %src) #0 {
40entry:
41  tail call void asm sideeffect "movb ($1), %al  \0A\09movb %al, ($0)  \0A\09", "r,r,~{memory},~{rax},~{dirflag},~{fpsr},~{flags}"(i8* %dst, i8* %src) #1, !srcloc !0
42  ret void
43}
44
45; CHECK-LABEL: mov2b
46; CHECK: leaq -128(%rsp), %rsp
47; CHECK: leal 1(%ecx), %ecx
48; CHECK: callq __asan_report_load2@PLT
49; CHECK: leaq 128(%rsp), %rsp
50
51; CHECK: leaq -128(%rsp), %rsp
52; CHECK: leal 1(%ecx), %ecx
53; CHECK: callq __asan_report_store2@PLT
54; CHECK: leaq 128(%rsp), %rsp
55
56; CHECK: movw {{.*}}, {{.*}}
57define void @mov2b(i16* %dst, i16* %src) #0 {
58entry:
59  tail call void asm sideeffect "movw ($1), %ax  \0A\09movw %ax, ($0)  \0A\09", "r,r,~{memory},~{rax},~{dirflag},~{fpsr},~{flags}"(i16* %dst, i16* %src) #1, !srcloc !1
60  ret void
61}
62
63; CHECK-LABEL: mov4b
64; CHECK: leaq -128(%rsp), %rsp
65; CHECK: addl $3, %ecx
66; CHECK: callq __asan_report_load4@PLT
67; CHECK: leaq 128(%rsp), %rsp
68
69; CHECK: leaq -128(%rsp), %rsp
70; CHECK: addl $3, %ecx
71; CHECK: callq __asan_report_store4@PLT
72; CHECK: leaq 128(%rsp), %rsp
73
74; CHECK: movl {{.*}}, {{.*}}
75define void @mov4b(i32* %dst, i32* %src) #0 {
76entry:
77  tail call void asm sideeffect "movl ($1), %eax  \0A\09movl %eax, ($0)  \0A\09", "r,r,~{memory},~{rax},~{dirflag},~{fpsr},~{flags}"(i32* %dst, i32* %src) #1, !srcloc !2
78  ret void
79}
80
81; CHECK-LABEL: mov8b
82; CHECK: leaq -128(%rsp), %rsp
83; CHECK-NEXT: pushq %rax
84; CHECK-NEXT: pushq %rdi
85; CHECK-NEXT: pushfq
86; CHECK-NEXT: leaq {{.*}}, %rdi
87; CHECK-NEXT: movq %rdi, %rax
88; CHECK-NEXT: shrq $3, %rax
89; CHECK-NEXT: cmpb $0, 2147450880(%rax)
90; CHECK-NEXT: je [[A:.*]]
91; CHECK-NEXT: cld
92; CHECK-NEXT: emms
93; CHECK-NEXT: andq $-16, %rsp
94; CHECK-NEXT: callq __asan_report_load8@PLT
95; CHECK-NEXT: [[A]]:
96; CHECK-NEXT: popfq
97; CHECK-NEXT: popq %rdi
98; CHECK-NEXT: popq %rax
99; CHECK-NEXT: leaq 128(%rsp), %rsp
100
101; CHECK: leaq -128(%rsp), %rsp
102; CHECK-NEXT: pushq %rax
103; CHECK-NEXT: pushq %rdi
104; CHECK-NEXT: pushfq
105; CHECK-NEXT: leaq {{.*}}, %rdi
106; CHECK-NEXT: movq %rdi, %rax
107; CHECK-NEXT: shrq $3, %rax
108; CHECK-NEXT: cmpb $0, 2147450880(%rax)
109; CHECK-NEXT: je [[A:.*]]
110; CHECK-NEXT: cld
111; CHECK-NEXT: emms
112; CHECK-NEXT: andq $-16, %rsp
113; CHECK-NEXT: callq __asan_report_store8@PLT
114; CHECK-NEXT: [[A]]:
115; CHECK-NEXT: popfq
116; CHECK-NEXT: popq %rdi
117; CHECK-NEXT: popq %rax
118; CHECK-NEXT: leaq 128(%rsp), %rsp
119
120; CHECK: movq {{.*}}, {{.*}}
121define void @mov8b(i64* %dst, i64* %src) #0 {
122entry:
123  tail call void asm sideeffect "movq ($1), %rax  \0A\09movq %rax, ($0)  \0A\09", "r,r,~{memory},~{rax},~{dirflag},~{fpsr},~{flags}"(i64* %dst, i64* %src) #1, !srcloc !3
124  ret void
125}
126
127; CHECK-LABEL: mov16b
128; CHECK: leaq -128(%rsp), %rsp
129; CHECK: cmpw $0, 2147450880(%rax)
130; CHECK: callq __asan_report_load16@PLT
131; CHECK: leaq 128(%rsp), %rsp
132
133; CHECK: leaq -128(%rsp), %rsp
134; CHECK: cmpw $0, 2147450880(%rax)
135; CHECK: callq __asan_report_store16@PLT
136; CHECK: leaq 128(%rsp), %rsp
137
138; CHECK: movaps {{.*}}, {{.*}}
139define void @mov16b(<2 x i64>* %dst, <2 x i64>* %src) #0 {
140entry:
141  tail call void asm sideeffect "movaps ($1), %xmm0  \0A\09movaps %xmm0, ($0)  \0A\09", "r,r,~{memory},~{xmm0},~{dirflag},~{fpsr},~{flags}"(<2 x i64>* %dst, <2 x i64>* %src) #1, !srcloc !4
142  ret void
143}
144
145attributes #0 = { nounwind uwtable sanitize_address "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-frame-pointer-elim-non-leaf"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
146attributes #1 = { nounwind }
147
148!0 = !{i32 98, i32 122, i32 160}
149!1 = !{i32 305, i32 329, i32 367}
150!2 = !{i32 512, i32 537, i32 576}
151!3 = !{i32 721, i32 746, i32 785}
152!4 = !{i32 929, i32 957, i32 999}
153