xref: /llvm-project/clang/test/CodeGen/arm-target-attr.c (revision ed509fe296375eb7c01d3d9aeec15cc784695210)
1 // RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s
2 // RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s
3 // RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s
4 // RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s
5 
test_target_arm(void)6 __attribute__((target("arm"))) void test_target_arm(void) {
7   // CHECKPOS: define{{.*}} void @test_target_arm() [[ARM_ATTRS:#[0-9]+]]
8   // CHECKNEG: define{{.*}} void @test_target_arm() [[ARM_ATTRS:#[0-9]+]]
9 }
10 
test_target_thumb(void)11 __attribute__((target("thumb"))) void test_target_thumb(void) {
12   // CHECKPOS: define{{.*}} void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]]
13   // CHECKNEG: define{{.*}} void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]]
14 }
15 
16 // CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}"
17 // CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}"
18 // CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}"
19 // CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}"
20