llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86

@llvm/pr-subscribers-clang

Author: Sarah Spall (spall)

<details>
<summary>Changes</summary>

Add double overloads which cast the double to a float and call the float 
builtin.
Makes these double overloads conditional on hlsl version 202x or earlier.
Add tests
Closes #<!-- -->128228 

---

Patch is 51.95 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/132979.diff


32 Files Affected:

- (modified) clang/lib/Frontend/InitPreprocessor.cpp (+4) 
- (modified) clang/lib/Headers/hlsl/hlsl_compat_overloads.h (+281-2) 
- (modified) clang/lib/Headers/hlsl/hlsl_detail.h (+2) 
- (modified) clang/test/CodeGenHLSL/builtins/acos.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/asin.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/atan.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/atan2.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/ceil.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/cos.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/cosh.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/degrees.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/exp.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/exp2.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/floor.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/frac.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/isinf.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/lerp.hlsl (+20) 
- (modified) clang/test/CodeGenHLSL/builtins/log.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/log10.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/log2.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/normalize.hlsl (+30) 
- (modified) clang/test/CodeGenHLSL/builtins/pow.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/radians.hlsl (+16) 
- (modified) clang/test/CodeGenHLSL/builtins/round.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/rsqrt.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/sin.hlsl (+13) 
- (modified) clang/test/CodeGenHLSL/builtins/sinh.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/sqrt.hlsl (+17) 
- (modified) clang/test/CodeGenHLSL/builtins/step.hlsl (+29) 
- (modified) clang/test/CodeGenHLSL/builtins/tan.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/tanh.hlsl (+24) 
- (modified) clang/test/CodeGenHLSL/builtins/trunc.hlsl (+16) 


