Introduce __builtin_expect() intrinsic support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134761 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/CodeGen/builtin-expect.c b/test/CodeGen/builtin-expect.c
index 88479d9..664c6b6 100644
--- a/test/CodeGen/builtin-expect.c
+++ b/test/CodeGen/builtin-expect.c
@@ -19,3 +19,29 @@
// 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;
+}