blob: e55183c7f6ae7db6957b62ecf67f5f2b156ccc36 [file] [log] [blame]
Jim Grosbachf7947052012-07-09 18:34:21 +00001// REQUIRES: arm-registered-target
Rafael Espindolaa71d3c62010-06-08 03:59:28 +00002// RUN: %clang_cc1 -Wall -Werror -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o - %s | FileCheck %s
Chris Lattner2752c012010-03-03 19:03:45 +00003
Chris Lattner2752c012010-03-03 19:03:45 +00004void *f0()
5{
6 return __builtin_thread_pointer();
7}
Rafael Espindolaa71d3c62010-06-08 03:59:28 +00008
9void f1(char *a, char *b) {
10 __clear_cache(a,b);
11}
12
Daniel Dunbar10582532010-07-16 00:31:23 +000013// CHECK: call {{.*}} @__clear_cache
Logan Chiena8f7a972013-02-23 04:24:36 +000014
15void test_eh_return_data_regno()
16{
17 volatile int res;
18 res = __builtin_eh_return_data_regno(0); // CHECK: store volatile i32 0
19 res = __builtin_eh_return_data_regno(1); // CHECK: store volatile i32 1
20}
Joey Gouly594e1932013-10-02 10:00:18 +000021
Stephen Hines6bcf27b2014-05-29 04:14:42 -070022void yield() {
Stephen Hinesc568f1e2014-07-21 00:47:37 -070023 __builtin_arm_yield();
Joey Gouly594e1932013-10-02 10:00:18 +000024}
Stephen Hines6bcf27b2014-05-29 04:14:42 -070025
26// CHECK: call {{.*}} @llvm.arm.hint(i32 1)
27
28void wfe() {
Stephen Hinesc568f1e2014-07-21 00:47:37 -070029 __builtin_arm_wfe();
Stephen Hines6bcf27b2014-05-29 04:14:42 -070030}
31
32// CHECK: call {{.*}} @llvm.arm.hint(i32 2)
33
34void wfi() {
Stephen Hinesc568f1e2014-07-21 00:47:37 -070035 __builtin_arm_wfi();
Stephen Hines6bcf27b2014-05-29 04:14:42 -070036}
37
38// CHECK: call {{.*}} @llvm.arm.hint(i32 3)
39
40void sev() {
Stephen Hinesc568f1e2014-07-21 00:47:37 -070041 __builtin_arm_sev();
Stephen Hines6bcf27b2014-05-29 04:14:42 -070042}
43
44// CHECK: call {{.*}} @llvm.arm.hint(i32 4)
45
46void sevl() {
Stephen Hinesc568f1e2014-07-21 00:47:37 -070047 __builtin_arm_sevl();
Stephen Hines6bcf27b2014-05-29 04:14:42 -070048}
Stephen Hinesc568f1e2014-07-21 00:47:37 -070049
Stephen Hines6bcf27b2014-05-29 04:14:42 -070050// CHECK: call {{.*}} @llvm.arm.hint(i32 5)
Weiming Zhao186b26d2013-11-12 21:42:50 +000051
52void test_barrier() {
53 __builtin_arm_dmb(1); //CHECK: call {{.*}} @llvm.arm.dmb(i32 1)
54 __builtin_arm_dsb(2); //CHECK: call {{.*}} @llvm.arm.dsb(i32 2)
Stephen Hinesc568f1e2014-07-21 00:47:37 -070055 __builtin_arm_isb(3); //CHECK: call {{.*}} @llvm.arm.isb(i32 3)
56}
57
58// CHECK: call {{.*}} @llvm.arm.rbit(i32 %a)
59
60unsigned rbit(unsigned a) {
61 return __builtin_arm_rbit(a);
Weiming Zhao186b26d2013-11-12 21:42:50 +000062}