diff options
author | Florian Hahn <florian.hahn@arm.com> | 2017-06-06 09:26:15 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2017-06-06 09:26:15 +0000 |
commit | 28f03bbcbb1e440fc52f0c2dfbd92f81e5e892c6 (patch) | |
tree | ce95f16ca2467d347cc594603200dace347953b1 /clang/test/CodeGen/arm-target-attr.c | |
parent | b2781fb1865dc23fcbbf3aed0983bf79d3b6ad63 (diff) | |
download | bcm5719-llvm-28f03bbcbb1e440fc52f0c2dfbd92f81e5e892c6.tar.gz bcm5719-llvm-28f03bbcbb1e440fc52f0c2dfbd92f81e5e892c6.zip |
[ARM] Add support for target("arm") and target("thumb").
Summary:
This patch adds support for the target("arm") and target("thumb")
attributes, which can be used to force the compiler to generated ARM or
Thumb code for a function.
In LLVM, ARM or Thumb code generation can be controlled by the
thumb-mode target feature. But GCC already uses target("arm") and
target("thumb"), so we have to substitute "arm" with -thumb-mode and
"thumb" with +thumb-mode.
Reviewers: echristo, pcc, kristof.beyls
Reviewed By: echristo
Subscribers: ahatanak, aemerson, javed.absar, kristof.beyls, cfe-commits
Differential Revision: https://reviews.llvm.org/D33721
llvm-svn: 304781
Diffstat (limited to 'clang/test/CodeGen/arm-target-attr.c')
-rw-r--r-- | clang/test/CodeGen/arm-target-attr.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/clang/test/CodeGen/arm-target-attr.c b/clang/test/CodeGen/arm-target-attr.c new file mode 100644 index 00000000000..42fe8d15aaf --- /dev/null +++ b/clang/test/CodeGen/arm-target-attr.c @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple thumb-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKPOS %s +// RUN: %clang_cc1 -triple arm-apple-darwin -emit-llvm -o - %s | FileCheck --check-prefix CHECKNEG %s + +__attribute__((target("arm"))) void test_target_arm() { + // CHECKPOS: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_arm() [[ARM_ATTRS:#[0-9]+]] +} + +__attribute__((target("thumb"))) void test_target_thumb() { + // CHECKPOS: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] + // CHECKNEG: define void @test_target_thumb() [[THUMB_ATTRS:#[0-9]+]] +} + +// CHECKPOS: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" +// CHECKPOS: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[ARM_ATTRS]] = { {{.*}} "target-features"="{{.*}}+thumb-mode{{.*}}" +// CHECKNEG-NOT: attributes [[THUMB_ATTRS]] = { {{.*}} "target-features"="{{.*}}-thumb-mode{{.*}}" |