1 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=ARM
2 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=THUMB
3 ; RUN: llc < %s -O0 -mattr=+strict-align -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=ARM-STRICT-ALIGN
4 ; RUN: llc < %s -O0 -mattr=+strict-align -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -verify-machineinstrs | FileCheck %s --check-prefix=THUMB-STRICT-ALIGN
6 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi -verify-machineinstrs | FileCheck %s --check-prefix=ARM
7 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-linux-gnueabi -verify-machineinstrs | FileCheck %s --check-prefix=THUMB
8 ; RUN: llc < %s -O0 -mattr=+strict-align -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi -verify-machineinstrs | FileCheck %s --check-prefix=ARM-STRICT-ALIGN
9 ; RUN: llc < %s -O0 -mattr=+strict-align -relocation-model=dynamic-no-pic -mtriple=thumbv7-linux-gnueabi -verify-machineinstrs | FileCheck %s --check-prefix=THUMB-STRICT-ALIGN
11 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-unknown-nacl -verify-machineinstrs | FileCheck %s --check-prefix=ARM
12 ; RUN: llc < %s -O0 -mattr=+strict-align -relocation-model=dynamic-no-pic -mtriple=armv7-unknown-nacl -verify-machineinstrs | FileCheck %s --check-prefix=ARM-STRICT-ALIGN
14 ; RUN: llc < %s -O0 -mattr=+strict-align -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-unknown-unknown -verify-machineinstrs | FileCheck %s --check-prefix=ARM-STRICT-ALIGN
15 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-unknown-unknown -mattr=+strict-align -verify-machineinstrs | FileCheck %s --check-prefix=THUMB-STRICT-ALIGN
16 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-unknown-unknown -verify-machineinstrs | FileCheck %s --check-prefix=ARM
17 ; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-unknown-unknown -verify-machineinstrs | FileCheck %s --check-prefix=THUMB
18 ; RUN: llc < %s -O0 -relocation-model=dynamic-no-pic -mtriple=armv7-unknown-unknown -mattr=+strict-align -verify-machineinstrs | FileCheck %s --check-prefix=ARM-STRICT-ALIGN
19 ; RUN: llc < %s -O0 -relocation-model=dynamic-no-pic -mtriple=thumbv7-unknown-unknown -mattr=+strict-align -verify-machineinstrs | FileCheck %s --check-prefix=THUMB-STRICT-ALIGN
21 ; Check unaligned stores
22 %struct.anon = type <{ float }>
24 @a = common global ptr null, align 4
26 define void @unaligned_store(float %x, float %y) nounwind {
28 ; ARM: @unaligned_store
29 ; ARM: vmov [[REG:r[0-9]+]], s0
30 ; ARM: str [[REG]], [{{r[0-9]+}}]
32 ; THUMB: @unaligned_store
33 ; THUMB: vmov [[REG:r[0-9]+]], s0
34 ; THUMB: str [[REG]], [{{r[0-9]+}}]
36 %add = fadd float %x, %y
37 %0 = load ptr, ptr @a, align 4
38 store float %add, ptr %0, align 1
42 ; Doublewords require only word-alignment.
44 %struct.anon.0 = type { double }
46 @foo_unpacked = common global %struct.anon.0 zeroinitializer, align 4
48 define void @word_aligned_f64_store(double %a, double %b) nounwind {
50 ; ARM: @word_aligned_f64_store
51 ; THUMB: @word_aligned_f64_store
52 %add = fadd double %a, %b
53 store double %add, ptr @foo_unpacked, align 4
55 ; THUMB: vstr d16, [r0]
59 ; Check unaligned loads of floats
60 %class.TAlignTest = type <{ i16, float }>
62 define zeroext i1 @unaligned_f32_load(ptr %this) nounwind align 2 {
64 ; ARM: @unaligned_f32_load
65 ; THUMB: @unaligned_f32_load
66 %0 = alloca ptr, align 4
67 store ptr %this, ptr %0, align 4
69 %2 = getelementptr inbounds %class.TAlignTest, ptr %1, i32 0, i32 1
70 %3 = load float, ptr %2, align 1
71 %4 = fcmp une float %3, 0.000000e+00
72 ; ARM: ldr r[[R:[0-9]+]], [r0, #2]
73 ; ARM: vmov s0, r[[R]]
74 ; ARM: vcmp.f32 s0, #0
75 ; THUMB: ldr.w r[[R:[0-9]+]], [r0, #2]
76 ; THUMB: vmov s0, r[[R]]
77 ; THUMB: vcmp.f32 s0, #0
81 define void @unaligned_i16_store(i16 %x, ptr %y) nounwind {
83 ; ARM-STRICT-ALIGN: @unaligned_i16_store
84 ; ARM-STRICT-ALIGN: strb
85 ; ARM-STRICT-ALIGN: strb
87 ; THUMB-STRICT-ALIGN: @unaligned_i16_store
88 ; THUMB-STRICT-ALIGN: strb
89 ; THUMB-STRICT-ALIGN: strb
91 store i16 %x, ptr %y, align 1
95 define i16 @unaligned_i16_load(ptr %x) nounwind {
97 ; ARM-STRICT-ALIGN: @unaligned_i16_load
98 ; ARM-STRICT-ALIGN: ldrb
99 ; ARM-STRICT-ALIGN: ldrb
101 ; THUMB-STRICT-ALIGN: @unaligned_i16_load
102 ; THUMB-STRICT-ALIGN: ldrb
103 ; THUMB-STRICT-ALIGN: ldrb
105 %0 = load i16, ptr %x, align 1
109 define void @unaligned_i32_store(i32 %x, ptr %y) nounwind {
111 ; ARM-STRICT-ALIGN: @unaligned_i32_store
112 ; ARM-STRICT-ALIGN: strb
113 ; ARM-STRICT-ALIGN: strb
114 ; ARM-STRICT-ALIGN: strb
115 ; ARM-STRICT-ALIGN: strb
117 ; THUMB-STRICT-ALIGN: @unaligned_i32_store
118 ; THUMB-STRICT-ALIGN: strb
119 ; THUMB-STRICT-ALIGN: strb
120 ; THUMB-STRICT-ALIGN: strb
121 ; THUMB-STRICT-ALIGN: strb
123 store i32 %x, ptr %y, align 1
127 define i32 @unaligned_i32_load(ptr %x) nounwind {
129 ; ARM-STRICT-ALIGN: @unaligned_i32_load
130 ; ARM-STRICT-ALIGN: ldrb
131 ; ARM-STRICT-ALIGN: ldrb
132 ; ARM-STRICT-ALIGN: ldrb
133 ; ARM-STRICT-ALIGN: ldrb
135 ; THUMB-STRICT-ALIGN: @unaligned_i32_load
136 ; THUMB-STRICT-ALIGN: ldrb
137 ; THUMB-STRICT-ALIGN: ldrb
138 ; THUMB-STRICT-ALIGN: ldrb
139 ; THUMB-STRICT-ALIGN: ldrb
141 %0 = load i32, ptr %x, align 1