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 9 10 @d = external global [64 x i32] 11 @s = external global [64 x i32] 12 13 ; Function Attrs: nounwind 14 define void @t1() #0 { 15 entry: 16 ; CHECK-LABEL: t1: 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* bitcast ([64 x i32]* @s to i8*), i8* bitcast ([64 x i32]* @d to i8*), i32 17, i32 4, i1 false) 28 ret void 29 } 30 31 ; Function Attrs: nounwind 32 define void @t2() #0 { 33 entry: 34 ; CHECK-LABEL: t2: 35 ; CHECKV6: ldr [[LB:r[0-7]]], 36 ; CHECKV6-NEXT: ldr [[SB:r[0-7]]], 37 ; CHECKV7: movt [[LB:[rl0-9]+]], :upper16:d 38 ; CHECKV7-NEXT: movt [[SB:[rl0-9]+]], :upper16:s 39 ; CHECK-NEXT: ldm{{(\.w)?}} [[LB]]!, 40 ; CHECK-NEXT: stm{{(\.w)?}} [[SB]]!, 41 ; CHECK-NEXT: ldrh{{(\.w)?}} {{.*}}, {{\[}}[[LB]]] 42 ; CHECK-NEXT: ldrb{{(\.w)?}} {{.*}}, {{\[}}[[LB]], #2] 43 ; CHECK-NEXT: strb{{(\.w)?}} {{.*}}, {{\[}}[[SB]], #2] 44 ; CHECK-NEXT: strh{{(\.w)?}} {{.*}}, {{\[}}[[SB]]] 45 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* bitcast ([64 x i32]* @s to i8*), i8* bitcast ([64 x i32]* @d to i8*), i32 15, i32 4, i1 false) 46 ret void 47 } 48 49 ; PR23768 50 %struct.T = type { i8, i64, i8 } 51 52 @copy = external global %struct.T, align 8 53 @etest = external global %struct.T, align 8 54 55 define void @t3() { 56 call void @llvm.memcpy.p0i8.p0i8.i32( 57 i8* getelementptr inbounds (%struct.T, %struct.T* @copy, i32 0, i32 0), 58 i8* getelementptr inbounds (%struct.T, %struct.T* @etest, i32 0, i32 0), 59 i32 24, i32 8, i1 false) 60 call void @llvm.memcpy.p0i8.p0i8.i32( 61 i8* getelementptr inbounds (%struct.T, %struct.T* @copy, i32 0, i32 0), 62 i8* getelementptr inbounds (%struct.T, %struct.T* @etest, i32 0, i32 0), 63 i32 24, i32 8, i1 false) 64 ret void 65 } 66 67 %struct.S = type { [12 x i32] } 68 69 ; CHECK-LABEL: test3 70 define void @test3(%struct.S* %d, %struct.S* %s) #0 { 71 %1 = bitcast %struct.S* %d to i8* 72 %2 = bitcast %struct.S* %s to i8* 73 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* %1, i8* %2, i32 48, i32 4, i1 false) 74 ; 3 ldm/stm pairs in v6; 2 in v7 75 ; CHECK: ldm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST1:{.*}]] 76 ; CHECK: stm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST1]] 77 ; CHECK: ldm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST2:{.*}]] 78 ; CHECK: stm{{(\.w)?}} {{[rl0-9]+!?}}, [[REGLIST2]] 79 ; CHECKV6: ldm {{r[0-7]!?}}, [[REGLIST3:{.*}]] 80 ; CHECKV6: stm {{r[0-7]!?}}, [[REGLIST3]] 81 ; CHECKV7-NOT: ldm 82 ; CHECKV7-NOT: stm 83 %arrayidx = getelementptr inbounds %struct.S, %struct.S* %s, i32 0, i32 0, i32 1 84 tail call void @g(i32* %arrayidx) #3 85 ret void 86 } 87 88 declare void @g(i32*) 89 90 ; Set "no-frame-pointer-elim" to increase register pressure 91 attributes #0 = { "no-frame-pointer-elim"="true" } 92 93 ; Function Attrs: nounwind 94 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) #1 95