diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h --- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h +++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h @@ -12,4 +12,12 @@ __attribute__((clang_builtin_alias(__builtin_hlsl_wave_active_count_bits))) uint WaveActiveCountBits(bool bBit); + +__attribute__((clang_builtin_alias(__builtin_acos))) double acos(double In); +__attribute__((clang_builtin_alias(__builtin_acosf))) float acos(float In); +__attribute__((clang_builtin_alias(__builtin_acosl))) long double acos(long double In); +//__attribute__((clang_builtin_alias(__builtin_acosf128))) __float128 acos(__float128 In); + + + #endif //_HLSL_HLSL_INTRINSICS_H_ diff --git a/clang/test/CodeGenHLSL/builtins/acos.hlsl b/clang/test/CodeGenHLSL/builtins/acos.hlsl new file mode 100644 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/acos.hlsl @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s + +double acos_d(double x) +{ + return acos(x); +} + +// CHECK: define noundef double @"?acos_d@@YANN@Z"( +// CHECK: call noundef double @acos(double noundef %0) #2 + +float acos_f(float x) +{ + return acos(x); +} + +// CHECK: define noundef float @"?acos_f@@YAMM@Z"( +// CHECK: call noundef float @acosf(float noundef %0) + +long double acos_ld(long double x) +{ + return acos(x); +} + +// CHECK: define noundef double @"?acos_ld@@YAOO@Z"( +// CHECK: call noundef double @acosl(double noundef %0) + +/* +long long double acos_lld(long long double x) +{ + return acos(x); +} +*/ \ No newline at end of file