1// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s 2 3int x; 4int y(void); 5void foo(); 6void FUNC() { 7// CHECK: [[call:%.*]] = call i32 @y 8 if (__builtin_expect (x, y())) 9 foo (); 10} 11 12// rdar://9330105 13void isigprocmask(void); 14long bar(); 15 16int main() { 17 (void) __builtin_expect((isigprocmask(), 0), bar()); 18} 19 20// CHECK: call void @isigprocmask() 21// CHECK: [[C:%.*]] = call i64 (...)* @bar() 22 23 24// CHECK: @test1 25int test1(int x) { 26// CHECK: @llvm.expect 27 if (__builtin_expect (x, 1)) 28 return 0; 29 return x; 30} 31 32// CHECK: @test2 33int test2(int x) { 34// CHECK: @llvm.expect 35 switch(__builtin_expect(x, 5)) { 36 default: 37 return 0; 38 case 0: 39 case 1: 40 case 2: 41 return 1; 42 case 5: 43 return 5; 44 }; 45 46 return 0; 47} 48