diff options
author | Jakub Staszak <jstaszak@apple.com> | 2011-07-08 22:45:14 +0000 |
---|---|---|
committer | Jakub Staszak <jstaszak@apple.com> | 2011-07-08 22:45:14 +0000 |
commit | d2cf2cbae9939d2263fce0373f4efa24892da00e (patch) | |
tree | b4986baee4a4aff975ebaf2f5b438c9921168fc6 /clang/test | |
parent | 284b467d9f192a13da17abfc96302cdfab37fb15 (diff) | |
download | bcm5719-llvm-d2cf2cbae9939d2263fce0373f4efa24892da00e.tar.gz bcm5719-llvm-d2cf2cbae9939d2263fce0373f4efa24892da00e.zip |
Introduce __builtin_expect() intrinsic support.
llvm-svn: 134761
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGen/builtin-expect.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtin-expect.c b/clang/test/CodeGen/builtin-expect.c index 88479d90a09..664c6b6a470 100644 --- a/clang/test/CodeGen/builtin-expect.c +++ b/clang/test/CodeGen/builtin-expect.c @@ -19,3 +19,29 @@ int main() { // CHECK: call void @isigprocmask() // CHECK: [[C:%.*]] = call i64 (...)* @bar() + + +// CHECK: @test1 +int test1(int x) { +// CHECK: @llvm.expect + if (__builtin_expect (x, 1)) + return 0; + return x; +} + +// CHECK: @test2 +int test2(int x) { +// CHECK: @llvm.expect + switch(__builtin_expect(x, 5)) { + default: + return 0; + case 0: + case 1: + case 2: + return 1; + case 5: + return 5; + }; + + return 0; +} |