``````````diff
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp 
b/clang/lib/Frontend/InitPreprocessor.cpp
index 1a816cb6269d4..0b54665501c76 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -394,6 +394,10 @@ static void InitializeStandardPredefinedMacros(const 
TargetInfo &TI,
     // HLSL Version
     Builder.defineMacro("__HLSL_VERSION",
                         Twine((unsigned)LangOpts.getHLSLVersion()));
+    Builder.defineMacro("__HLSL_202x",
+                        Twine((unsigned)LangOptions::HLSLLangStd::HLSL_202x));
+    Builder.defineMacro("__HLSL_202y",
+                        Twine((unsigned)LangOptions::HLSLLangStd::HLSL_202y));
 
     if (LangOpts.NativeHalfType)
       Builder.defineMacro("__HLSL_ENABLE_16_BIT", "1");
diff --git a/clang/lib/Headers/hlsl/hlsl_compat_overloads.h 
b/clang/lib/Headers/hlsl/hlsl_compat_overloads.h
index aff514ef74208..c30d053b93a6f 100644
--- a/clang/lib/Headers/hlsl/hlsl_compat_overloads.h
+++ b/clang/lib/Headers/hlsl/hlsl_compat_overloads.h
@@ -16,6 +16,84 @@ namespace hlsl {
 // unsigned integer and floating point. Keeping this ordering consistent will
 // help keep this file manageable as it grows.
 
+#define DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(fn)                                  
\
+  constexpr float fn(double V) { return fn(__detail::imp_cast<float>(V)); }    
\
+  constexpr float2 fn(double2 V) { return fn(__detail::imp_cast<float2>(V)); } 
\
+  constexpr float3 fn(double3 V) { return fn(__detail::imp_cast<float3>(V)); } 
\
+  constexpr float4 fn(double4 V) { return fn(__detail::imp_cast<float4>(V)); }
+
+#define DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(fn)                                 
\
+  constexpr float fn(double V1, double V2) {                                   
\
+    return fn(__detail::imp_cast<float>(V1), __detail::imp_cast<float>(V2));   
\
+  }                                                                            
\
+  constexpr float2 fn(double2 V1, double2 V2) {                                
\
+    return fn(__detail::imp_cast<float2>(V1), __detail::imp_cast<float2>(V2)); 
\
+  }                                                                            
\
+  constexpr float3 fn(double3 V1, double3 V2) {                                
\
+    return fn(__detail::imp_cast<float3>(V1), __detail::imp_cast<float3>(V2)); 
\
+  }                                                                            
\
+  constexpr float4 fn(double4 V1, double4 V2) {                                
\
+    return fn(__detail::imp_cast<float4>(V1), __detail::imp_cast<float4>(V2)); 
\
+  }
+
+#define DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(fn)                                
\
+  constexpr float fn(double V1, double V2, double V3) {                        
\
+    return fn(__detail::imp_cast<float>(V1), __detail::imp_cast<float>(V2),    
\
+              __detail::imp_cast<float>(V3));                                  
\
+  }                                                                            
\
+  constexpr float2 fn(double2 V1, double2 V2, double2 V3) {                    
\
+    return fn(__detail::imp_cast<float2>(V1), __detail::imp_cast<float2>(V2),  
\
+              __detail::imp_cast<float2>(V3));                                 
\
+  }                                                                            
\
+  constexpr float3 fn(double3 V1, double3 V2, double3 V3) {                    
\
+    return fn(__detail::imp_cast<float3>(V1), __detail::imp_cast<float3>(V2),  
\
+              __detail::imp_cast<float3>(V3));                                 
\
+  }                                                                            
\
+  constexpr float4 fn(double4 V1, double4 V2, double4 V3) {                    
\
+    return fn(__detail::imp_cast<float4>(V1), __detail::imp_cast<float4>(V2),  
\
+              __detail::imp_cast<float4>(V3));                                 
\
+  }
+
+//===----------------------------------------------------------------------===//
+// acos builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(acos)
+#endif
+
+//===----------------------------------------------------------------------===//
+// asin builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(asin)
+#endif
+
+//===----------------------------------------------------------------------===//
+// atan builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(atan)
+#endif
+
+//===----------------------------------------------------------------------===//
+// atan2 builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(atan2)
+#endif
+
+//===----------------------------------------------------------------------===//
+// ceil builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(ceil)
+#endif
+
 
//===----------------------------------------------------------------------===//
 // clamp builtins overloads
 
//===----------------------------------------------------------------------===//
@@ -39,7 +117,112 @@ clamp(vector<T, N> p0, T p1, T p2) {
 }
 
 
//===----------------------------------------------------------------------===//
-// max builtin overloads
+// cos builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(cos)
+#endif
+
+//===----------------------------------------------------------------------===//
+// cosh builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(cosh)
+#endif
+
+//===----------------------------------------------------------------------===//
+// degrees builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(degrees)
+#endif
+
+//===----------------------------------------------------------------------===//
+// exp builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(exp)
+#endif
+
+//===----------------------------------------------------------------------===//
+// exp2 builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(exp2)
+#endif
+
+//===----------------------------------------------------------------------===//
+// floor builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(floor)
+#endif
+
+//===----------------------------------------------------------------------===//
+// frac builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(frac)
+#endif
+
+//===----------------------------------------------------------------------===//
+// isinf builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+constexpr bool isinf(double V) { return isinf(__detail::imp_cast<float>(V)); }
+constexpr bool2 isinf(double2 V) {
+  return isinf(__detail::imp_cast<float2>(V));
+}
+constexpr bool3 isinf(double3 V) {
+  return isinf(__detail::imp_cast<float3>(V));
+}
+constexpr bool4 isinf(double4 V) {
+  return isinf(__detail::imp_cast<float4>(V));
+}
+#endif
+
+//===----------------------------------------------------------------------===//
+// lerp builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp)
+#endif
+
+//===----------------------------------------------------------------------===//
+// log builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(log)
+#endif
+
+//===----------------------------------------------------------------------===//
+// log10 builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(log10)
+#endif
+
+//===----------------------------------------------------------------------===//
+// log2 builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(log2)
+#endif
+
+//===----------------------------------------------------------------------===//
+// max builtins overloads
 
//===----------------------------------------------------------------------===//
 
 template <typename T, uint N>
@@ -55,7 +238,7 @@ max(T p0, vector<T, N> p1) {
 }
 
 
//===----------------------------------------------------------------------===//
-// min builtin overloads
+// min builtins overloads
 
//===----------------------------------------------------------------------===//
 
 template <typename T, uint N>
@@ -70,5 +253,101 @@ min(T p0, vector<T, N> p1) {
   return min((vector<T, N>)p0, p1);
 }
 
+//===----------------------------------------------------------------------===//
+// normalize builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(normalize)
+#endif
+
+//===----------------------------------------------------------------------===//
+// pow builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(pow)
+#endif
+
+//===----------------------------------------------------------------------===//
+// rsqrt builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(rsqrt)
+#endif
+
+//===----------------------------------------------------------------------===//
+// round builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(round)
+#endif
+
+//===----------------------------------------------------------------------===//
+// sin builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(sin)
+#endif
+
+//===----------------------------------------------------------------------===//
+// sinh builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(sinh)
+#endif
+
+//===----------------------------------------------------------------------===//
+// sqrt builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(sqrt)
+#endif
+
+//===----------------------------------------------------------------------===//
+// step builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(step)
+#endif
+
+//===----------------------------------------------------------------------===//
+// tan builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(tan)
+#endif
+
+//===----------------------------------------------------------------------===//
+// tanh builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(tanh)
+#endif
+
+//===----------------------------------------------------------------------===//
+// trunc builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(trunc)
+#endif
+
+//===----------------------------------------------------------------------===//
+// radians builtins overloads
+//===----------------------------------------------------------------------===//
+
+#if __HLSL_VERSION <= __HLSL_202x
+DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(radians)
+#endif
+
 } // namespace hlsl
 #endif // _HLSL_COMPAT_OVERLOADS_H_
diff --git a/clang/lib/Headers/hlsl/hlsl_detail.h 
b/clang/lib/Headers/hlsl/hlsl_detail.h
index 80c4900121dfb..7f4b75736917a 100644
--- a/clang/lib/Headers/hlsl/hlsl_detail.h
+++ b/clang/lib/Headers/hlsl/hlsl_detail.h
@@ -49,6 +49,8 @@ template <typename T, int N>
 using HLSL_FIXED_VECTOR =
     vector<__detail::enable_if_t<(N > 1 && N <= 4), T>, N>;
 
+template <typename T, typename R> constexpr T imp_cast(R Val) { return Val; }
+
 } // namespace __detail
 } // namespace hlsl
 #endif //_HLSL_HLSL_DETAILS_H_
