1// RUN: %clang_cc1 -triple x86_64-apple-macosx10.11 -emit-llvm -o - %s | FileCheck %s
2
3void use_at_available() {
4  // CHECK: call i32 @__isPlatformVersionAtLeast(i32 1, i32 10, i32 12, i32 0)
5  // CHECK-NEXT: icmp ne
6  if (__builtin_available(macos 10.12, *))
7    ;
8
9  // CHECK: call i32 @__isPlatformVersionAtLeast(i32 1, i32 10, i32 12, i32 0)
10  // CHECK-NEXT: icmp ne
11  if (@available(macos 10.12, *))
12    ;
13
14  // CHECK: call i32 @__isPlatformVersionAtLeast(i32 1, i32 10, i32 12, i32 42)
15  // CHECK-NEXT: icmp ne
16  if (__builtin_available(ios 10, macos 10.12.42, *))
17    ;
18
19  // CHECK-NOT: call i32 @__isPlatformVersionAtLeast
20  // CHECK: br i1 true
21  if (__builtin_available(ios 10, *))
22    ;
23
24  // This check should be folded: our deployment target is 10.11.
25  // CHECK-NOT: call i32 @__isPlatformVersionAtLeast
26  // CHECK: br i1 true
27  if (__builtin_available(macos 10.11, *))
28    ;
29}
30
31// CHECK: declare i32 @__isPlatformVersionAtLeast(i32, i32, i32, i32)
32