1 ; RUN: llc < %s -mtriple=arm64-eabi -mcpu=cyclone | FileCheck %s
3 %struct.x = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
5 @src = external global %struct.x
6 @dst = external global %struct.x
8 @.str1 = private unnamed_addr constant [31 x i8] c"DHRYSTONE PROGRAM, SOME STRING\00", align 1
9 @.str2 = private unnamed_addr constant [36 x i8] c"DHRYSTONE PROGRAM, SOME STRING BLAH\00", align 1
10 @.str3 = private unnamed_addr constant [24 x i8] c"DHRYSTONE PROGRAM, SOME\00", align 1
11 @.str4 = private unnamed_addr constant [18 x i8] c"DHRYSTONE PROGR \00", align 1
12 @.str5 = private unnamed_addr constant [7 x i8] c"DHRYST\00", align 1
13 @.str6 = private unnamed_addr constant [14 x i8] c"/tmp/rmXXXXXX\00", align 1
14 @spool.splbuf = internal global [512 x i8] zeroinitializer, align 16
19 ; CHECK-DAG: ldur [[REG0:w[0-9]+]], [x[[BASEREG:[0-9]+]], #7]
20 ; CHECK-DAG: stur [[REG0]], [x[[BASEREG2:[0-9]+]], #7]
21 ; CHECK-DAG: ldr [[REG2:x[0-9]+]],
22 ; CHECK-DAG: str [[REG2]],
23 call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 8 getelementptr inbounds (%struct.x, %struct.x* @dst, i32 0, i32 0), i8* align 8 getelementptr inbounds (%struct.x, %struct.x* @src, i32 0, i32 0), i32 11, i1 false)
27 define void @t1(i8* nocapture %C) nounwind {
30 ; CHECK: ldr [[DEST:q[0-9]+]], [x[[BASEREG]]]
31 ; CHECK: ldur [[DEST:q[0-9]+]], [x[[BASEREG:[0-9]+]], #15]
32 ; CHECK: stur [[DEST:q[0-9]+]], [x0, #15]
33 ; CHECK: str [[DEST:q[0-9]+]], [x0]
34 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str1, i64 0, i64 0), i64 31, i1 false)
38 define void @t2(i8* nocapture %C) nounwind {
41 ; CHECK: mov [[REG3:w[0-9]+]]
42 ; CHECK: movk [[REG3]],
43 ; CHECK: str [[REG3]], [x0, #32]
44 ; CHECK: ldp [[DEST1:q[0-9]+]], [[DEST2:q[0-9]+]], [x{{[0-9]+}}]
45 ; CHECK: stp [[DEST1]], [[DEST2]], [x0]
46 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str2, i64 0, i64 0), i64 36, i1 false)
50 define void @t3(i8* nocapture %C) nounwind {
53 ; CHECK: ldr [[DEST:q[0-9]+]], [x[[BASEREG]]]
54 ; CHECK: ldr [[REG4:x[0-9]+]], [x[[BASEREG:[0-9]+]], #16]
55 ; CHECK: str [[REG4]], [x0, #16]
56 ; CHECK: str [[DEST]], [x0]
57 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str3, i64 0, i64 0), i64 24, i1 false)
61 define void @t4(i8* nocapture %C) nounwind {
64 ; CHECK: mov [[REG5:w[0-9]+]], #32
65 ; CHECK: strh [[REG5]], [x0, #16]
66 ; CHECK: ldr [[REG6:q[0-9]+]], [x{{[0-9]+}}]
67 ; CHECK: str [[REG6]], [x0]
68 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str4, i64 0, i64 0), i64 18, i1 false)
72 define void @t5(i8* nocapture %C) nounwind {
75 ; CHECK: mov [[REG7:w[0-9]+]], #21337
76 ; CHECK: movk [[REG7]],
77 ; CHECK: stur [[REG7]], [x0, #3]
78 ; CHECK: mov [[REG8:w[0-9]+]],
79 ; CHECK: movk [[REG8]],
80 ; CHECK: str [[REG8]], [x0]
81 tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* %C, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str5, i64 0, i64 0), i64 7, i1 false)
85 define void @t6() nounwind {
88 ; CHECK-DAG: ldur [[REG9:x[0-9]+]], [x{{[0-9]+}}, #6]
89 ; CHECK-DAG: stur [[REG9]], [x{{[0-9]+}}, #6]
92 call void @llvm.memcpy.p0i8.p0i8.i64(i8* getelementptr inbounds ([512 x i8], [512 x i8]* @spool.splbuf, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str6, i64 0, i64 0), i64 14, i1 false)
96 %struct.Foo = type { i32, i32, i32, i32 }
98 define void @t7(%struct.Foo* nocapture %a, %struct.Foo* nocapture %b) nounwind {
101 ; CHECK: ldr [[REG10:q[0-9]+]], [x1]
102 ; CHECK: str [[REG10]], [x0]
103 %0 = bitcast %struct.Foo* %a to i8*
104 %1 = bitcast %struct.Foo* %b to i8*
105 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %0, i8* align 4 %1, i32 16, i1 false)
109 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture, i32, i1) nounwind
110 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture, i64, i1) nounwind