[clang] [clang][HLSL] Add radians intrinsic (PR #110802)

Adam Yang via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 2 17:19:43 PDT 2024


https://github.com/adam-yang updated https://github.com/llvm/llvm-project/pull/110802

>From 08f0b8a10f3e5292fe2f91946392141c9239ec2c Mon Sep 17 00:00:00 2001
From: Adam Yang <hanbyang at microsoft.com>
Date: Wed, 2 Oct 2024 01:21:19 -0700
Subject: [PATCH 1/4] Added radians to clang

---
 clang/include/clang/Basic/Builtins.td         |  6 +++
 clang/lib/CodeGen/CGBuiltin.cpp               |  8 +++
 clang/lib/CodeGen/CGHLSLRuntime.h             |  1 +
 clang/lib/Headers/hlsl/hlsl_intrinsics.h      | 30 +++++++++++
 clang/lib/Sema/SemaHLSL.cpp                   |  1 +
 clang/test/CodeGenHLSL/builtins/radians.hlsl  | 54 +++++++++++++++++++
 .../SemaHLSL/BuiltIns/radians-errors.hlsl     | 27 ++++++++++
 7 files changed, 127 insertions(+)
 create mode 100644 clang/test/CodeGenHLSL/builtins/radians.hlsl
 create mode 100644 clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl

diff --git a/clang/include/clang/Basic/Builtins.td b/clang/include/clang/Basic/Builtins.td
index 5b504666365b32..38064e32a3f655 100644
--- a/clang/include/clang/Basic/Builtins.td
+++ b/clang/include/clang/Basic/Builtins.td
@@ -4818,6 +4818,12 @@ def HLSLStep: LangBuiltin<"HLSL_LANG"> {
   let Prototype = "void(...)";
 }
 
+def HLSLRadians : LangBuiltin<"HLSL_LANG"> {
+  let Spellings = ["__builtin_hlsl_elementwise_radians"];
+  let Attributes = [NoThrow, Const];
+  let Prototype = "void(...)";
+}
+
 // Builtins for XRay.
 def XRayCustomEvent : Builtin {
   let Spellings = ["__xray_customevent"];
diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index c864714182e019..02de763ecd3f52 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -18877,6 +18877,14 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
         retType, CGM.getHLSLRuntime().getSignIntrinsic(),
         ArrayRef<Value *>{Op0}, nullptr, "hlsl.sign");
   }
