2012-07-10 02:34:21 +08:00
|
|
|
// REQUIRES: arm-registered-target
|
2010-06-08 11:59:28 +08:00
|
|
|
// RUN: %clang_cc1 -Wall -Werror -triple thumbv7-eabi -target-cpu cortex-a8 -O3 -emit-llvm -o - %s | FileCheck %s
|
2010-03-04 03:03:45 +08:00
|
|
|
|
|
|
|
void *f0()
|
|
|
|
{
|
|
|
|
return __builtin_thread_pointer();
|
|
|
|
}
|
2010-06-08 11:59:28 +08:00
|
|
|
|
|
|
|
void f1(char *a, char *b) {
|
|
|
|
__clear_cache(a,b);
|
|
|
|
}
|
|
|
|
|
2010-07-16 08:31:23 +08:00
|
|
|
// CHECK: call {{.*}} @__clear_cache
|
2013-02-23 12:24:36 +08:00
|
|
|
|
|
|
|
void test_eh_return_data_regno()
|
|
|
|
{
|
|
|
|
volatile int res;
|
|
|
|
res = __builtin_eh_return_data_regno(0); // CHECK: store volatile i32 0
|
|
|
|
res = __builtin_eh_return_data_regno(1); // CHECK: store volatile i32 1
|
|
|
|
}
|
2013-10-02 18:00:18 +08:00
|
|
|
|
2014-05-04 10:52:25 +08:00
|
|
|
void yield() {
|
2014-07-03 01:41:27 +08:00
|
|
|
__builtin_yield();
|
2014-05-04 10:52:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: call {{.*}} @llvm.arm.hint(i32 1)
|
|
|
|
|
|
|
|
void wfe() {
|
2014-07-03 01:41:27 +08:00
|
|
|
__builtin_wfe();
|
2014-05-04 10:52:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: call {{.*}} @llvm.arm.hint(i32 2)
|
|
|
|
|
|
|
|
void wfi() {
|
2014-07-03 01:41:27 +08:00
|
|
|
__builtin_wfi();
|
2014-05-04 10:52:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: call {{.*}} @llvm.arm.hint(i32 3)
|
|
|
|
|
|
|
|
void sev() {
|
2014-07-03 01:41:27 +08:00
|
|
|
__builtin_sev();
|
2014-05-04 10:52:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: call {{.*}} @llvm.arm.hint(i32 4)
|
|
|
|
|
2013-10-02 18:00:18 +08:00
|
|
|
void sevl() {
|
2014-07-03 01:41:27 +08:00
|
|
|
__builtin_sevl();
|
2013-10-02 18:00:18 +08:00
|
|
|
}
|
2014-07-03 01:41:27 +08:00
|
|
|
|
2014-04-26 01:25:46 +08:00
|
|
|
// CHECK: call {{.*}} @llvm.arm.hint(i32 5)
|
2013-11-13 05:42:50 +08:00
|
|
|
|
|
|
|
void test_barrier() {
|
|
|
|
__builtin_arm_dmb(1); //CHECK: call {{.*}} @llvm.arm.dmb(i32 1)
|
|
|
|
__builtin_arm_dsb(2); //CHECK: call {{.*}} @llvm.arm.dsb(i32 2)
|
|
|
|
}
|
2014-06-17 05:55:58 +08:00
|
|
|
|
|
|
|
// CHECK: call {{.*}} @llvm.arm.rbit(i32 %a)
|
|
|
|
|
|
|
|
unsigned rbit(unsigned a) {
|
|
|
|
return __builtin_arm_rbit(a);
|
|
|
|
}
|