mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 21:53:12 +08:00
We previously defaulted to long double, but it's also possible to have a half inc/dec amount, when LangOpts NativeHalfType is set. Currently, that's only true for OpenCL. llvm-svn: 233135
24 lines
386 B
Common Lisp
24 lines
386 B
Common Lisp
// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
|
|
|
|
#pragma OPENCL EXTENSION cl_khr_fp16 : enable
|
|
|
|
|
|
half test()
|
|
{
|
|
half x = 0.1f;
|
|
x+=2.0f;
|
|
x-=2.0f;
|
|
half y = x + x;
|
|
half z = y * 1.0f;
|
|
return z;
|
|
// CHECK: half 0xH3260
|
|
}
|
|
|
|
// CHECK-LABEL: @test_inc(half %x)
|
|
// CHECK: [[INC:%.*]] = fadd half %x, 0xH3C00
|
|
// CHECK: ret half [[INC]]
|
|
half test_inc(half x)
|
|
{
|
|
return ++x;
|
|
}
|