+  case Builtin::BI__builtin_hlsl_elementwise_radians: {
+    Value *Op0 = EmitScalarExpr(E->getArg(0));
+    if (!E->getArg(0)->getType()->hasFloatingRepresentation())
+      llvm_unreachable("radians operand must have a float representation");
+    return Builder.CreateIntrinsic(
+        /*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getRadiansIntrinsic(),
+        ArrayRef<Value *>{Op0}, nullptr, "hlsl.radians");
+  }
   }
   return nullptr;
 }
diff --git a/clang/lib/CodeGen/CGHLSLRuntime.h b/clang/lib/CodeGen/CGHLSLRuntime.h
index a8aabca7348ffb..c807a3216ec9ee 100644
--- a/clang/lib/CodeGen/CGHLSLRuntime.h
+++ b/clang/lib/CodeGen/CGHLSLRuntime.h
@@ -82,6 +82,7 @@ class CGHLSLRuntime {
   GENERATE_HLSL_INTRINSIC_FUNCTION(Saturate, saturate)
   GENERATE_HLSL_INTRINSIC_FUNCTION(Sign, sign)
   GENERATE_HLSL_INTRINSIC_FUNCTION(Step, step)
+  GENERATE_HLSL_INTRINSIC_FUNCTION(Radians, radians)
   GENERATE_HLSL_INTRINSIC_FUNCTION(ThreadId, thread_id)
   GENERATE_HLSL_INTRINSIC_FUNCTION(FDot, fdot)
   GENERATE_HLSL_INTRINSIC_FUNCTION(SDot, sdot)
diff --git a/clang/lib/Headers/hlsl/hlsl_intrinsics.h b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
index d28f204e352de5..6393a16bc423c0 100644
--- a/clang/lib/Headers/hlsl/hlsl_intrinsics.h
+++ b/clang/lib/Headers/hlsl/hlsl_intrinsics.h
@@ -2116,5 +2116,35 @@ _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_sign)
 int3 sign(double3);
 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_sign)
 int4 sign(double4);
+
+//===----------------------------------------------------------------------===//
+// radians builtins
+//===----------------------------------------------------------------------===//
+
+/// \fn T radians(T Val)
+/// \brief Converts the specified value from degrees to radians.
+
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+half radians(half);
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+half2 radians(half2);
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+half3 radians(half3);
+_HLSL_16BIT_AVAILABILITY(shadermodel, 6.2)
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+half4 radians(half4);
+
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+float radians(float);
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+float2 radians(float2);
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+float3 radians(float3);
+_HLSL_BUILTIN_ALIAS(__builtin_hlsl_elementwise_radians)
+float4 radians(float4);
+
 } // namespace hlsl
 #endif //_HLSL_HLSL_INTRINSICS_H_
diff --git a/clang/lib/Sema/SemaHLSL.cpp b/clang/lib/Sema/SemaHLSL.cpp
index 5eda22f560c9d2..ef2721221a4e21 100644
--- a/clang/lib/Sema/SemaHLSL.cpp
+++ b/clang/lib/Sema/SemaHLSL.cpp
@@ -1861,6 +1861,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
       return true;
     break;
   }
+  case Builtin::BI__builtin_hlsl_elementwise_radians:
   case Builtin::BI__builtin_hlsl_elementwise_rsqrt:
   case Builtin::BI__builtin_hlsl_elementwise_frac: {
     if (CheckFloatOrHalfRepresentations(&SemaRef, TheCall))
diff --git a/clang/test/CodeGenHLSL/builtins/radians.hlsl b/clang/test/CodeGenHLSL/builtins/radians.hlsl
new file mode 100644
index 00000000000000..1c72281abb3af3
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/radians.hlsl
@@ -0,0 +1,54 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   dxil-pc-shadermodel6.3-library %s -fnative-half-type \
+// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ 
+// RUN:   --check-prefixes=CHECK,NATIVE_HALF
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
+// RUN:   -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
+
+// NATIVE_HALF: define noundef half @
+// NATIVE_HALF: %{{.*}} = call half @llvm.dx.radians.f16(
+// NATIVE_HALF: ret half %{{.*}}
+// NO_HALF: define noundef float @"?test_radians_half@@YA$halff@$halff@@Z"(
+// NO_HALF: %{{.*}} = call float @llvm.dx.radians.f32(
+// NO_HALF: ret float %{{.*}}
+half test_radians_half(half p0) { return radians(p0); }
+// NATIVE_HALF: define noundef <2 x half> @
+// NATIVE_HALF: %{{.*}} = call <2 x half> @llvm.dx.radians.v2f16
+// NATIVE_HALF: ret <2 x half> %{{.*}}
+// NO_HALF: define noundef <2 x float> @
+// NO_HALF: %{{.*}} = call <2 x float> @llvm.dx.radians.v2f32(
+// NO_HALF: ret <2 x float> %{{.*}}
+half2 test_radians_half2(half2 p0) { return radians(p0); }
+// NATIVE_HALF: define noundef <3 x half> @
+// NATIVE_HALF: %{{.*}} = call <3 x half> @llvm.dx.radians.v3f16
+// NATIVE_HALF: ret <3 x half> %{{.*}}
+// NO_HALF: define noundef <3 x float> @
+// NO_HALF: %{{.*}} = call <3 x float> @llvm.dx.radians.v3f32(
+// NO_HALF: ret <3 x float> %{{.*}}
+half3 test_radians_half3(half3 p0) { return radians(p0); }
+// NATIVE_HALF: define noundef <4 x half> @
+// NATIVE_HALF: %{{.*}} = call <4 x half> @llvm.dx.radians.v4f16
+// NATIVE_HALF: ret <4 x half> %{{.*}}
+// NO_HALF: define noundef <4 x float> @
+// NO_HALF: %{{.*}} = call <4 x float> @llvm.dx.radians.v4f32(
+// NO_HALF: ret <4 x float> %{{.*}}
+half4 test_radians_half4(half4 p0) { return radians(p0); }
+
+// CHECK: define noundef float @
+// CHECK: %{{.*}} = call float @llvm.dx.radians.f32(
+// CHECK: ret float %{{.*}}
+float test_radians_float(float p0) { return radians(p0); }
+// CHECK: define noundef <2 x float> @
+// CHECK: %{{.*}} = call <2 x float> @llvm.dx.radians.v2f32
+// CHECK: ret <2 x float> %{{.*}}
+float2 test_radians_float2(float2 p0) { return radians(p0); }
+// CHECK: define noundef <3 x float> @
+// CHECK: %{{.*}} = call <3 x float> @llvm.dx.radians.v3f32
+// CHECK: ret <3 x float> %{{.*}}
+float3 test_radians_float3(float3 p0) { return radians(p0); }
+// CHECK: define noundef <4 x float> @
+// CHECK: %{{.*}} = call <4 x float> @llvm.dx.radians.v4f32
+// CHECK: ret <4 x float> %{{.*}}
+float4 test_radians_float4(float4 p0) { return radians(p0); }
+
diff --git a/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl
new file mode 100644
index 00000000000000..1d315c486d7250
--- /dev/null
+++ b/clang/test/SemaHLSL/BuiltIns/radians-errors.hlsl
@@ -0,0 +1,27 @@
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -verify-ignore-unexpected
+
+float test_too_few_arg() {
+  return __builtin_hlsl_elementwise_radians();
+  // expected-error at -1 {{too few arguments to function call, expected 1, have 0}}
+}
+
+float2 test_too_many_arg(float2 p0) {
+  return __builtin_hlsl_elementwise_radians(p0, p0);
+  // expected-error at -1 {{too many arguments to function call, expected 1, have 2}}
+}
+
+float builtin_bool_to_float_type_promotion(bool p1) {
+  return __builtin_hlsl_elementwise_radians(p1);
+  // expected-error at -1 {passing 'bool' to parameter of incompatible type 'float'}}
+}
+
+float builtin_radians_int_to_float_promotion(int p1) {
+  return __builtin_hlsl_elementwise_radians(p1);
+  // expected-error at -1 {{passing 'int' to parameter of incompatible type 'float'}}
+}
+
+float2 builtin_radians_int2_to_float2_promotion(int2 p1) {
+  return __builtin_hlsl_elementwise_radians(p1);
+  // expected-error at -1 {{passing 'int2' (aka 'vector<int, 2>') to parameter of incompatible type '__attribute__((__vector_size__(2 * sizeof(float)))) float' (vector of 2 'float' values)}}
+}
+

>From 316d08a211e6b79b65ed3c34439df385ce109b02 Mon Sep 17 00:00:00 2001
From: Adam Yang <hanbyang at microsoft.com>
Date: Wed, 2 Oct 2024 01:46:01 -0700
Subject: [PATCH 2/4] Added the spirv hlsl tests too

---
 clang/test/CodeGenHLSL/builtins/radians.hlsl | 64 ++++++++++++--------
 1 file changed, 38 insertions(+), 26 deletions(-)

diff --git a/clang/test/CodeGenHLSL/builtins/radians.hlsl b/clang/test/CodeGenHLSL/builtins/radians.hlsl
index 1c72281abb3af3..774300525dbf02 100644
--- a/clang/test/CodeGenHLSL/builtins/radians.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/radians.hlsl
@@ -1,54 +1,66 @@
 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
 // RUN:   dxil-pc-shadermodel6.3-library %s -fnative-half-type \
 // RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s \ 
-// RUN:   --check-prefixes=CHECK,NATIVE_HALF
+// RUN:   --check-prefixes=CHECK,NATIVE_HALF \
+// RUN:   -DTARGET=dx -DFNATTRS=noundef
 // RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
 // RUN:   dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \
-// RUN:   -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
+// RUN:   -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
+// RUN:   -DTARGET=dx -DFNATTRS=noundef
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   spirv-unknown-vulkan-compute %s -fnative-half-type \
+// RUN:   -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN:   --check-prefixes=CHECK,NATIVE_HALF \
+// RUN:   -DTARGET=spv -DFNATTRS="spir_func noundef"
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN:   spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
+// RUN:   -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF \
+// RUN:   -DTARGET=spv -DFNATTRS="spir_func noundef"
+
 
-// NATIVE_HALF: define noundef half @
-// NATIVE_HALF: %{{.*}} = call half @llvm.dx.radians.f16(
+// NATIVE_HALF: define [[FNATTRS]] half @
+// NATIVE_HALF: %{{.*}} = call half @llvm.[[TARGET]].radians.f16(
 // NATIVE_HALF: ret half %{{.*}}
-// NO_HALF: define noundef float @"?test_radians_half@@YA$halff@$halff@@Z"(
-// NO_HALF: %{{.*}} = call float @llvm.dx.radians.f32(
+// NO_HALF: define [[FNATTRS]] float @
+// NO_HALF: %{{.*}} = call float @llvm.[[TARGET]].radians.f32(
 // NO_HALF: ret float %{{.*}}
 half test_radians_half(half p0) { return radians(p0); }
-// NATIVE_HALF: define noundef <2 x half> @
-// NATIVE_HALF: %{{.*}} = call <2 x half> @llvm.dx.radians.v2f16
+// NATIVE_HALF: define [[FNATTRS]] <2 x half> @
+// NATIVE_HALF: %{{.*}} = call <2 x half> @llvm.[[TARGET]].radians.v2f16
 // NATIVE_HALF: ret <2 x half> %{{.*}}
-// NO_HALF: define noundef <2 x float> @
-// NO_HALF: %{{.*}} = call <2 x float> @llvm.dx.radians.v2f32(
+// NO_HALF: define [[FNATTRS]] <2 x float> @
+// NO_HALF: %{{.*}} = call <2 x float> @llvm.[[TARGET]].radians.v2f32(
 // NO_HALF: ret <2 x float> %{{.*}}
 half2 test_radians_half2(half2 p0) { return radians(p0); }
-// NATIVE_HALF: define noundef <3 x half> @
-// NATIVE_HALF: %{{.*}} = call <3 x half> @llvm.dx.radians.v3f16
+// NATIVE_HALF: define [[FNATTRS]] <3 x half> @
+// NATIVE_HALF: %{{.*}} = call <3 x half> @llvm.[[TARGET]].radians.v3f16
 // NATIVE_HALF: ret <3 x half> %{{.*}}
-// NO_HALF: define noundef <3 x float> @
-// NO_HALF: %{{.*}} = call <3 x float> @llvm.dx.radians.v3f32(
+// NO_HALF: define [[FNATTRS]] <3 x float> @
+// NO_HALF: %{{.*}} = call <3 x float> @llvm.[[TARGET]].radians.v3f32(
 // NO_HALF: ret <3 x float> %{{.*}}
 half3 test_radians_half3(half3 p0) { return radians(p0); }
-// NATIVE_HALF: define noundef <4 x half> @
-// NATIVE_HALF: %{{.*}} = call <4 x half> @llvm.dx.radians.v4f16
+// NATIVE_HALF: define [[FNATTRS]] <4 x half> @
+// NATIVE_HALF: %{{.*}} = call <4 x half> @llvm.[[TARGET]].radians.v4f16
 // NATIVE_HALF: ret <4 x half> %{{.*}}
-// NO_HALF: define noundef <4 x float> @
-// NO_HALF: %{{.*}} = call <4 x float> @llvm.dx.radians.v4f32(
+// NO_HALF: define [[FNATTRS]] <4 x float> @
+// NO_HALF: %{{.*}} = call <4 x float> @llvm.[[TARGET]].radians.v4f32(
 // NO_HALF: ret <4 x float> %{{.*}}
 half4 test_radians_half4(half4 p0) { return radians(p0); }
 
-// CHECK: define noundef float @
-// CHECK: %{{.*}} = call float @llvm.dx.radians.f32(
+// CHECK: define [[FNATTRS]] float @
+// CHECK: %{{.*}} = call float @llvm.[[TARGET]].radians.f32(
 // CHECK: ret float %{{.*}}
 float test_radians_float(float p0) { return radians(p0); }
-// CHECK: define noundef <2 x float> @
-// CHECK: %{{.*}} = call <2 x float> @llvm.dx.radians.v2f32
+// CHECK: define [[FNATTRS]] <2 x float> @
+// CHECK: %{{.*}} = call <2 x float> @llvm.[[TARGET]].radians.v2f32
 // CHECK: ret <2 x float> %{{.*}}
 float2 test_radians_float2(float2 p0) { return radians(p0); }
-// CHECK: define noundef <3 x float> @
-// CHECK: %{{.*}} = call <3 x float> @llvm.dx.radians.v3f32
+// CHECK: define [[FNATTRS]] <3 x float> @
+// CHECK: %{{.*}} = call <3 x float> @llvm.[[TARGET]].radians.v3f32
 // CHECK: ret <3 x float> %{{.*}}
 float3 test_radians_float3(float3 p0) { return radians(p0); }
-// CHECK: define noundef <4 x float> @
-// CHECK: %{{.*}} = call <4 x float> @llvm.dx.radians.v4f32
+// CHECK: define [[FNATTRS]] <4 x float> @
+// CHECK: %{{.*}} = call <4 x float> @llvm.[[TARGET]].radians.v4f32
 // CHECK: ret <4 x float> %{{.*}}
 float4 test_radians_float4(float4 p0) { return radians(p0); }
 

>From f46b600e7ead509dcb269e777485276c1fe6361e Mon Sep 17 00:00:00 2001
From: Adam Yang <hanbyang at microsoft.com>
Date: Wed, 2 Oct 2024 16:53:35 -0700
Subject: [PATCH 3/4] Addressed feedback: No longer checking type in CG: it's
 already checked in sema; Added radians to half and float only test

---
 clang/lib/CodeGen/CGBuiltin.cpp                          | 9 +++++----
 clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl | 1 +
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 02de763ecd3f52..768157c0e46e4d 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -18879,11 +18879,12 @@ case Builtin::BI__builtin_hlsl_elementwise_isinf: {
   }
   case Builtin::BI__builtin_hlsl_elementwise_radians: {
     Value *Op0 = EmitScalarExpr(E->getArg(0));
-    if (!E->getArg(0)->getType()->hasFloatingRepresentation())
-      llvm_unreachable("radians operand must have a float representation");
+    assert(E->getArg(0)->getType()->hasFloatingRepresentation() &&
+           "radians operand must have a float representation");
     return Builder.CreateIntrinsic(
-        /*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getRadiansIntrinsic(),
-        ArrayRef<Value *>{Op0}, nullptr, "hlsl.radians");
+        /*ReturnType=*/Op0->getType(),
+        CGM.getHLSLRuntime().getRadiansIntrinsic(), ArrayRef<Value *>{Op0},
+        nullptr, "hlsl.radians");
   }
   }
   return nullptr;
diff --git a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
index 0c1f7022bad609..96dde7f3caac7a 100644
--- a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
@@ -17,6 +17,7 @@
 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tan
 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tanh
 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_trunc
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_radians
 
 double test_double_builtin(double p0) {
     return TEST_FUNC(p0);

>From 75853056a59506da0fd8393c9d630c2d40f8df09 Mon Sep 17 00:00:00 2001
From: Adam Yang <hanbyang at microsoft.com>
Date: Wed, 2 Oct 2024 17:18:56 -0700
Subject: [PATCH 4/4] Fixed typo in the half-float-only-errors

---
 clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
index 96dde7f3caac7a..2cecf7aeb00e46 100644
--- a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
@@ -17,7 +17,7 @@
 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tan
 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tanh
 // RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_trunc
-// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_radians
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_hlsl_elementwise_radians
 
 double test_double_builtin(double p0) {
     return TEST_FUNC(p0);



More information about the cfe-commits mailing list