1 // RUN: %clang -target arm-none-gnueabi -munaligned-access -### %s 2> %t
2 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
4 // RUN: %clang -target arm-none-gnueabi -mstrict-align -munaligned-access -### %s 2> %t
5 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
7 // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -munaligned-access -### %s 2> %t
8 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
10 // RUN: %clang -target armv6-apple-darwin -### %s 2> %t
11 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
13 // RUN: %clang -target armv6-netbsd-eabi -### %s 2> %t
14 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
16 // RUN: %clang -target armv7-unknown-linux -### %s 2> %t
17 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
19 // RUN: %clang -target armv7-unknown-nacl-gnueabihf -### %s 2> %t
20 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
22 // RUN: %clang -target armv7-windows -### %s 2> %t
23 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
25 // RUN: %clang --target=armv6 -### %s 2> %t
26 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
28 // RUN: %clang --target=armv7 -### %s 2> %t
29 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-ARM < %t %s
31 // RUN: %clang -target thumbv6m-none-gnueabi -mcpu=cortex-m0 -### %s 2> %t
32 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
34 // RUN: %clang -target thumb-none-gnueabi -mcpu=cortex-m0 -### %s 2> %t
35 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
37 // RUN: %clang -target thumbv8m.base-none-gnueabi -### %s 2> %t
38 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
40 // RUN: %clang -target armv7em-apple-unknown-macho -mthumb -### %s 2> %t
41 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
43 // RUN: %clang -target armv7em-apple-darwin -mthumb -### %s 2> %t
44 // RUN: FileCheck --check-prefix CHECK-ALIGNED-ARM <%t %s
46 // RUN: %clang --target=aarch64 -munaligned-access -### %s 2> %t
47 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
49 // RUN: %clang --target=aarch64 -mstrict-align -munaligned-access -### %s 2> %t
50 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
52 // RUN: %clang --target=aarch64 -mno-unaligned-access -munaligned-access -### %s 2> %t
53 // RUN: FileCheck --check-prefix=CHECK-UNALIGNED-AARCH64 < %t %s
55 // CHECK-UNALIGNED-ARM-NOT: "-target-feature" "+strict-align"
56 // CHECK-UNALIGNED-AARCH64-NOT: "-target-feature" "+strict-align"
59 // RUN: %clang -target arm-none-gnueabi -mno-unaligned-access -### %s 2> %t
60 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
62 // RUN: %clang -target arm-none-gnueabi -mstrict-align -### %s 2> %t
63 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
65 // RUN: %clang -target arm-none-gnueabi -munaligned-access -mno-unaligned-access -### %s 2> %t
66 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
68 // RUN: %clang -target arm-none-gnueabi -munaligned-access -mstrict-align -### %s 2> %t
69 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
71 // RUN: %clang -target arm-none-gnueabi -### %s 2> %t
72 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
74 // RUN: %clang -target armv5-apple-darwin -### %s 2> %t
75 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
77 // RUN: %clang -target armv5t-netbsd-eabi -### %s 2> %t
78 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
80 // RUN: %clang -target armv6-unknown-linux -### %s 2> %t
81 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
83 // RUN: %clang -target armv6-unknown-nacl-gnueabihf -### %s 2> %t
84 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
86 // RUN: %clang -target armv6m-apple-darwin -### %s 2> %t
87 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
89 // RUN: %clang -target armv6m-netbsd-eabi -### %s 2> %t
90 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-ARM < %t %s
92 // RUN: %clang --target=aarch64 -mno-unaligned-access -### %s 2> %t
93 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
95 // RUN: %clang --target=aarch64 -mstrict-align -### %s 2> %t
96 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
98 // RUN: %clang --target=aarch64 -munaligned-access -mno-unaligned-access -### %s 2> %t
99 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
101 // RUN: %clang --target=aarch64 -munaligned-access -mstrict-align -### %s 2> %t
102 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
104 // RUN: %clang --target=aarch64 -mkernel -mno-unaligned-access -### %s 2> %t
105 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
107 // RUN: %clang -target aarch64-unknown-openbsd -### %s 2> %t
108 // RUN: FileCheck --check-prefix=CHECK-ALIGNED-AARCH64 < %t %s
110 // CHECK-ALIGNED-ARM: "-target-feature" "+strict-align" {{.*}} "-Wunaligned-access"
111 // CHECK-ALIGNED-AARCH64: "-target-feature" "+strict-align" {{.*}} "-Wunaligned-access"
113 // Make sure that v6M cores and v8M Baseline always trigger the unsupported
114 // aligned accesses error for all supported architecture triples.
115 // RUN: not %clang -c -target thumbv6m-none-gnueabi -mcpu=cortex-m0 -munaligned-access %s 2>&1 | \
116 // RUN: FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
117 // RUN: not %clang -c -target thumb-none-gnueabi -mcpu=cortex-m0 -munaligned-access %s 2>&1 | \
118 // RUN: FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
119 // RUN: not %clang -c -target thumbv8m.base-none-gnueabi -munaligned-access %s 2>&1 | \
120 // RUN: FileCheck --check-prefix CHECK-UNALIGN-NOT-SUPPORTED %s
122 // CHECK-UNALIGN-NOT-SUPPORTED: error: the {{.*}} sub-architecture does not support unaligned accesses