diff --git a/clang/test/CodeGenHLSL/builtins/acos.hlsl 
b/clang/test/CodeGenHLSL/builtins/acos.hlsl
index 8152339a34e87..8bc018321d9c4 100644
--- a/clang/test/CodeGenHLSL/builtins/acos.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/acos.hlsl
@@ -57,3 +57,27 @@ float3 test_acos_float3 ( float3 p0 ) {
 float4 test_acos_float4 ( float4 p0 ) {
   return acos ( p0 );
 }
+
+// CHECK-LABEL: test_acos_double
+// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.acos.f32
+float test_acos_double ( double p0 ) {
+  return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_double2
+// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.acos.v2f32
+float2 test_acos_double2 ( double2 p0 ) {
+  return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_double3
+// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.acos.v3f32
+float3 test_acos_double3 ( double3 p0 ) {
+  return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_double4
+// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.acos.v4f32
+float4 test_acos_double4 ( double4 p0 ) {
+  return acos ( p0 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/asin.hlsl 
b/clang/test/CodeGenHLSL/builtins/asin.hlsl
index 16efbba79670e..e65844d80cdac 100644
--- a/clang/test/CodeGenHLSL/builtins/asin.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/asin.hlsl
@@ -57,3 +57,27 @@ float3 test_asin_float3 ( float3 p0 ) {
 float4 test_asin_float4 ( float4 p0 ) {
   return asin ( p0 );
 }
+
+// CHECK-LABEL: test_asin_double
+// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.asin.f32
+float test_asin_double ( double p0 ) {
+  return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_double2
+// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.asin.v2f32
+float2 test_asin_double2 ( double2 p0 ) {
+  return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_double3
+// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.asin.v3f32
+float3 test_asin_double3 ( double3 p0 ) {
+  return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_double4
+// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.asin.v4f32
+float4 test_asin_double4 ( double4 p0 ) {
+  return asin ( p0 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/atan.hlsl 
b/clang/test/CodeGenHLSL/builtins/atan.hlsl
index 437835a863703..5be3d79a2bac6 100644
--- a/clang/test/CodeGenHLSL/builtins/atan.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/atan.hlsl
@@ -57,3 +57,27 @@ float3 test_atan_float3 ( float3 p0 ) {
 float4 test_atan_float4 ( float4 p0 ) {
   return atan ( p0 );
 }
+
+// CHECK-LABEL: test_atan_double
+// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan.f32
+float test_atan_double ( double p0 ) {
+  return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_double2
+// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan.v2f32
+float2 test_atan_double2 ( double2 p0 ) {
+  return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_double3
+// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan.v3f32
+float3 test_atan_double3 ( double3 p0 ) {
+  return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_double4
+// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan.v4f32
+float4 test_atan_double4 ( double4 p0 ) {
+  return atan ( p0 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/atan2.hlsl 
b/clang/test/CodeGenHLSL/builtins/atan2.hlsl
index 53d115641e72f..b0fe7efc7c310 100644
--- a/clang/test/CodeGenHLSL/builtins/atan2.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/atan2.hlsl
@@ -57,3 +57,27 @@ float3 test_atan2_float3 (float3 p0, float3 p1) {
 float4 test_atan2_float4 (float4 p0, float4 p1) {
   return atan2(p0, p1);
 }
+
+// CHECK-LABEL: test_atan2_double
+// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan2.f32
+float test_atan2_double (double p0, double p1) {
+  return atan2(p0, p1);
+}
+
+// CHECK-LABEL: test_atan2_double2
+// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan2.v2f32
+float2 test_atan2_double2 (double2 p0, double2 p1) {
+  return atan2(p0, p1);
+}
+
+// CHECK-LABEL: test_atan2_double3
+// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan2.v3f32
+float3 test_atan2_double3 (double3 p0, double3 p1) {
+  return atan2(p0, p1);
+}
+
+// CHECK-LABEL: test_atan2_double4
+// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan2.v4f32
+float4 test_atan2_double4 (double4 p0, double4 p1) {
+  return atan2(p0, p1);
+}
diff --git a/clang/test/CodeGenHLSL/builtins/ceil.hlsl 
b/clang/test/CodeGenHLSL/builtins/ceil.hlsl
index fe0b8f8983838..87cae2548aa76 100644
--- a/clang/test/CodeGenHLSL/builtins/ceil.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/ceil.hlsl
@@ -40,3 +40,16 @@ float3 test_ceil_float3(float3 p0) { return ceil(p0); }
 // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> 
@_Z16test_ceil_float4
 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.ceil.v4f32(
 float4 test_ceil_float4(float4 p0) { return ceil(p0); }
+
+// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_ceil_double
+// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.ceil.f32(
+float test_ceil_double(double p0) { return ceil(p0); }
+// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> 
{{.*}}test_ceil_double2
+// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.ceil.v2f32(
+float2 test_ceil_double2(double2 p0) { return ceil(p0); }
+// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> 
{{.*}}test_ceil_double3
+// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.ceil.v3f32(
+float3 test_ceil_double3(double3 p0) { return ceil(p0); }
+// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> 
{{.*}}test_ceil_double4
+// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.ceil.v4f32(
+float4 test_ceil_double4(double4 p0) { return ceil(p0); }
diff --git a/clang/test/CodeGenHLSL/builtins/cos.hlsl 
b/clang/test/CodeGenHLSL/builtins/cos.hlsl
index 5f993d50498bf..745bb9f99f6de 100644
--- a/clang/test/CodeGenHLSL/builtins/cos.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/cos.hlsl
@@ -38,3 +38,16 @@ float3 test_cos_float3(float3 p0) { return cos(p0); }
 // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> 
@_Z15test_cos_float4
 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32
 float4 test_cos_float4(float4 p0) { return cos(p0); }
+
+// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_cos_double
+// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cos.f32(
+float test_cos_double(double p0) { return cos(p0); }
+// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/132979
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to