42 lines · plain
1// RUN: %clang_cc1 %s -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s2// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-pc-win32 | FileCheck %s3 4#pragma OPENCL EXTENSION cl_khr_fp16 : enable5 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 0xH326016}17 18// CHECK-LABEL: @test_inc(half noundef %x)19// CHECK: [[INC:%.*]] = fadd half %x, 0xH3C0020// 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 noundef 0xH3E0034 buf[0] = min( buf2[0], 1.5f );35// CHECK: float noundef 1.500000e+0036 37 const half one = 1.6666;38 buf[1] = min( buf[1], one );39// CHECK: half noundef 0xH3EAB40}41 42