1; RUN: llc -mcpu=pwr7 < %s | FileCheck %s -check-prefix=PWR7
2; RUN: llc -mcpu=pwr8 < %s | FileCheck %s -check-prefix=PWR8
3; RUN: llc -mcpu=a2q < %s | FileCheck %s -check-prefix=A2Q
4target datalayout = "E-m:e-i64:64-n32:64"
5target triple = "powerpc64-unknown-linux-gnu"
6
7; Function Attrs: nounwind
8define void @foo1(double* nocapture %x, double* nocapture readonly %y) #0 {
9entry:
10  %0 = bitcast double* %x to i8*
11  %1 = bitcast double* %y to i8*
12  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 32, i32 8, i1 false)
13  ret void
14
15; PWR7-LABEL: @foo1
16; PWR7-NOT: bl memcpy
17; PWR7: ld {{[0-9]+}}, {{[0-9]+}}(4)
18; PWR7: std {{[0-9]+}}, {{[0-9]+}}(3)
19; PWR7: blr
20
21; PWR8-LABEL: @foo1
22; PWR8: lxvw4x
23; PWR8: stxvw4x
24; PWR8: blr
25
26; A2Q-LABEL: @foo1
27; A2Q-NOT: bl memcpy
28; A2Q: ld {{[0-9]+}}, {{[0-9]+}}(4)
29; A2Q: std {{[0-9]+}}, {{[0-9]+}}(3)
30; A2Q: blr
31}
32
33; Function Attrs: nounwind
34declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #0
35
36; Function Attrs: nounwind
37define void @foo2(double* nocapture %x, double* nocapture readonly %y) #0 {
38entry:
39  %0 = bitcast double* %x to i8*
40  %1 = bitcast double* %y to i8*
41  tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %0, i8* %1, i64 128, i32 8, i1 false)
42  ret void
43
44; PWR7-LABEL: @foo2
45; PWR7: bl memcpy
46; PWR7: blr
47
48; PWR8-LABEL: @foo2
49; PWR8: lxvw4x
50; PWR8: stxvw4x
51; PWR8: blr
52
53; A2Q-LABEL: @foo2
54; A2Q-NOT: bl memcpy
55; A2Q: ld {{[0-9]+}}, {{[0-9]+}}(4)
56; A2Q: std {{[0-9]+}}, {{[0-9]+}}(3)
57; A2Q: blr
58}
59
60; Function Attrs: nounwind
61define void @bar1(double* nocapture %x) #0 {
62entry:
63  %0 = bitcast double* %x to i8*
64  tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 128, i32 8, i1 false)
65  ret void
66
67; PWR7-LABEL: @bar1
68; PWR7-NOT: bl memset
69; PWR7: stxvw4x
70; PWR7: blr
71
72; PWR8-LABEL: @bar1
73; PWR8-NOT: bl memset
74; PWR8: stxvw4x
75; PWR8: blr
76
77; A2Q-LABEL: @bar1
78; A2Q-NOT: bl memset
79; A2Q: std {{[0-9]+}}, {{[0-9]+}}(3)
80; A2Q: blr
81}
82
83; Function Attrs: nounwind
84define void @bar2(double* nocapture %x) #0 {
85entry:
86  %0 = bitcast double* %x to i8*
87  tail call void @llvm.memset.p0i8.i64(i8* %0, i8 0, i64 128, i32 32, i1 false)
88  ret void
89
90; PWR7-LABEL: @bar2
91; PWR7-NOT: bl memset
92; PWR7: stxvw4x
93; PWR7: blr
94
95; PWR8-LABEL: @bar2
96; PWR8-NOT: bl memset
97; PWR8: stxvw4x
98; PWR8: blr
99
100; A2Q-LABEL: @bar2
101; A2Q-NOT: bl memset
102; A2Q: qvstfdx
103; A2Q: blr
104}
105
106; Function Attrs: nounwind
107declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) #0
108
109attributes #0 = { nounwind }
110
111