Clang Project

clang_source_code/test/CodeGen/arm-thumb-mode-target-feature.c
1// REQUIRES: arm-registered-target
2
3// RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix THUMB %s
4// RUN: %clang_cc1 -triple thumbv7eb-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix THUMB %s
5// RUN: %clang -target armv7-linux-gnueabihf -mthumb -S -emit-llvm -o - %s | FileCheck --check-prefix THUMB-CLANG %s
6// RUN: %clang_cc1 -triple armv7-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix ARM %s
7// RUN: %clang_cc1 -triple armv7eb-linux-gnueabihf -emit-llvm -o - %s | FileCheck --check-prefix ARM %s
8
9void t1() {}
10
11 __attribute__((target("no-thumb-mode")))
12void t2() {}
13
14 __attribute__((target("thumb-mode")))
15void t3() {}
16
17// THUMB: void @t1() [[ThumbAttr:#[0-7]]]
18// THUMB: void @t2() [[NoThumbAttr:#[0-7]]]
19// THUMB: void @t3() [[ThumbAttr:#[0-7]]]
20// THUMB: attributes [[ThumbAttr]] = { {{.*}} "target-features"="+armv7-a,+thumb-mode"
21// THUMB: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="+armv7-a,-thumb-mode"
22//
23// THUMB-CLANG: void @t1() [[ThumbAttr:#[0-7]]]
24// THUMB-CLANG: void @t2() [[NoThumbAttr:#[0-7]]]
25// THUMB-CLANG: void @t3() [[ThumbAttr:#[0-7]]]
26// THUMB-CLANG: attributes [[ThumbAttr]] = { {{.*}} "target-features"="{{.*}}+thumb-mode
27// THUMB-CLANG: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="{{.*}}-thumb-mode
28
29// ARM: void @t1() [[NoThumbAtr:#[0-7]]]
30// ARM: void @t2() [[NoThumbAttr:#[0-7]]]
31// ARM: void @t3() [[ThumbAttr:#[0-7]]]
32// ARM: attributes [[NoThumbAttr]] = { {{.*}} "target-features"="+armv7-a,-thumb-mode"
33// ARM: attributes [[ThumbAttr]] = { {{.*}} "target-features"="+armv7-a,+thumb-mode"
34