Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / loongarch-munaligned-access.c
blob44edb2eb17e6ab603136b1e0db795562194e0693
1 /// Test -m[no-]unaligned-access and -m[no-]strict-align options.
3 // RUN: %clang --target=loongarch64 -munaligned-access -fsyntax-only %s -### 2>&1 | \
4 // RUN: FileCheck %s --check-prefix=CC1-UNALIGNED
5 // RUN: %clang --target=loongarch64 -mno-unaligned-access -fsyntax-only %s -### 2>&1 | \
6 // RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED
7 // RUN: %clang --target=loongarch64 -mstrict-align -fsyntax-only %s -### 2>&1 | \
8 // RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED
9 // RUN: %clang --target=loongarch64 -mno-strict-align -fsyntax-only %s -### 2>&1 | \
10 // RUN: FileCheck %s --check-prefix=CC1-UNALIGNED
11 // RUN: %clang --target=loongarch64 -munaligned-access -mno-unaligned-access -fsyntax-only %s -### 2>&1 | \
12 // RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED
13 // RUN: %clang --target=loongarch64 -mno-unaligned-access -munaligned-access -fsyntax-only %s -### 2>&1 | \
14 // RUN: FileCheck %s --check-prefix=CC1-UNALIGNED
15 // RUN: %clang --target=loongarch64 -mstrict-align -mno-strict-align -fsyntax-only %s -### 2>&1 | \
16 // RUN: FileCheck %s --check-prefix=CC1-UNALIGNED
17 // RUN: %clang --target=loongarch64 -mno-strict-align -mstrict-align -fsyntax-only %s -### 2>&1 | \
18 // RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED
19 // RUN: %clang --target=loongarch64 -munaligned-access -mstrict-align -fsyntax-only %s -### 2>&1 | \
20 // RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED
21 // RUN: %clang --target=loongarch64 -mstrict-align -munaligned-access -fsyntax-only %s -### 2>&1 | \
22 // RUN: FileCheck %s --check-prefix=CC1-UNALIGNED
23 // RUN: %clang --target=loongarch64 -mno-unaligned-access -mno-strict-align -fsyntax-only %s -### 2>&1 | \
24 // RUN: FileCheck %s --check-prefix=CC1-UNALIGNED
25 // RUN: %clang --target=loongarch64 -mno-strict-align -mno-unaligned-access -fsyntax-only %s -### 2>&1 | \
26 // RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED
28 // RUN: %clang --target=loongarch64 -munaligned-access -S -emit-llvm %s -o - | \
29 // RUN: FileCheck %s --check-prefix=IR-UNALIGNED
30 // RUN: %clang --target=loongarch64 -mno-unaligned-access -S -emit-llvm %s -o - | \
31 // RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED
32 // RUN: %clang --target=loongarch64 -mstrict-align -S -emit-llvm %s -o - | \
33 // RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED
34 // RUN: %clang --target=loongarch64 -mno-strict-align -S -emit-llvm %s -o - | \
35 // RUN: FileCheck %s --check-prefix=IR-UNALIGNED
36 // RUN: %clang --target=loongarch64 -munaligned-access -mno-unaligned-access -S -emit-llvm %s -o - | \
37 // RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED
38 // RUN: %clang --target=loongarch64 -mno-unaligned-access -munaligned-access -S -emit-llvm %s -o - | \
39 // RUN: FileCheck %s --check-prefix=IR-UNALIGNED
40 // RUN: %clang --target=loongarch64 -mstrict-align -mno-strict-align -S -emit-llvm %s -o - | \
41 // RUN: FileCheck %s --check-prefix=IR-UNALIGNED
42 // RUN: %clang --target=loongarch64 -mno-strict-align -mstrict-align -S -emit-llvm %s -o - | \
43 // RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED
44 // RUN: %clang --target=loongarch64 -munaligned-access -mstrict-align -S -emit-llvm %s -o - | \
45 // RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED
46 // RUN: %clang --target=loongarch64 -mstrict-align -munaligned-access -S -emit-llvm %s -o - | \
47 // RUN: FileCheck %s --check-prefix=IR-UNALIGNED
48 // RUN: %clang --target=loongarch64 -mno-unaligned-access -mno-strict-align -S -emit-llvm %s -o - | \
49 // RUN: FileCheck %s --check-prefix=IR-UNALIGNED
50 // RUN: %clang --target=loongarch64 -mno-strict-align -mno-unaligned-access -S -emit-llvm %s -o - | \
51 // RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED
53 // CC1-UNALIGNED: "-target-feature" "+ual"
54 // CC1-NO-UNALIGNED: "-target-feature" "-ual"
56 // IR-UNALIGNED: attributes #[[#]] ={{.*}}"target-features"="{{(.*,)?}}+ual{{(,.*)?}}"
57 // IR-NO-UNALIGNED: attributes #[[#]] ={{.*}}"target-features"="{{(.*,)?}}-ual{{(,.*)?}}"
59 int foo(void) {
60 return 3;