1 ; RUN: llc -mtriple=thumbv6m-eabi -verify-machineinstrs %s -o - | \
2 ; RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECKV6
3 ; RUN: llc -mtriple=thumbv6m-eabi -O=0 -verify-machineinstrs %s -o - | \
4 ; RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECKV6
5 ; RUN: llc -mtriple=thumbv7a-eabi -mattr=-neon -verify-machineinstrs %s -o - | \
6 ; RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECKV7
7 ; RUN: llc -mtriple=armv7a-eabi -mattr=-neon -verify-machineinstrs %s -o - | \
8 ; RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECKV7
10 @d = external global [64 x i32]
11 @s = external global [64 x i32]
13 ; Function Attrs: nounwind
14 define void @t1() #0 {
17 ; CHECKV6: ldr [[LB:r[0-7]]],
18 ; CHECKV6-NEXT: ldr [[SB:r[0-7]]],
19 ; We use '[rl0-9]+' to allow 'r0'..'r12', 'lr'
20 ; CHECKV7: movt [[LB:[rl0-9]+]], :upper16:d
21 ; CHECKV7-NEXT: movt [[SB:[rl0-9]+]], :upper16:s
22 ; CHECK-NEXT: ldm{{(\.w)?}} [[LB]]!,
23 ; CHECK-NEXT: stm{{(\.w)?}} [[SB]]!,
24 ; Think of the monstrosity '{{\[}}[[LB]]]' as '[ [[LB]] ]' without the spaces.
25 ; CHECK-NEXT: ldrb{{(\.w)?}} {{.*}}, {{\[}}[[LB]]]
26 ; CHECK-NEXT: strb{{(\.w)?}} {{.*}}, {{\[}}[[SB]]]
27 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 bitcast ([64 x i32]* @s to i8*), i8* align 4 bitcast ([64 x i32]* @d to i8*), i32 17, i1 false)
31 ; Function Attrs: nounwind
32 define void @t2() #0 {
35 ; CHECKV6: ldr [[LB:r[0-7]]],
36 ; CHECKV6-NEXT: ldr [[SB:r[0-7]]],
37 ; CHECKV6-NEXT: ldm{{(\.w)?}} [[LB]]!,
38 ; CHECKV6-NEXT: stm{{(\.w)?}} [[SB]]!,
39 ; CHECKV6-NEXT: ldrh{{(\.w)?}} {{.*}}, {{\[}}[[LB]]]
40 ; CHECKV6-NEXT: ldrb{{(\.w)?}} {{.*}}, {{\[}}[[LB]], #2]
41 ; CHECKV6-NEXT: strb{{(\.w)?}} {{.*}}, {{\[}}[[SB]], #2]
42 ; CHECKV6-NEXT: strh{{(\.w)?}} {{.*}}, {{\[}}[[SB]]]
43 ; CHECKV7: movt [[LB:[rl0-9]+]], :upper16:d
44 ; CHECKV7-NEXT: movt [[SB:[rl0-9]+]], :upper16:s
45 ; CHECKV7: ldr{{(\.w)?}} {{.*}}, {{\[}}[[LB]], #11]
46 ; CHECKV7-NEXT: str{{(\.w)?}} {{.*}}, {{\[}}[[SB]], #11]
47 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 bitcast ([64 x i32]* @s to i8*), i8* align 4 bitcast ([64 x i32]* @d to i8*), i32 15, i1 false)
52 %struct.T = type { i8, i64, i8 }
54 @copy = external global %struct.T, align 8
55 @etest = external global %struct.T, align 8
58 call void @llvm.memcpy.p0i8.p0i8.i32(
59 i8* align 8 getelementptr inbounds (%struct.T, %struct.T* @copy, i32 0, i32 0),
60 i8* align 8 getelementptr inbounds (%struct.T, %struct.T* @etest, i32 0, i32 0),
62 call void @llvm.memcpy.p0i8.p0i8.i32(
63 i8* align 8 getelementptr inbounds (%struct.T, %struct.T* @copy, i32 0, i32 0),
64 i8* align 8 getelementptr inbounds (%struct.T, %struct.T* @etest, i32 0, i32 0),
69 %struct.S = type { [12 x i32] }
72 define void @test3(%struct.S* %d, %struct.S* %s) #0 {
73 %1 = bitcast %struct.S* %d to i8*
74 %2 = bitcast %struct.S* %s to i8*
75 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %2, i32 48, i1 false)
76 ; 3 ldm/stm pairs in v6; 2 in v7
77 ; CHECK: ldm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST1:{.*}]]
78 ; CHECK: stm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST1]]
79 ; CHECK: ldm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST2:{.*}]]
80 ; CHECK: stm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST2]]
81 ; CHECKV6: ldm {{r[0-7]!?}}, [[REGLIST3:{.*}]]
82 ; CHECKV6: stm {{r[0-7]!?}}, [[REGLIST3]]
85 %arrayidx = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0, i32 1
86 tail call void @g(i32* %arrayidx) #3
92 ; Set "no-frame-pointer-elim" to increase register pressure
93 attributes #0 = { "no-frame-pointer-elim"="true" }
95 ; Function Attrs: nounwind
96 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #1