1// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
2// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-pc-win32 | FileCheck %s
3
4#pragma OPENCL EXTENSION cl_khr_fp16 : enable
5
6
7half test()
8{
9   half x = 0.1f;
10   x+=2.0f;
11   x-=2.0f;
12   half y = x + x;
13   half z = y * 1.0f;
14   return z;
15// CHECK: half 0xH3260
16}
17
18// CHECK-LABEL: @test_inc(half %x)
19// CHECK: [[INC:%.*]] = fadd half %x, 0xH3C00
20// CHECK: ret half [[INC]]
21half test_inc(half x)
22{
23  return ++x;
24}
25
26__attribute__((overloadable)) int min(int, int);
27__attribute__((overloadable)) half min(half, half);
28__attribute__((overloadable)) float min(float, float);
29
30__kernel void foo( __global half* buf, __global float* buf2 )
31{
32    buf[0] = min( buf[0], 1.5h );
33// CHECK: half 0xH3E00
34    buf[0] = min( buf2[0], 1.5f );
35// CHECK: float 1.500000e+00
36
37    const half one = 1.6666;
38    buf[1] = min( buf[1], one );
39// CHECK: half 0xH3EAB
40}
41
42