diff options
author | Florian Hahn <florian.hahn@arm.com> | 2017-06-07 11:50:45 +0000 |
---|---|---|
committer | Florian Hahn <florian.hahn@arm.com> | 2017-06-07 11:50:45 +0000 |
commit | cc524bf6ac21bb3943b3c802306e0bfb718eade2 (patch) | |
tree | baa25d7093ad64fa29c9f5aa552e4291c557b6fd /clang/test/CodeGen/arm-thumb-mode-target-feature.c | |
parent | 7c96ba1920cb35e5a5d1cc6df72aecef215aaeac (diff) | |
download | bcm5719-llvm-cc524bf6ac21bb3943b3c802306e0bfb718eade2.tar.gz bcm5719-llvm-cc524bf6ac21bb3943b3c802306e0bfb718eade2.zip |
[CodeGen] Add thumb-mode to target-features for arm/thumb triples.
Summary:
The thumb-mode target feature is used to force Thumb or ARM code
generation on a per-function basis. Explicitly adding +thumb-mode to
functions for thumbxx triples enables mixed ARM/Thumb code generation in
places where compilation units with thumbxx and armxx triples are merged
together (e.g. the IR linker or LTO).
For armxx triples, -thumb-mode is added in a similar fashion.
Reviewers: echristo, t.p.northover, kristof.beyls, rengolin
Reviewed By: echristo
Subscribers: rinon, aemerson, mehdi_amini, javed.absar, cfe-commits
Differential Revision: https://reviews.llvm.org/D33448
llvm-svn: 304897
Diffstat (limited to 'clang/test/CodeGen/arm-thumb-mode-target-feature.c')
-rw-r--r-- | clang/test/CodeGen/arm-thumb-mode-target-feature.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/clang/test/CodeGen/arm-thumb-mode-target-feature.c b/clang/test/CodeGen/arm-thumb-mode-target-feature.c new file mode 100644 index 00000000000..5c41d0b16fd --- /dev/null +++ b/clang/test/CodeGen/arm-thumb-mode-target-feature.c @@ -0,0 +1,33 @@ +// REQUIRES: arm-registered-target + +// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix THUMB %s +// RUN: %clang_cc1 -triple thumbv7eb-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix THUMB %s +// RUN: %clang -target armv7-linux-gnueabihf -mthumb -S -emit-llvm -o - %s | FileCheck --check-prefix THUMB-CLANG %s +// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix ARM %s +// RUN: %clang_cc1 -triple armv7eb-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix ARM %s + +void t1() {} + + __attribute__((target("no-thumb-mode"))) +void t2() {} + + __attribute__((target("thumb-mode"))) +void t3() {} + +// THUMB: void @t1() [[ThumbAttr:#[0-7]]] +// THUMB: void @t2() [[NoThumbAttr:#[0-7]]] +// THUMB: void @t3() [[ThumbAttr:#[0-7]]] +// THUMB: attributes [[ThumbAttr]] = { {{.*}} "target-features"="+thumb-mode" +// THUMB: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="-thumb-mode" +// +// THUMB-CLANG: void @t1() [[ThumbAttr:#[0-7]]] +// THUMB-CLANG: void @t2() [[NoThumbAttr:#[0-7]]] +// THUMB-CLANG: void @t3() [[ThumbAttr:#[0-7]]] +// THUMB-CLANG: attributes [[ThumbAttr]] = { {{.*}} "target-features"="{{.*}}+thumb-mode +// THUMB-CLANG: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="{{.*}}-thumb-mode + +// ARM: void @t1() [[NoThumbAtr:#[0-7]]] +// ARM: void @t2() [[NoThumbAttr:#[0-7]]] +// ARM: void @t3() [[ThumbAttr:#[0-7]]] +// ARM: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="-thumb-mode" +// ARM: attributes [[ThumbAttr]] = { {{.*}} "target-features"="+thumb-mode" |