2015-09-15 05:35:16 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s
|
2011-10-27 04:41:06 +08:00
|
|
|
|
2011-10-29 04:43:56 +08:00
|
|
|
extern void foo_alias (void) __asm ("foo");
|
|
|
|
inline void foo (void) {
|
2011-10-27 04:41:06 +08:00
|
|
|
return foo_alias ();
|
|
|
|
}
|
2015-06-26 07:50:40 +08:00
|
|
|
extern int abs_alias (int) __asm ("abs");
|
|
|
|
inline __attribute__ ((__always_inline__)) int abs (int x) {
|
|
|
|
return abs_alias(x);
|
2011-10-27 04:41:06 +08:00
|
|
|
}
|
2011-12-19 22:41:01 +08:00
|
|
|
extern char *strrchr_foo (const char *__s, int __c) __asm ("strrchr");
|
|
|
|
extern inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) char * strrchr_foo (const char *__s, int __c) {
|
|
|
|
return __builtin_strrchr (__s, __c);
|
|
|
|
}
|
2015-06-26 07:50:40 +08:00
|
|
|
|
|
|
|
extern inline void __attribute__((always_inline, __gnu_inline__))
|
|
|
|
prefetch(void) {
|
|
|
|
__builtin_prefetch(0, 0, 1);
|
|
|
|
}
|
|
|
|
|
2015-06-30 12:41:18 +08:00
|
|
|
extern inline __attribute__((__always_inline__, __gnu_inline__)) void *memchr(void *__s, int __c, __SIZE_TYPE__ __n) {
|
|
|
|
return __builtin_memchr(__s, __c, __n);
|
|
|
|
}
|
|
|
|
|
2011-10-29 04:43:56 +08:00
|
|
|
void f(void) {
|
|
|
|
foo();
|
2015-09-15 05:35:16 +08:00
|
|
|
abs(0);
|
2011-12-19 22:41:01 +08:00
|
|
|
strrchr_foo("", '.');
|
2015-06-26 07:50:40 +08:00
|
|
|
prefetch();
|
2015-06-30 12:41:18 +08:00
|
|
|
memchr("", '.', 0);
|
2011-10-29 04:43:56 +08:00
|
|
|
}
|
|
|
|
|
2020-02-04 02:09:39 +08:00
|
|
|
// CHECK-LABEL: define void @f()
|
2011-10-29 04:52:18 +08:00
|
|
|
// CHECK: call void @foo()
|
2015-09-15 05:35:16 +08:00
|
|
|
// CHECK: call i32 @abs(i32 0)
|
2015-06-26 07:50:40 +08:00
|
|
|
// CHECK: call i8* @strrchr(
|
Allow prefetching from non-zero address spaces
Summary:
This is useful for targets which have prefetch instructions for non-default address spaces.
<rdar://problem/42662136>
Subscribers: nemanjai, javed.absar, hiraditya, kbarton, jkorous, dexonsmith, cfe-commits, llvm-commits, RKSimon, hfinkel, t.p.northover, craig.topper, anemet
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D65254
llvm-svn: 367032
2019-07-26 00:11:57 +08:00
|
|
|
// CHECK: call void @llvm.prefetch.p0i8(
|
2015-06-30 12:41:18 +08:00
|
|
|
// CHECK: call i8* @memchr(
|
2015-06-26 07:50:40 +08:00
|
|
|
// CHECK: ret void
|
2011-10-27 04:41:06 +08:00
|
|
|
|
2011-10-29 04:43:56 +08:00
|
|
|
// CHECK: declare void @foo()
|
2015-06-26 07:50:40 +08:00
|
|
|
// CHECK: declare i32 @abs(i32
|
2011-12-19 22:41:01 +08:00
|
|
|
// CHECK: declare i8* @strrchr(i8*, i32)
|
2015-06-30 12:41:18 +08:00
|
|
|
// CHECK: declare i8* @memchr(
|
Allow prefetching from non-zero address spaces
Summary:
This is useful for targets which have prefetch instructions for non-default address spaces.
<rdar://problem/42662136>
Subscribers: nemanjai, javed.absar, hiraditya, kbarton, jkorous, dexonsmith, cfe-commits, llvm-commits, RKSimon, hfinkel, t.p.northover, craig.topper, anemet
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D65254
llvm-svn: 367032
2019-07-26 00:11:57 +08:00
|
|
|
// CHECK: declare void @llvm.prefetch.p0i8(
|