1; RUN: llc < %s -mtriple=thumbv7-apple-ios -mattr=+thumb2 | FileCheck %s -check-prefix=ALL -check-prefix=CHECK 2; RUN: llc < %s -mtriple=thumbv7-apple-ios -mattr=+thumb2 -arm-assume-misaligned-load-store | FileCheck %s -check-prefix=ALL -check-prefix=CONSERVATIVE 3 4@X = external global [0 x i32] ; <[0 x i32]*> [#uses=5] 5 6define i32 @t1() { 7; ALL-LABEL: t1: 8; ALL: push {r7, lr} 9; CHECK: ldrd 10; CONSERVATIVE-NOT: ldrd 11; CONSERVATIVE-NOT: ldm 12; ALL: pop {r7, pc} 13 %tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 0) ; <i32> [#uses=1] 14 %tmp3 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 1) ; <i32> [#uses=1] 15 %tmp4 = call i32 @f1( i32 %tmp, i32 %tmp3 ) ; <i32> [#uses=1] 16 ret i32 %tmp4 17} 18 19define i32 @t2() { 20; ALL-LABEL: t2: 21; ALL: push {r7, lr} 22; CHECK: ldm 23; CONSERVATIVE-NOT: ldrd 24; CONSERVATIVE-NOT: ldm 25; ALL: pop {r7, pc} 26 %tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 2) ; <i32> [#uses=1] 27 %tmp3 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 3) ; <i32> [#uses=1] 28 %tmp5 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 4) ; <i32> [#uses=1] 29 %tmp6 = call i32 @f2( i32 %tmp, i32 %tmp3, i32 %tmp5 ) ; <i32> [#uses=1] 30 ret i32 %tmp6 31} 32 33define i32 @t3() { 34; ALL-LABEL: t3: 35; ALL: push {r7, lr} 36; CHECK: ldm 37; CONSERVATIVE-NOT: ldrd 38; CONSERVATIVE-NOT: ldm 39; ALL: pop {r7, pc} 40 %tmp = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 1) ; <i32> [#uses=1] 41 %tmp3 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 2) ; <i32> [#uses=1] 42 %tmp5 = load i32, i32* getelementptr ([0 x i32], [0 x i32]* @X, i32 0, i32 3) ; <i32> [#uses=1] 43 %tmp6 = call i32 @f2( i32 %tmp, i32 %tmp3, i32 %tmp5 ) ; <i32> [#uses=1] 44 ret i32 %tmp6 45} 46 47@g = common global i32* null 48 49define void @t4(i32 %a0, i32 %a1, i32 %a2) { 50; ALL-LABEL: t4: 51; ALL: stm.w sp, {r0, r1, r2} 52; ALL: bl _ext 53; ALL: ldm.w sp, {r0, r1, r2} 54; ALL: bl _f2 55 %arr = alloca [4 x i32], align 4 56 %p0 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i64 0, i64 0 57 %p1 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i64 0, i64 1 58 %p2 = getelementptr inbounds [4 x i32], [4 x i32]* %arr, i64 0, i64 2 59 store i32* %p0, i32** @g, align 8 60 61 store i32 %a0, i32* %p0, align 4 62 store i32 %a1, i32* %p1, align 4 63 store i32 %a2, i32* %p2, align 4 64 call void @ext() 65 66 %v0 = load i32, i32* %p0, align 4 67 %v1 = load i32, i32* %p1, align 4 68 %v2 = load i32, i32* %p2, align 4 69 call i32 @f2(i32 %v0, i32 %v1, i32 %v2) 70 ret void 71} 72 73declare i32 @f1(i32, i32) 74 75declare i32 @f2(i32, i32, i32) 76 77declare void @ext() 78