1 ; RUN: llc < %s -mtriple=thumbv6m-eabi -verify-machineinstrs -o - | FileCheck %s
2 target datalayout = "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-v128:64:128-a:0:32-n32-S64"
3 target triple = "thumbv6m-none--eabi"
5 @a = external global i32*
6 @b = external global i32*
8 ; Function Attrs: nounwind
9 define void @foo24() #0 {
12 ; CHECK: ldr r[[LB:[0-9]]], .LCPI
13 ; CHECK: adds r[[NLB:[0-9]]], r[[LB]], #4
14 ; CHECK: ldr r[[SB:[0-9]]], .LCPI
15 ; CHECK: adds r[[NSB:[0-9]]], r[[SB]], #4
16 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]]}
17 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]]}
18 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]]}
19 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]]}
20 %0 = load i32*, i32** @a, align 4
21 %arrayidx = getelementptr inbounds i32, i32* %0, i32 1
22 %1 = bitcast i32* %arrayidx to i8*
23 %2 = load i32*, i32** @b, align 4
24 %arrayidx1 = getelementptr inbounds i32, i32* %2, i32 1
25 %3 = bitcast i32* %arrayidx1 to i8*
26 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %3, i32 24, i1 false)
30 define void @foo28() #0 {
33 ; CHECK: ldr r[[LB:[0-9]]], .LCPI
34 ; CHECK: adds r[[NLB:[0-9]]], r[[LB]], #4
35 ; CHECK: ldr r[[SB:[0-9]]], .LCPI
36 ; CHECK: adds r[[NSB:[0-9]]], r[[SB]], #4
37 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]]}
38 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]]}
39 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]], r[[R4:[0-9]]]}
40 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]], r[[R4]]}
41 %0 = load i32*, i32** @a, align 4
42 %arrayidx = getelementptr inbounds i32, i32* %0, i32 1
43 %1 = bitcast i32* %arrayidx to i8*
44 %2 = load i32*, i32** @b, align 4
45 %arrayidx1 = getelementptr inbounds i32, i32* %2, i32 1
46 %3 = bitcast i32* %arrayidx1 to i8*
47 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %3, i32 28, i1 false)
51 define void @foo32() #0 {
54 ; CHECK: ldr r[[LB:[0-9]]], .LCPI
55 ; CHECK: adds r[[NLB:[0-9]]], r[[LB]], #4
56 ; CHECK: ldr r[[SB:[0-9]]], .LCPI
57 ; CHECK: adds r[[NSB:[0-9]]], r[[SB]], #4
58 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]], r[[R4:[0-9]]]}
59 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]], r[[R4]]}
60 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]], r[[R4:[0-9]]]}
61 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]], r[[R4]]}
62 %0 = load i32*, i32** @a, align 4
63 %arrayidx = getelementptr inbounds i32, i32* %0, i32 1
64 %1 = bitcast i32* %arrayidx to i8*
65 %2 = load i32*, i32** @b, align 4
66 %arrayidx1 = getelementptr inbounds i32, i32* %2, i32 1
67 %3 = bitcast i32* %arrayidx1 to i8*
68 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %3, i32 32, i1 false)
72 define void @foo36() #0 {
75 ; CHECK: ldr r[[LB:[0-9]]], .LCPI
76 ; CHECK: adds r[[NLB:[0-9]]], r[[LB]], #4
77 ; CHECK: ldr r[[SB:[0-9]]], .LCPI
78 ; CHECK: adds r[[NSB:[0-9]]], r[[SB]], #4
79 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]]}
80 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]]}
81 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]]}
82 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]]}
83 ; CHECK-NEXT: ldm r[[NLB]]!, {r[[R1:[0-9]]], r[[R2:[0-9]]], r[[R3:[0-9]]]}
84 ; CHECK-NEXT: stm r[[NSB]]!, {r[[R1]], r[[R2]], r[[R3]]}
85 %0 = load i32*, i32** @a, align 4
86 %arrayidx = getelementptr inbounds i32, i32* %0, i32 1
87 %1 = bitcast i32* %arrayidx to i8*
88 %2 = load i32*, i32** @b, align 4
89 %arrayidx1 = getelementptr inbounds i32, i32* %2, i32 1
90 %3 = bitcast i32* %arrayidx1 to i8*
91 tail call void @llvm.memcpy.p0i8.p0i8.i32(i8* align 4 %1, i8* align 4 %3, i32 36, i1 false)
95 ; Function Attrs: nounwind
96 declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i1) #1