| 1 |
/// Test -m[no-]unaligned-access and -m[no-]strict-align options. |
| 2 |
|
| 3 |
// RUN: %clang --target=loongarch64 -mstrict-align -fsyntax-only %s -### 2>&1 | \ |
| 4 |
// RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED |
| 5 |
// RUN: %clang --target=loongarch64 -mno-strict-align -fsyntax-only %s -### 2>&1 | \ |
| 6 |
// RUN: FileCheck %s --check-prefix=CC1-UNALIGNED |
| 7 |
// RUN: %clang --target=loongarch64 -mstrict-align -mno-strict-align -fsyntax-only %s -### 2>&1 | \ |
| 8 |
// RUN: FileCheck %s --check-prefix=CC1-UNALIGNED |
| 9 |
// RUN: %clang --target=loongarch64 -mno-strict-align -mstrict-align -fsyntax-only %s -### 2>&1 | \ |
| 10 |
// RUN: FileCheck %s --check-prefix=CC1-NO-UNALIGNED |
| 11 |
|
| 12 |
// RUN: %clang --target=loongarch64 -mstrict-align -S -emit-llvm %s -o - | \ |
| 13 |
// RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED |
| 14 |
// RUN: %clang --target=loongarch64 -mno-strict-align -S -emit-llvm %s -o - | \ |
| 15 |
// RUN: FileCheck %s --check-prefix=IR-UNALIGNED |
| 16 |
// RUN: %clang --target=loongarch64 -mstrict-align -mno-strict-align -S -emit-llvm %s -o - | \ |
| 17 |
// RUN: FileCheck %s --check-prefix=IR-UNALIGNED |
| 18 |
// RUN: %clang --target=loongarch64 -mno-strict-align -mstrict-align -S -emit-llvm %s -o - | \ |
| 19 |
// RUN: FileCheck %s --check-prefix=IR-NO-UNALIGNED |
| 20 |
|
| 21 |
// RUN: not %clang -### --target=loongarch64 -mno-unaligned-access -munaligned-access %s 2>&1 | \ |
| 22 |
// RUN: FileCheck %s --check-prefix=ERR |
| 23 |
|
| 24 |
// CC1-UNALIGNED: "-target-feature" "+ual" |
| 25 |
// CC1-NO-UNALIGNED: "-target-feature" "-ual" |
| 26 |
|
| 27 |
// IR-UNALIGNED: attributes #[[#]] ={{.*}}"target-features"="{{(.*,)?}}+ual{{(,.*)?}}" |
| 28 |
// IR-NO-UNALIGNED: attributes #[[#]] ={{.*}}"target-features"="{{(.*,)?}}-ual{{(,.*)?}}" |
| 29 |
|
| 30 |
// ERR: error: unsupported option '-mno-unaligned-access' for target 'loongarch64' |
| 31 |
// ERR: error: unsupported option '-munaligned-access' for target 'loongarch64' |
| 32 |
|
| 33 |
int foo(void) { |
| 34 |
return 3; |
| 35 |
} |