[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / CodeGenOpenCL / half.cl
blob6ade7e691aa93ad1498fc612844e4a81358b2d6e
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
4 #pragma OPENCL EXTENSION cl_khr_fp16 : enable
7 half test()
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
18 // CHECK-LABEL: @test_inc(half noundef %x)
19 // CHECK: [[INC:%.*]] = fadd half %x, 0xH3C00
20 // CHECK: ret half [[INC]]
21 half test_inc(half x)
23 return ++x;
26 __attribute__((overloadable)) int min(int, int);
27 __attribute__((overloadable)) half min(half, half);
28 __attribute__((overloadable)) float min(float, float);
30 __kernel void foo( __global half* buf, __global float* buf2 )
32 buf[0] = min( buf[0], 1.5h );
33 // CHECK: half noundef 0xH3E00
34 buf[0] = min( buf2[0], 1.5f );
35 // CHECK: float noundef 1.500000e+00
37 const half one = 1.6666;
38 buf[1] = min( buf[1], one );
39 // CHECK: half noundef 0xH3EAB