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,9 @@ __attribute__((clang_builtin_alias(__builtin_hlsl_wave_active_count_bits))) uint WaveActiveCountBits(bool bBit); + +__attribute__((clang_builtin_alias(__builtin_asin))) double asin(double In); +__attribute__((clang_builtin_alias(__builtin_asinf))) float asin(float In); + + #endif //_HLSL_HLSL_INTRINSICS_H_ diff --git a/clang/test/CodeGenHLSL/builtins/asin.hlsl b/clang/test/CodeGenHLSL/builtins/asin.hlsl new file mode 100644 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/asin.hlsl @@ -0,0 +1,19 @@ +// 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 asin_d(double x) +{ + return asin(x); +} + +// CHECK: define noundef double @"?asin_d@@YANN@Z"( +// CHECK: call noundef double @asin(double noundef %0) #2 + +float asin_f(float x) +{ + return asin(x); +} + +// CHECK: define noundef float @"?asin_f@@YAMM@Z"( +// CHECK: call noundef float @asinf(float noundef %0)