diff --git a/clang/lib/Basic/Targets/AMDGPU.cpp b/clang/lib/Basic/Targets/AMDGPU.cpp --- a/clang/lib/Basic/Targets/AMDGPU.cpp +++ b/clang/lib/Basic/Targets/AMDGPU.cpp @@ -245,6 +245,7 @@ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64; CUMode = !(GPUFeatures & llvm::AMDGPU::FEATURE_WGP); ReadOnlyFeatures.insert("image-insts"); + HalfArgsAndReturns = true; } void AMDGPUTargetInfo::adjust(DiagnosticsEngine &Diags, LangOptions &Opts) { diff --git a/clang/test/SemaCUDA/fp16-arg-return.cu b/clang/test/SemaCUDA/fp16-arg-return.cu new file mode 100644 --- /dev/null +++ b/clang/test/SemaCUDA/fp16-arg-return.cu @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -emit-llvm -o - -triple amdgcn-amd-amdhsa -fcuda-is-device -fsyntax-only -verify %s + +// expected-no-diagnostics + +__fp16 testFP16AsArgAndReturn(__fp16 x) { + return x; +}