diff --git a/clang/lib/Headers/hlsl/hlsl_compat_overloads.h b/clang/lib/Headers/hlsl/hlsl_compat_overloads.h index d8dac0a3942ad..47ae34adfe541 100644 --- a/clang/lib/Headers/hlsl/hlsl_compat_overloads.h +++ b/clang/lib/Headers/hlsl/hlsl_compat_overloads.h @@ -50,35 +50,148 @@ namespace hlsl { return fn((float4)V1, (float4)V2, (float4)V3); \ } +#define _DXC_COMPAT_UNARY_INTEGER_OVERLOADS(fn) \ + constexpr float fn(int V) { return fn((float)V); } \ + constexpr float2 fn(int2 V) { return fn((float2)V); } \ + constexpr float3 fn(int3 V) { return fn((float3)V); } \ + constexpr float4 fn(int4 V) { return fn((float4)V); } \ + constexpr float fn(uint V) { return fn((float)V); } \ + constexpr float2 fn(uint2 V) { return fn((float2)V); } \ + constexpr float3 fn(uint3 V) { return fn((float3)V); } \ + constexpr float4 fn(uint4 V) { return fn((float4)V); } \ + constexpr float fn(int64_t V) { return fn((float)V); } \ + constexpr float2 fn(int64_t2 V) { return fn((float2)V); } \ + constexpr float3 fn(int64_t3 V) { return fn((float3)V); } \ + constexpr float4 fn(int64_t4 V) { return fn((float4)V); } \ + constexpr float fn(uint64_t V) { return fn((float)V); } \ + constexpr float2 fn(uint64_t2 V) { return fn((float2)V); } \ + constexpr float3 fn(uint64_t3 V) { return fn((float3)V); } \ + constexpr float4 fn(uint64_t4 V) { return fn((float4)V); } + +#define _DXC_COMPAT_BINARY_INTEGER_OVERLOADS(fn) \ + constexpr float fn(int V1, int V2) { return fn((float)V1, (float)V2); } \ + constexpr float2 fn(int2 V1, int2 V2) { return fn((float2)V1, (float2)V2); } \ + constexpr float3 fn(int3 V1, int3 V2) { return fn((float3)V1, (float3)V2); } \ + constexpr float4 fn(int4 V1, int4 V2) { return fn((float4)V1, (float4)V2); } \ + constexpr float fn(uint V1, uint V2) { return fn((float)V1, (float)V2); } \ + constexpr float2 fn(uint2 V1, uint2 V2) { \ + return fn((float2)V1, (float2)V2); \ + } \ + constexpr float3 fn(uint3 V1, uint3 V2) { \ + return fn((float3)V1, (float3)V2); \ + } \ + constexpr float4 fn(uint4 V1, uint4 V2) { \ + return fn((float4)V1, (float4)V2); \ + } \ + constexpr float fn(int64_t V1, int64_t V2) { \ + return fn((float)V1, (float)V2); \ + } \ + constexpr float2 fn(int64_t2 V1, int64_t2 V2) { \ + return fn((float2)V1, (float2)V2); \ + } \ + constexpr float3 fn(int64_t3 V1, int64_t3 V2) { \ + return fn((float3)V1, (float3)V2); \ + } \ + constexpr float4 fn(int64_t4 V1, int64_t4 V2) { \ + return fn((float4)V1, (float4)V2); \ + } \ + constexpr float fn(uint64_t V1, uint64_t V2) { \ + return fn((float)V1, (float)V2); \ + } \ + constexpr float2 fn(uint64_t2 V1, uint64_t2 V2) { \ + return fn((float2)V1, (float2)V2); \ + } \ + constexpr float3 fn(uint64_t3 V1, uint64_t3 V2) { \ + return fn((float3)V1, (float3)V2); \ + } \ + constexpr float4 fn(uint64_t4 V1, uint64_t4 V2) { \ + return fn((float4)V1, (float4)V2); \ + } + +#define _DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(fn) \ + constexpr float fn(int V1, int V2, int V3) { \ + return fn((float)V1, (float)V2, (float)V3); \ + } \ + constexpr float2 fn(int2 V1, int2 V2, int2 V3) { \ + return fn((float2)V1, (float2)V2, (float2)V3); \ + } \ + constexpr float3 fn(int3 V1, int3 V2, int3 V3) { \ + return fn((float3)V1, (float3)V2, (float3)V3); \ + } \ + constexpr float4 fn(int4 V1, int4 V2, int4 V3) { \ + return fn((float4)V1, (float4)V2, (float4)V3); \ + } \ + constexpr float fn(uint V1, uint V2, uint V3) { \ + return fn((float)V1, (float)V2, (float)V3); \ + } \ + constexpr float2 fn(uint2 V1, uint2 V2, uint2 V3) { \ + return fn((float2)V1, (float2)V2, (float2)V3); \ + } \ + constexpr float3 fn(uint3 V1, uint3 V2, uint3 V3) { \ + return fn((float3)V1, (float3)V2, (float3)V3); \ + } \ + constexpr float4 fn(uint4 V1, uint4 V2, uint4 V3) { \ + return fn((float4)V1, (float4)V2, (float4)V3); \ + } \ + constexpr float fn(int64_t V1, int64_t V2, int64_t V3) { \ + return fn((float)V1, (float)V2, (float)V3); \ + } \ + constexpr float2 fn(int64_t2 V1, int64_t2 V2, int64_t2 V3) { \ + return fn((float2)V1, (float2)V2, (float2)V3); \ + } \ + constexpr float3 fn(int64_t3 V1, int64_t3 V2, int64_t3 V3) { \ + return fn((float3)V1, (float3)V2, (float3)V3); \ + } \ + constexpr float4 fn(int64_t4 V1, int64_t4 V2, int64_t4 V3) { \ + return fn((float4)V1, (float4)V2, (float4)V3); \ + } \ + constexpr float fn(uint64_t V1, uint64_t V2, uint64_t V3) { \ + return fn((float)V1, (float)V2, (float)V3); \ + } \ + constexpr float2 fn(uint64_t2 V1, uint64_t2 V2, uint64_t2 V3) { \ + return fn((float2)V1, (float2)V2, (float2)V3); \ + } \ + constexpr float3 fn(uint64_t3 V1, uint64_t3 V2, uint64_t3 V3) { \ + return fn((float3)V1, (float3)V2, (float3)V3); \ + } \ + constexpr float4 fn(uint64_t4 V1, uint64_t4 V2, uint64_t4 V3) { \ + return fn((float4)V1, (float4)V2, (float4)V3); \ + } + //===----------------------------------------------------------------------===// // acos builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(acos) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(acos) //===----------------------------------------------------------------------===// // asin builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(asin) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(asin) //===----------------------------------------------------------------------===// // atan builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(atan) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(atan) //===----------------------------------------------------------------------===// // atan2 builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(atan2) +_DXC_COMPAT_BINARY_INTEGER_OVERLOADS(atan2) //===----------------------------------------------------------------------===// // ceil builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(ceil) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(ceil) //===----------------------------------------------------------------------===// // clamp builtins overloads @@ -107,42 +220,49 @@ clamp(vector p0, T p1, T p2) { //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(cos) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(cos) //===----------------------------------------------------------------------===// // cosh builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(cosh) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(cosh) //===----------------------------------------------------------------------===// // degrees builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(degrees) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(degrees) //===----------------------------------------------------------------------===// // exp builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(exp) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(exp) //===----------------------------------------------------------------------===// // exp2 builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(exp2) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(exp2) //===----------------------------------------------------------------------===// // floor builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(floor) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(floor) //===----------------------------------------------------------------------===// // frac builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(frac) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(frac) //===----------------------------------------------------------------------===// // isinf builtins overloads @@ -158,24 +278,28 @@ constexpr bool4 isinf(double4 V) { return isinf((float4)V); } //===----------------------------------------------------------------------===// _DXC_COMPAT_TERNARY_DOUBLE_OVERLOADS(lerp) +_DXC_COMPAT_TERNARY_INTEGER_OVERLOADS(lerp) //===----------------------------------------------------------------------===// // log builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(log) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(log) //===----------------------------------------------------------------------===// // log10 builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(log10) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(log10) //===----------------------------------------------------------------------===// // log2 builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(log2) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(log2) //===----------------------------------------------------------------------===// // max builtins overloads @@ -214,72 +338,84 @@ min(T p0, vector p1) { //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(normalize) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(normalize) //===----------------------------------------------------------------------===// // pow builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(pow) +_DXC_COMPAT_BINARY_INTEGER_OVERLOADS(pow) //===----------------------------------------------------------------------===// // rsqrt builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(rsqrt) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(rsqrt) //===----------------------------------------------------------------------===// // round builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(round) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(round) //===----------------------------------------------------------------------===// // sin builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(sin) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(sin) //===----------------------------------------------------------------------===// // sinh builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(sinh) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(sinh) //===----------------------------------------------------------------------===// // sqrt builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(sqrt) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(sqrt) //===----------------------------------------------------------------------===// // step builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_BINARY_DOUBLE_OVERLOADS(step) +_DXC_COMPAT_BINARY_INTEGER_OVERLOADS(step) //===----------------------------------------------------------------------===// // tan builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(tan) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(tan) //===----------------------------------------------------------------------===// // tanh builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(tanh) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(tanh) //===----------------------------------------------------------------------===// // trunc builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(trunc) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(trunc) //===----------------------------------------------------------------------===// // radians builtins overloads //===----------------------------------------------------------------------===// _DXC_COMPAT_UNARY_DOUBLE_OVERLOADS(radians) +_DXC_COMPAT_UNARY_INTEGER_OVERLOADS(radians) } // namespace hlsl #endif // _HLSL_COMPAT_OVERLOADS_H_ diff --git a/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl new file mode 100644 index 0000000000000..e39ae43d205ee --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/acos-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// 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 ); +} + +// CHECK-LABEL: test_acos_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.acos.f32 +float test_acos_int ( int p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.acos.v2f32 +float2 test_acos_int2 ( int2 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.acos.v3f32 +float3 test_acos_int3 ( int3 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.acos.v4f32 +float4 test_acos_int4 ( int4 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.acos.f32 +float test_acos_uint ( uint p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.acos.v2f32 +float2 test_acos_uint2 ( uint2 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.acos.v3f32 +float3 test_acos_uint3 ( uint3 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.acos.v4f32 +float4 test_acos_uint4 ( uint4 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.acos.f32 +float test_acos_int64_t ( int64_t p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.acos.v2f32 +float2 test_acos_int64_t2 ( int64_t2 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.acos.v3f32 +float3 test_acos_int64_t3 ( int64_t3 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.acos.v4f32 +float4 test_acos_int64_t4 ( int64_t4 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.acos.f32 +float test_acos_uint64_t ( uint64_t p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.acos.v2f32 +float2 test_acos_uint64_t2 ( uint64_t2 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.acos.v3f32 +float3 test_acos_uint64_t3 ( uint64_t3 p0 ) { + return acos ( p0 ); +} + +// CHECK-LABEL: test_acos_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.acos.v4f32 +float4 test_acos_uint64_t4 ( uint64_t4 p0 ) { + return acos ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/acos.hlsl b/clang/test/CodeGenHLSL/builtins/acos.hlsl index 8bc018321d9c4..8152339a34e87 100644 --- a/clang/test/CodeGenHLSL/builtins/acos.hlsl +++ b/clang/test/CodeGenHLSL/builtins/acos.hlsl @@ -57,27 +57,3 @@ 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-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl new file mode 100644 index 0000000000000..7f7a2c4795129 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/asin-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// 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 ); +} + +// CHECK-LABEL: test_asin_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.asin.f32 +float test_asin_int ( int p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.asin.v2f32 +float2 test_asin_int2 ( int2 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.asin.v3f32 +float3 test_asin_int3 ( int3 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.asin.v4f32 +float4 test_asin_int4 ( int4 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.asin.f32 +float test_asin_uint ( uint p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.asin.v2f32 +float2 test_asin_uint2 ( uint2 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.asin.v3f32 +float3 test_asin_uint3 ( uint3 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.asin.v4f32 +float4 test_asin_uint4 ( uint4 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.asin.f32 +float test_asin_int64_t ( int64_t p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.asin.v2f32 +float2 test_asin_int64_t2 ( int64_t2 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.asin.v3f32 +float3 test_asin_int64_t3 ( int64_t3 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.asin.v4f32 +float4 test_asin_int64_t4 ( int64_t4 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.asin.f32 +float test_asin_uint64_t ( uint64_t p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.asin.v2f32 +float2 test_asin_uint64_t2 ( uint64_t2 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.asin.v3f32 +float3 test_asin_uint64_t3 ( uint64_t3 p0 ) { + return asin ( p0 ); +} + +// CHECK-LABEL: test_asin_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.asin.v4f32 +float4 test_asin_uint64_t4 ( uint64_t4 p0 ) { + return asin ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/asin.hlsl b/clang/test/CodeGenHLSL/builtins/asin.hlsl index e65844d80cdac..16efbba79670e 100644 --- a/clang/test/CodeGenHLSL/builtins/asin.hlsl +++ b/clang/test/CodeGenHLSL/builtins/asin.hlsl @@ -57,27 +57,3 @@ 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-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl new file mode 100644 index 0000000000000..cc870844dbc96 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/atan-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// 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 ); +} + +// CHECK-LABEL: test_atan_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan.f32 +float test_atan_int ( int p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan.v2f32 +float2 test_atan_int2 ( int2 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan.v3f32 +float3 test_atan_int3 ( int3 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan.v4f32 +float4 test_atan_int4 ( int4 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan.f32 +float test_atan_uint ( uint p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan.v2f32 +float2 test_atan_uint2 ( uint2 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan.v3f32 +float3 test_atan_uint3 ( uint3 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan.v4f32 +float4 test_atan_uint4 ( uint4 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan.f32 +float test_atan_int64_t ( int64_t p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan.v2f32 +float2 test_atan_int64_t2 ( int64_t2 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan.v3f32 +float3 test_atan_int64_t3 ( int64_t3 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan.v4f32 +float4 test_atan_int64_t4 ( int64_t4 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan.f32 +float test_atan_uint64_t ( uint64_t p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan.v2f32 +float2 test_atan_uint64_t2 ( uint64_t2 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan.v3f32 +float3 test_atan_uint64_t3 ( uint64_t3 p0 ) { + return atan ( p0 ); +} + +// CHECK-LABEL: test_atan_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan.v4f32 +float4 test_atan_uint64_t4 ( uint64_t4 p0 ) { + return atan ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/atan.hlsl b/clang/test/CodeGenHLSL/builtins/atan.hlsl index 5be3d79a2bac6..437835a863703 100644 --- a/clang/test/CodeGenHLSL/builtins/atan.hlsl +++ b/clang/test/CodeGenHLSL/builtins/atan.hlsl @@ -57,27 +57,3 @@ 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-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/atan2-overloads.hlsl new file mode 100644 index 0000000000000..5ab1f80e1bfc7 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/atan2-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// 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); +} + +// CHECK-LABEL: test_atan2_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan2.f32 +float test_atan2_int (int p0, int p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan2.v2f32 +float2 test_atan2_int2 (int2 p0, int2 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan2.v3f32 +float3 test_atan2_int3 (int3 p0, int3 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan2.v4f32 +float4 test_atan2_int4 (int4 p0, int4 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan2.f32 +float test_atan2_uint (uint p0, uint p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan2.v2f32 +float2 test_atan2_uint2 (uint2 p0, uint2 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan2.v3f32 +float3 test_atan2_uint3 (uint3 p0, uint3 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan2.v4f32 +float4 test_atan2_uint4 (uint4 p0, uint4 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan2.f32 +float test_atan2_int64_t (int64_t p0, int64_t p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan2.v2f32 +float2 test_atan2_int64_t2 (int64_t2 p0, int64_t2 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan2.v3f32 +float3 test_atan2_int64_t3 (int64_t3 p0, int64_t3 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan2.v4f32 +float4 test_atan2_int64_t4 (int64_t4 p0, int64_t4 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.atan2.f32 +float test_atan2_uint64_t (uint64_t p0, uint64_t p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.atan2.v2f32 +float2 test_atan2_uint64_t2 (uint64_t2 p0, uint64_t2 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.atan2.v3f32 +float3 test_atan2_uint64_t3 (uint64_t3 p0, uint64_t3 p1) { + return atan2(p0, p1); +} + +// CHECK-LABEL: test_atan2_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.atan2.v4f32 +float4 test_atan2_uint64_t4 (uint64_t4 p0, uint64_t4 p1) { + return atan2(p0, p1); +} diff --git a/clang/test/CodeGenHLSL/builtins/atan2.hlsl b/clang/test/CodeGenHLSL/builtins/atan2.hlsl index b0fe7efc7c310..53d115641e72f 100644 --- a/clang/test/CodeGenHLSL/builtins/atan2.hlsl +++ b/clang/test/CodeGenHLSL/builtins/atan2.hlsl @@ -57,27 +57,3 @@ 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-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/ceil-overloads.hlsl new file mode 100644 index 0000000000000..b313c99e89a53 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/ceil-overloads.hlsl @@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +using hlsl::ceil; + +// 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); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_ceil_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.ceil.f32( +float test_ceil_int(int p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_ceil_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.ceil.v2f32( +float2 test_ceil_int2(int2 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_ceil_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.ceil.v3f32( +float3 test_ceil_int3(int3 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_ceil_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.ceil.v4f32( +float4 test_ceil_int4(int4 p0) { return ceil(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_ceil_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.ceil.f32( +float test_ceil_uint(uint p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_ceil_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.ceil.v2f32( +float2 test_ceil_uint2(uint2 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_ceil_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.ceil.v3f32( +float3 test_ceil_uint3(uint3 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_ceil_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.ceil.v4f32( +float4 test_ceil_uint4(uint4 p0) { return ceil(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_ceil_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.ceil.f32( +float test_ceil_int64_t(int64_t p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_ceil_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.ceil.v2f32( +float2 test_ceil_int64_t2(int64_t2 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_ceil_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.ceil.v3f32( +float3 test_ceil_int64_t3(int64_t3 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_ceil_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.ceil.v4f32( +float4 test_ceil_int64_t4(int64_t4 p0) { return ceil(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_ceil_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.ceil.f32( +float test_ceil_uint64_t(uint64_t p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_ceil_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.ceil.v2f32( +float2 test_ceil_uint64_t2(uint64_t2 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_ceil_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.ceil.v3f32( +float3 test_ceil_uint64_t3(uint64_t3 p0) { return ceil(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_ceil_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.ceil.v4f32( +float4 test_ceil_uint64_t4(uint64_t4 p0) { return ceil(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/ceil.hlsl b/clang/test/CodeGenHLSL/builtins/ceil.hlsl index 87cae2548aa76..fe0b8f8983838 100644 --- a/clang/test/CodeGenHLSL/builtins/ceil.hlsl +++ b/clang/test/CodeGenHLSL/builtins/ceil.hlsl @@ -40,16 +40,3 @@ 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-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/cos-overloads.hlsl new file mode 100644 index 0000000000000..b7b11b1c3bd6d --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/cos-overloads.hlsl @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// 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_cos_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cos.v2f32 +float2 test_cos_double2(double2 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_cos_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cos.v3f32 +float3 test_cos_double3(double3 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_cos_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32 +float4 test_cos_double4(double4 p0) { return cos(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_cos_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cos.f32( +float test_cos_int(int p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_cos_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cos.v2f32 +float2 test_cos_int2(int2 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_cos_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cos.v3f32 +float3 test_cos_int3(int3 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_cos_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32 +float4 test_cos_int4(int4 p0) { return cos(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_cos_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cos.f32( +float test_cos_uint(uint p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_cos_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cos.v2f32 +float2 test_cos_uint2(uint2 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_cos_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cos.v3f32 +float3 test_cos_uint3(uint3 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_cos_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32 +float4 test_cos_uint4(uint4 p0) { return cos(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_cos_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cos.f32( +float test_cos_int64_t(int64_t p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_cos_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cos.v2f32 +float2 test_cos_int64_t2(int64_t2 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_cos_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cos.v3f32 +float3 test_cos_int64_t3(int64_t3 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_cos_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32 +float4 test_cos_int64_t4(int64_t4 p0) { return cos(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_cos_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cos.f32( +float test_cos_uint64_t(uint64_t p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_cos_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cos.v2f32 +float2 test_cos_uint64_t2(uint64_t2 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_cos_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cos.v3f32 +float3 test_cos_uint64_t3(uint64_t3 p0) { return cos(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_cos_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32 +float4 test_cos_uint64_t4(uint64_t4 p0) { return cos(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/cos.hlsl b/clang/test/CodeGenHLSL/builtins/cos.hlsl index 745bb9f99f6de..5f993d50498bf 100644 --- a/clang/test/CodeGenHLSL/builtins/cos.hlsl +++ b/clang/test/CodeGenHLSL/builtins/cos.hlsl @@ -38,16 +38,3 @@ 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_cos_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cos.v2f32 -float2 test_cos_double2(double2 p0) { return cos(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_cos_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cos.v3f32 -float3 test_cos_double3(double3 p0) { return cos(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_cos_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cos.v4f32 -float4 test_cos_double4(double4 p0) { return cos(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl new file mode 100644 index 0000000000000..2170f63c53d97 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/cosh-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: test_cosh_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cosh.f32 +float test_cosh_double ( double p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cosh.v2f32 +float2 test_cosh_double2 ( double2 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cosh.v3f32 +float3 test_cosh_double3 ( double3 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cosh.v4f32 +float4 test_cosh_double4 ( double4 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cosh.f32 +float test_cosh_int ( int p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cosh.v2f32 +float2 test_cosh_int2 ( int2 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cosh.v3f32 +float3 test_cosh_int3 ( int3 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cosh.v4f32 +float4 test_cosh_int4 ( int4 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cosh.f32 +float test_cosh_uint ( uint p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cosh.v2f32 +float2 test_cosh_uint2 ( uint2 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cosh.v3f32 +float3 test_cosh_uint3 ( uint3 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cosh.v4f32 +float4 test_cosh_uint4 ( uint4 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cosh.f32 +float test_cosh_int64_t ( int64_t p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cosh.v2f32 +float2 test_cosh_int64_t2 ( int64_t2 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cosh.v3f32 +float3 test_cosh_int64_t3 ( int64_t3 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cosh.v4f32 +float4 test_cosh_int64_t4 ( int64_t4 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cosh.f32 +float test_cosh_uint64_t ( uint64_t p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cosh.v2f32 +float2 test_cosh_uint64_t2 ( uint64_t2 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cosh.v3f32 +float3 test_cosh_uint64_t3 ( uint64_t3 p0 ) { + return cosh ( p0 ); +} + +// CHECK-LABEL: test_cosh_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cosh.v4f32 +float4 test_cosh_uint64_t4 ( uint64_t4 p0 ) { + return cosh ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/cosh.hlsl b/clang/test/CodeGenHLSL/builtins/cosh.hlsl index ba2cbdd018a82..07c64206412db 100644 --- a/clang/test/CodeGenHLSL/builtins/cosh.hlsl +++ b/clang/test/CodeGenHLSL/builtins/cosh.hlsl @@ -57,27 +57,3 @@ float3 test_cosh_float3 ( float3 p0 ) { float4 test_cosh_float4 ( float4 p0 ) { return cosh ( p0 ); } - -// CHECK-LABEL: test_cosh_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.cosh.f32 -float test_cosh_double ( double p0 ) { - return cosh ( p0 ); -} - -// CHECK-LABEL: test_cosh_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.cosh.v2f32 -float2 test_cosh_double2 ( double2 p0 ) { - return cosh ( p0 ); -} - -// CHECK-LABEL: test_cosh_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.cosh.v3f32 -float3 test_cosh_double3 ( double3 p0 ) { - return cosh ( p0 ); -} - -// CHECK-LABEL: test_cosh_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.cosh.v4f32 -float4 test_cosh_double4 ( double4 p0 ) { - return cosh ( p0 ); -} diff --git a/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl new file mode 100644 index 0000000000000..bafd2368c9961 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/degrees-overloads.hlsl @@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple \ +// RUN: dxil-pc-shadermodel6.3-library %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32( +// CHECK: ret float %hlsl.degrees +float test_degrees_double(double p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32 +// CHECK: ret <2 x float> %hlsl.degrees +float2 test_degrees_double2(double2 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32 +// CHECK: ret <3 x float> %hlsl.degrees +float3 test_degrees_double3(double3 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 +// CHECK: ret <4 x float> %hlsl.degrees +float4 test_degrees_double4(double4 p0) { return degrees(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32( +// CHECK: ret float %hlsl.degrees +float test_degrees_int(int p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32 +// CHECK: ret <2 x float> %hlsl.degrees +float2 test_degrees_int2(int2 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32 +// CHECK: ret <3 x float> %hlsl.degrees +float3 test_degrees_int3(int3 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 +// CHECK: ret <4 x float> %hlsl.degrees +float4 test_degrees_int4(int4 p0) { return degrees(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32( +// CHECK: ret float %hlsl.degrees +float test_degrees_uint(uint p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32 +// CHECK: ret <2 x float> %hlsl.degrees +float2 test_degrees_uint2(uint2 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32 +// CHECK: ret <3 x float> %hlsl.degrees +float3 test_degrees_uint3(uint3 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 +// CHECK: ret <4 x float> %hlsl.degrees +float4 test_degrees_uint4(uint4 p0) { return degrees(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32( +// CHECK: ret float %hlsl.degrees +float test_degrees_int64_t(int64_t p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32 +// CHECK: ret <2 x float> %hlsl.degrees +float2 test_degrees_int64_t2(int64_t2 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32 +// CHECK: ret <3 x float> %hlsl.degrees +float3 test_degrees_int64_t3(int64_t3 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 +// CHECK: ret <4 x float> %hlsl.degrees +float4 test_degrees_int64_t4(int64_t4 p0) { return degrees(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32( +// CHECK: ret float %hlsl.degrees +float test_degrees_uint64_t(uint64_t p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32 +// CHECK: ret <2 x float> %hlsl.degrees +float2 test_degrees_uint64_t2(uint64_t2 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32 +// CHECK: ret <3 x float> %hlsl.degrees +float3 test_degrees_uint64_t3(uint64_t3 p0) { return degrees(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 +// CHECK: ret <4 x float> %hlsl.degrees +float4 test_degrees_uint64_t4(uint64_t4 p0) { return degrees(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/degrees.hlsl b/clang/test/CodeGenHLSL/builtins/degrees.hlsl index 6a55b4d5b1be2..64531dd2785eb 100644 --- a/clang/test/CodeGenHLSL/builtins/degrees.hlsl +++ b/clang/test/CodeGenHLSL/builtins/degrees.hlsl @@ -62,20 +62,3 @@ float3 test_degrees_float3(float3 p0) { return degrees(p0); } // CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 // CHECK: ret <4 x float> %hlsl.degrees float4 test_degrees_float4(float4 p0) { return degrees(p0); } - -// CHECK: define [[FNATTRS]] float @ -// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].degrees.f32( -// CHECK: ret float %hlsl.degrees -float test_degrees_double(double p0) { return degrees(p0); } -// CHECK: define [[FNATTRS]] <2 x float> @ -// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].degrees.v2f32 -// CHECK: ret <2 x float> %hlsl.degrees -float2 test_degrees_double2(double2 p0) { return degrees(p0); } -// CHECK: define [[FNATTRS]] <3 x float> @ -// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].degrees.v3f32 -// CHECK: ret <3 x float> %hlsl.degrees -float3 test_degrees_double3(double3 p0) { return degrees(p0); } -// CHECK: define [[FNATTRS]] <4 x float> @ -// CHECK: %hlsl.degrees = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].degrees.v4f32 -// CHECK: ret <4 x float> %hlsl.degrees -float4 test_degrees_double4(double4 p0) { return degrees(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl new file mode 100644 index 0000000000000..858a1210169d2 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/exp-overloads.hlsl @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp_double +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn float @llvm.exp.f32( +// CHECK: ret float %elt.exp +float test_exp_double(double p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp_double2 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp.v2f32 +// CHECK: ret <2 x float> %elt.exp +float2 test_exp_double2(double2 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp_double3 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp.v3f32 +// CHECK: ret <3 x float> %elt.exp +float3 test_exp_double3(double3 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp_double4 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 +// CHECK: ret <4 x float> %elt.exp +float4 test_exp_double4(double4 p0) { return exp(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp_int +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn float @llvm.exp.f32( +// CHECK: ret float %elt.exp +float test_exp_int(int p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp_int2 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp.v2f32 +// CHECK: ret <2 x float> %elt.exp +float2 test_exp_int2(int2 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp_int3 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp.v3f32 +// CHECK: ret <3 x float> %elt.exp +float3 test_exp_int3(int3 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp_int4 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 +// CHECK: ret <4 x float> %elt.exp +float4 test_exp_int4(int4 p0) { return exp(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp_uint +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn float @llvm.exp.f32( +// CHECK: ret float %elt.exp +float test_exp_uint(uint p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp_uint2 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp.v2f32 +// CHECK: ret <2 x float> %elt.exp +float2 test_exp_uint2(uint2 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp_uint3 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp.v3f32 +// CHECK: ret <3 x float> %elt.exp +float3 test_exp_uint3(uint3 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp_uint4 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 +// CHECK: ret <4 x float> %elt.exp +float4 test_exp_uint4(uint4 p0) { return exp(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp_int64_t +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn float @llvm.exp.f32( +// CHECK: ret float %elt.exp +float test_exp_int64_t(int64_t p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp_int64_t2 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp.v2f32 +// CHECK: ret <2 x float> %elt.exp +float2 test_exp_int64_t2(int64_t2 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp_int64_t3 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp.v3f32 +// CHECK: ret <3 x float> %elt.exp +float3 test_exp_int64_t3(int64_t3 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp_int64_t4 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 +// CHECK: ret <4 x float> %elt.exp +float4 test_exp_int64_t4(int64_t4 p0) { return exp(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp_uint64_t +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn float @llvm.exp.f32( +// CHECK: ret float %elt.exp +float test_exp_uint64_t(uint64_t p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp_uint64_t2 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp.v2f32 +// CHECK: ret <2 x float> %elt.exp +float2 test_exp_uint64_t2(uint64_t2 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp_uint64_t3 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp.v3f32 +// CHECK: ret <3 x float> %elt.exp +float3 test_exp_uint64_t3(uint64_t3 p0) { return exp(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp_uint64_t4 +// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 +// CHECK: ret <4 x float> %elt.exp +float4 test_exp_uint64_t4(uint64_t4 p0) { return exp(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/exp.hlsl b/clang/test/CodeGenHLSL/builtins/exp.hlsl index dad80fcbcf2d8..6ed40ed8f433c 100644 --- a/clang/test/CodeGenHLSL/builtins/exp.hlsl +++ b/clang/test/CodeGenHLSL/builtins/exp.hlsl @@ -50,20 +50,3 @@ float3 test_exp_float3(float3 p0) { return exp(p0); } // CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 // CHECK: ret <4 x float> %elt.exp float4 test_exp_float4(float4 p0) { return exp(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp_double -// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn float @llvm.exp.f32( -// CHECK: ret float %elt.exp -float test_exp_double(double p0) { return exp(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp_double2 -// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp.v2f32 -// CHECK: ret <2 x float> %elt.exp -float2 test_exp_double2(double2 p0) { return exp(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp_double3 -// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp.v3f32 -// CHECK: ret <3 x float> %elt.exp -float3 test_exp_double3(double3 p0) { return exp(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp_double4 -// CHECK: %elt.exp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp.v4f32 -// CHECK: ret <4 x float> %elt.exp -float4 test_exp_double4(double4 p0) { return exp(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl new file mode 100644 index 0000000000000..ef522afc244a8 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/exp2-overloads.hlsl @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp2_double +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn float @llvm.exp2.f32( +// CHECK: ret float %elt.exp2 +float test_exp2_double(double p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp2_double2 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp2.v2f32 +// CHECK: ret <2 x float> %elt.exp2 +float2 test_exp2_double2(double2 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp2_double3 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp2.v3f32 +// CHECK: ret <3 x float> %elt.exp2 +float3 test_exp2_double3(double3 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp2_double4 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 +// CHECK: ret <4 x float> %elt.exp2 +float4 test_exp2_double4(double4 p0) { return exp2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp2_int +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn float @llvm.exp2.f32( +// CHECK: ret float %elt.exp2 +float test_exp2_int(int p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp2_int2 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp2.v2f32 +// CHECK: ret <2 x float> %elt.exp2 +float2 test_exp2_int2(int2 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp2_int3 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp2.v3f32 +// CHECK: ret <3 x float> %elt.exp2 +float3 test_exp2_int3(int3 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp2_int4 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 +// CHECK: ret <4 x float> %elt.exp2 +float4 test_exp2_int4(int4 p0) { return exp2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp2_uint +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn float @llvm.exp2.f32( +// CHECK: ret float %elt.exp2 +float test_exp2_uint(uint p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp2_uint2 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp2.v2f32 +// CHECK: ret <2 x float> %elt.exp2 +float2 test_exp2_uint2(uint2 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp2_uint3 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp2.v3f32 +// CHECK: ret <3 x float> %elt.exp2 +float3 test_exp2_uint3(uint3 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp2_uint4 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 +// CHECK: ret <4 x float> %elt.exp2 +float4 test_exp2_uint4(uint4 p0) { return exp2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp2_int64_t +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn float @llvm.exp2.f32( +// CHECK: ret float %elt.exp2 +float test_exp2_int64_t(int64_t p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp2_int64_t2 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp2.v2f32 +// CHECK: ret <2 x float> %elt.exp2 +float2 test_exp2_int64_t2(int64_t2 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp2_int64_t3 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp2.v3f32 +// CHECK: ret <3 x float> %elt.exp2 +float3 test_exp2_int64_t3(int64_t3 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp2_int64_t4 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 +// CHECK: ret <4 x float> %elt.exp2 +float4 test_exp2_int64_t4(int64_t4 p0) { return exp2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp2_uint64_t +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn float @llvm.exp2.f32( +// CHECK: ret float %elt.exp2 +float test_exp2_uint64_t(uint64_t p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp2_uint64_t2 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp2.v2f32 +// CHECK: ret <2 x float> %elt.exp2 +float2 test_exp2_uint64_t2(uint64_t2 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp2_uint64_t3 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp2.v3f32 +// CHECK: ret <3 x float> %elt.exp2 +float3 test_exp2_uint64_t3(uint64_t3 p0) { return exp2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp2_uint64_t4 +// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 +// CHECK: ret <4 x float> %elt.exp2 +float4 test_exp2_uint64_t4(uint64_t4 p0) { return exp2(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/exp2.hlsl b/clang/test/CodeGenHLSL/builtins/exp2.hlsl index 594da9a990424..b067427e46368 100644 --- a/clang/test/CodeGenHLSL/builtins/exp2.hlsl +++ b/clang/test/CodeGenHLSL/builtins/exp2.hlsl @@ -50,20 +50,3 @@ float3 test_exp2_float3(float3 p0) { return exp2(p0); } // CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 // CHECK: ret <4 x float> %elt.exp2 float4 test_exp2_float4(float4 p0) { return exp2(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_exp2_double -// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn float @llvm.exp2.f32( -// CHECK: ret float %elt.exp2 -float test_exp2_double(double p0) { return exp2(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_exp2_double2 -// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.exp2.v2f32 -// CHECK: ret <2 x float> %elt.exp2 -float2 test_exp2_double2(double2 p0) { return exp2(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_exp2_double3 -// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.exp2.v3f32 -// CHECK: ret <3 x float> %elt.exp2 -float3 test_exp2_double3(double3 p0) { return exp2(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_exp2_double4 -// CHECK: %elt.exp2 = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.exp2.v4f32 -// CHECK: ret <4 x float> %elt.exp2 -float4 test_exp2_double4(double4 p0) { return exp2(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl new file mode 100644 index 0000000000000..26d83443ea489 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/floor-overloads.hlsl @@ -0,0 +1,70 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +using hlsl::floor; + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_floor_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.floor.f32( +float test_floor_double(double p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_floor_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.floor.v2f32( +float2 test_floor_double2(double2 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_floor_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.floor.v3f32( +float3 test_floor_double3(double3 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_floor_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( +float4 test_floor_double4(double4 p0) { return floor(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_floor_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.floor.f32( +float test_floor_int(int p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_floor_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.floor.v2f32( +float2 test_floor_int2(int2 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_floor_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.floor.v3f32( +float3 test_floor_int3(int3 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_floor_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( +float4 test_floor_int4(int4 p0) { return floor(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_floor_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.floor.f32( +float test_floor_uint(uint p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_floor_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.floor.v2f32( +float2 test_floor_uint2(uint2 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_floor_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.floor.v3f32( +float3 test_floor_uint3(uint3 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_floor_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( +float4 test_floor_uint4(uint4 p0) { return floor(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_floor_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.floor.f32( +float test_floor_int64_t(int64_t p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_floor_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.floor.v2f32( +float2 test_floor_int64_t2(int64_t2 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_floor_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.floor.v3f32( +float3 test_floor_int64_t3(int64_t3 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_floor_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( +float4 test_floor_int64_t4(int64_t4 p0) { return floor(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_floor_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.floor.f32( +float test_floor_uint64_t(uint64_t p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_floor_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.floor.v2f32( +float2 test_floor_uint64_t2(uint64_t2 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_floor_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.floor.v3f32( +float3 test_floor_uint64_t3(uint64_t3 p0) { return floor(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_floor_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( +float4 test_floor_uint64_t4(uint64_t4 p0) { return floor(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/floor.hlsl b/clang/test/CodeGenHLSL/builtins/floor.hlsl index de411746ce467..f610baeeefd48 100644 --- a/clang/test/CodeGenHLSL/builtins/floor.hlsl +++ b/clang/test/CodeGenHLSL/builtins/floor.hlsl @@ -40,16 +40,3 @@ float3 test_floor_float3(float3 p0) { return floor(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z17test_floor_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( float4 test_floor_float4(float4 p0) { return floor(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_floor_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.floor.f32( -float test_floor_double(double p0) { return floor(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_floor_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.floor.v2f32( -float2 test_floor_double2(double2 p0) { return floor(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_floor_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.floor.v3f32( -float3 test_floor_double3(double3 p0) { return floor(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_floor_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.floor.v4f32( -float4 test_floor_double4(double4 p0) { return floor(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl new file mode 100644 index 0000000000000..b0e844bd8a8d8 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/frac-overloads.hlsl @@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -std=hlsl202x -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 \ +// RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].frac.f32( +// CHECK: ret float %hlsl.frac +float test_frac_double(double p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].frac.v2f32 +// CHECK: ret <2 x float> %hlsl.frac +float2 test_frac_double2(double2 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].frac.v3f32 +// CHECK: ret <3 x float> %hlsl.frac +float3 test_frac_double3(double3 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 +// CHECK: ret <4 x float> %hlsl.frac +float4 test_frac_double4(double4 p0) { return frac(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].frac.f32( +// CHECK: ret float %hlsl.frac +float test_frac_int(int p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].frac.v2f32 +// CHECK: ret <2 x float> %hlsl.frac +float2 test_frac_int2(int2 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].frac.v3f32 +// CHECK: ret <3 x float> %hlsl.frac +float3 test_frac_int3(int3 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 +// CHECK: ret <4 x float> %hlsl.frac +float4 test_frac_int4(int4 p0) { return frac(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].frac.f32( +// CHECK: ret float %hlsl.frac +float test_frac_uint(uint p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].frac.v2f32 +// CHECK: ret <2 x float> %hlsl.frac +float2 test_frac_uint2(uint2 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].frac.v3f32 +// CHECK: ret <3 x float> %hlsl.frac +float3 test_frac_uint3(uint3 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 +// CHECK: ret <4 x float> %hlsl.frac +float4 test_frac_uint4(uint4 p0) { return frac(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].frac.f32( +// CHECK: ret float %hlsl.frac +float test_frac_int64_t(int64_t p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].frac.v2f32 +// CHECK: ret <2 x float> %hlsl.frac +float2 test_frac_int64_t2(int64_t2 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].frac.v3f32 +// CHECK: ret <3 x float> %hlsl.frac +float3 test_frac_int64_t3(int64_t3 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 +// CHECK: ret <4 x float> %hlsl.frac +float4 test_frac_int64_t4(int64_t4 p0) { return frac(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].frac.f32( +// CHECK: ret float %hlsl.frac +float test_frac_uint64_t(uint64_t p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].frac.v2f32 +// CHECK: ret <2 x float> %hlsl.frac +float2 test_frac_uint64_t2(uint64_t2 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].frac.v3f32 +// CHECK: ret <3 x float> %hlsl.frac +float3 test_frac_uint64_t3(uint64_t3 p0) { return frac(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 +// CHECK: ret <4 x float> %hlsl.frac +float4 test_frac_uint64_t4(uint64_t4 p0) { return frac(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/frac.hlsl b/clang/test/CodeGenHLSL/builtins/frac.hlsl index 71ca8fc0e4518..7b105ce84359f 100644 --- a/clang/test/CodeGenHLSL/builtins/frac.hlsl +++ b/clang/test/CodeGenHLSL/builtins/frac.hlsl @@ -62,20 +62,3 @@ float3 test_frac_float3(float3 p0) { return frac(p0); } // CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 // CHECK: ret <4 x float> %hlsl.frac float4 test_frac_float4(float4 p0) { return frac(p0); } - -// CHECK: define [[FNATTRS]] float @ -// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].frac.f32( -// CHECK: ret float %hlsl.frac -float test_frac_double(double p0) { return frac(p0); } -// CHECK: define [[FNATTRS]] <2 x float> @ -// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].frac.v2f32 -// CHECK: ret <2 x float> %hlsl.frac -float2 test_frac_double2(double2 p0) { return frac(p0); } -// CHECK: define [[FNATTRS]] <3 x float> @ -// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].frac.v3f32 -// CHECK: ret <3 x float> %hlsl.frac -float3 test_frac_double3(double3 p0) { return frac(p0); } -// CHECK: define [[FNATTRS]] <4 x float> @ -// CHECK: %hlsl.frac = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].frac.v4f32 -// CHECK: ret <4 x float> %hlsl.frac -float4 test_frac_double4(double4 p0) { return frac(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/lerp-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/lerp-overloads.hlsl new file mode 100644 index 0000000000000..6e452481e2fa2 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/lerp-overloads.hlsl @@ -0,0 +1,108 @@ +// RUN: %clang_cc1 -std=hlsl202x -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 \ +// RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv + +// CHECK-LABEL: test_lerp_double +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) +// CHECK: ret float %hlsl.lerp +float test_lerp_double(double p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_double2 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) +// CHECK: ret <2 x float> %hlsl.lerp +float2 test_lerp_double2(double2 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_double3 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) +// CHECK: ret <3 x float> %hlsl.lerp +float3 test_lerp_double3(double3 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_double4 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) +// CHECK: ret <4 x float> %hlsl.lerp +float4 test_lerp_double4(double4 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) +// CHECK: ret float %hlsl.lerp +float test_lerp_int(int p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int2 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) +// CHECK: ret <2 x float> %hlsl.lerp +float2 test_lerp_int2(int2 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int3 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) +// CHECK: ret <3 x float> %hlsl.lerp +float3 test_lerp_int3(int3 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int4 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) +// CHECK: ret <4 x float> %hlsl.lerp +float4 test_lerp_int4(int4 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) +// CHECK: ret float %hlsl.lerp +float test_lerp_uint(uint p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint2 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) +// CHECK: ret <2 x float> %hlsl.lerp +float2 test_lerp_uint2(uint2 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint3 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) +// CHECK: ret <3 x float> %hlsl.lerp +float3 test_lerp_uint3(uint3 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint4 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) +// CHECK: ret <4 x float> %hlsl.lerp +float4 test_lerp_uint4(uint4 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int64_t +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) +// CHECK: ret float %hlsl.lerp +float test_lerp_int64_t(int64_t p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int64_t2 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) +// CHECK: ret <2 x float> %hlsl.lerp +float2 test_lerp_int64_t2(int64_t2 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int64_t3 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) +// CHECK: ret <3 x float> %hlsl.lerp +float3 test_lerp_int64_t3(int64_t3 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_int64_t4 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) +// CHECK: ret <4 x float> %hlsl.lerp +float4 test_lerp_int64_t4(int64_t4 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint64_t +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) +// CHECK: ret float %hlsl.lerp +float test_lerp_uint64_t(uint64_t p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint64_t2 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) +// CHECK: ret <2 x float> %hlsl.lerp +float2 test_lerp_uint64_t2(uint64_t2 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint64_t3 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) +// CHECK: ret <3 x float> %hlsl.lerp +float3 test_lerp_uint64_t3(uint64_t3 p0) { return lerp(p0, p0, p0); } + +// CHECK-LABEL: test_lerp_uint64_t4 +// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) +// CHECK: ret <4 x float> %hlsl.lerp +float4 test_lerp_uint64_t4(uint64_t4 p0) { return lerp(p0, p0, p0); } diff --git a/clang/test/CodeGenHLSL/builtins/lerp.hlsl b/clang/test/CodeGenHLSL/builtins/lerp.hlsl index 4e81d72e7fa9f..d7a7113de4878 100644 --- a/clang/test/CodeGenHLSL/builtins/lerp.hlsl +++ b/clang/test/CodeGenHLSL/builtins/lerp.hlsl @@ -56,23 +56,3 @@ float3 test_lerp_float3(float3 p0) { return lerp(p0, p0, p0); } // CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) // CHECK: ret <4 x float> %hlsl.lerp float4 test_lerp_float4(float4 p0) { return lerp(p0, p0, p0); } - -// CHECK-LABEL: test_lerp_double -// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].lerp.f32(float %{{.*}}, float %{{.*}}, float %{{.*}}) -// CHECK: ret float %hlsl.lerp -float test_lerp_double(double p0) { return lerp(p0, p0, p0); } - -// CHECK-LABEL: test_lerp_double2 -// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].lerp.v2f32(<2 x float> %{{.*}}, <2 x float> %{{.*}}, <2 x float> %{{.*}}) -// CHECK: ret <2 x float> %hlsl.lerp -float2 test_lerp_double2(double2 p0) { return lerp(p0, p0, p0); } - -// CHECK-LABEL: test_lerp_double3 -// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].lerp.v3f32(<3 x float> %{{.*}}, <3 x float> %{{.*}}, <3 x float> %{{.*}}) -// CHECK: ret <3 x float> %hlsl.lerp -float3 test_lerp_double3(double3 p0) { return lerp(p0, p0, p0); } - -// CHECK-LABEL: test_lerp_double4 -// CHECK: %hlsl.lerp = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].lerp.v4f32(<4 x float> %{{.*}}, <4 x float> %{{.*}}, <4 x float> %{{.*}}) -// CHECK: ret <4 x float> %hlsl.lerp -float4 test_lerp_double4(double4 p0) { return lerp(p0, p0, p0); } diff --git a/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl new file mode 100644 index 0000000000000..5c63d630c3f3c --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/log-overloads.hlsl @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32( +float test_log_double(double p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32 +float2 test_log_double2(double2 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32 +float3 test_log_double3(double3 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 +float4 test_log_double4(double4 p0) { return log(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32( +float test_log_int(int p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32 +float2 test_log_int2(int2 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32 +float3 test_log_int3(int3 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 +float4 test_log_int4(int4 p0) { return log(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32( +float test_log_uint(uint p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32 +float2 test_log_uint2(uint2 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32 +float3 test_log_uint3(uint3 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 +float4 test_log_uint4(uint4 p0) { return log(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32( +float test_log_int64_t(int64_t p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32 +float2 test_log_int64_t2(int64_t2 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32 +float3 test_log_int64_t3(int64_t3 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 +float4 test_log_int64_t4(int64_t4 p0) { return log(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32( +float test_log_uint64_t(uint64_t p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32 +float2 test_log_uint64_t2(uint64_t2 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32 +float3 test_log_uint64_t3(uint64_t3 p0) { return log(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 +float4 test_log_uint64_t4(uint64_t4 p0) { return log(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/log.hlsl b/clang/test/CodeGenHLSL/builtins/log.hlsl index 3b44a74c72355..e489939594a53 100644 --- a/clang/test/CodeGenHLSL/builtins/log.hlsl +++ b/clang/test/CodeGenHLSL/builtins/log.hlsl @@ -38,16 +38,3 @@ float3 test_log_float3(float3 p0) { return log(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z15test_log_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 float4 test_log_float4(float4 p0) { return log(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log.f32( -float test_log_double(double p0) { return log(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log.v2f32 -float2 test_log_double2(double2 p0) { return log(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log.v3f32 -float3 test_log_double3(double3 p0) { return log(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log.v4f32 -float4 test_log_double4(double4 p0) { return log(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl new file mode 100644 index 0000000000000..1a0539c3517d5 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/log10-overloads.hlsl @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log10_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log10.f32( +float test_log10_double(double p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log10_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log10.v2f32 +float2 test_log10_double2(double2 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log10_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log10.v3f32 +float3 test_log10_double3(double3 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log10_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 +float4 test_log10_double4(double4 p0) { return log10(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log10_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log10.f32( +float test_log10_int(int p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log10_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log10.v2f32 +float2 test_log10_int2(int2 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log10_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log10.v3f32 +float3 test_log10_int3(int3 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log10_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 +float4 test_log10_int4(int4 p0) { return log10(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log10_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log10.f32( +float test_log10_uint(uint p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log10_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log10.v2f32 +float2 test_log10_uint2(uint2 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log10_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log10.v3f32 +float3 test_log10_uint3(uint3 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log10_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 +float4 test_log10_uint4(uint4 p0) { return log10(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log10_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log10.f32( +float test_log10_int64_t(int64_t p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log10_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log10.v2f32 +float2 test_log10_int64_t2(int64_t2 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log10_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log10.v3f32 +float3 test_log10_int64_t3(int64_t3 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log10_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 +float4 test_log10_int64_t4(int64_t4 p0) { return log10(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log10_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log10.f32( +float test_log10_uint64_t(uint64_t p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log10_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log10.v2f32 +float2 test_log10_uint64_t2(uint64_t2 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log10_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log10.v3f32 +float3 test_log10_uint64_t3(uint64_t3 p0) { return log10(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log10_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 +float4 test_log10_uint64_t4(uint64_t4 p0) { return log10(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/log10.hlsl b/clang/test/CodeGenHLSL/builtins/log10.hlsl index a5e77153f53b0..37c8e837c45a3 100644 --- a/clang/test/CodeGenHLSL/builtins/log10.hlsl +++ b/clang/test/CodeGenHLSL/builtins/log10.hlsl @@ -38,16 +38,3 @@ float3 test_log10_float3(float3 p0) { return log10(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z17test_log10_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 float4 test_log10_float4(float4 p0) { return log10(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log10_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log10.f32( -float test_log10_double(double p0) { return log10(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log10_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log10.v2f32 -float2 test_log10_double2(double2 p0) { return log10(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log10_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log10.v3f32 -float3 test_log10_double3(double3 p0) { return log10(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log10_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log10.v4f32 -float4 test_log10_double4(double4 p0) { return log10(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl new file mode 100644 index 0000000000000..c35b50d8e490a --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/log2-overloads.hlsl @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log2_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log2.f32( +float test_log2_double(double p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log2_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log2.v2f32 +float2 test_log2_double2(double2 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log2_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log2.v3f32 +float3 test_log2_double3(double3 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log2_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 +float4 test_log2_double4(double4 p0) { return log2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log2_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log2.f32( +float test_log2_int(int p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log2_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log2.v2f32 +float2 test_log2_int2(int2 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log2_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log2.v3f32 +float3 test_log2_int3(int3 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log2_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 +float4 test_log2_int4(int4 p0) { return log2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log2_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log2.f32( +float test_log2_uint(uint p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log2_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log2.v2f32 +float2 test_log2_uint2(uint2 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log2_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log2.v3f32 +float3 test_log2_uint3(uint3 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log2_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 +float4 test_log2_uint4(uint4 p0) { return log2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log2_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log2.f32( +float test_log2_int64_t(int64_t p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log2_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log2.v2f32 +float2 test_log2_int64_t2(int64_t2 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log2_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log2.v3f32 +float3 test_log2_int64_t3(int64_t3 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log2_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 +float4 test_log2_int64_t4(int64_t4 p0) { return log2(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log2_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log2.f32( +float test_log2_uint64_t(uint64_t p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log2_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log2.v2f32 +float2 test_log2_uint64_t2(uint64_t2 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log2_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log2.v3f32 +float3 test_log2_uint64_t3(uint64_t3 p0) { return log2(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log2_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 +float4 test_log2_uint64_t4(uint64_t4 p0) { return log2(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/log2.hlsl b/clang/test/CodeGenHLSL/builtins/log2.hlsl index 9af346289f8dc..5159d5bb0fa4e 100644 --- a/clang/test/CodeGenHLSL/builtins/log2.hlsl +++ b/clang/test/CodeGenHLSL/builtins/log2.hlsl @@ -38,16 +38,3 @@ float3 test_log2_float3(float3 p0) { return log2(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z16test_log2_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 float4 test_log2_float4(float4 p0) { return log2(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_log2_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.log2.f32( -float test_log2_double(double p0) { return log2(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_log2_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.log2.v2f32 -float2 test_log2_double2(double2 p0) { return log2(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_log2_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.log2.v3f32 -float3 test_log2_double3(double3 p0) { return log2(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_log2_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.log2.v4f32 -float4 test_log2_double4(double4 p0) { return log2(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl new file mode 100644 index 0000000000000..e9baa25fc6409 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/normalize-overloads.hlsl @@ -0,0 +1,156 @@ +// RUN: %clang_cc1 -std=hlsl202x -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 \ +// RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float +// CHECK: ret float +float test_normalize_double(double p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> +// CHECK: ret <2 x float> %hlsl.normalize +float2 test_normalize_double2(double2 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32( +// CHECK: ret <3 x float> %hlsl.normalize +float3 test_normalize_double3(double3 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32( +// CHECK: ret <4 x float> %hlsl.normalize +float4 test_length_double4(double4 p0) +{ + return normalize(p0); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float +// CHECK: ret float +float test_normalize_int(int p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> +// CHECK: ret <2 x float> %hlsl.normalize +float2 test_normalize_int2(int2 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32( +// CHECK: ret <3 x float> %hlsl.normalize +float3 test_normalize_int3(int3 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32( +// CHECK: ret <4 x float> %hlsl.normalize +float4 test_length_int4(int4 p0) +{ + return normalize(p0); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float +// CHECK: ret float +float test_normalize_uint(uint p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> + +// CHECK: ret <2 x float> %hlsl.normalize +float2 test_normalize_uint2(uint2 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32( +// CHECK: ret <3 x float> %hlsl.normalize +float3 test_normalize_uint3(uint3 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32( +// CHECK: ret <4 x float> %hlsl.normalize +float4 test_length_uint4(uint4 p0) +{ + return normalize(p0); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float +// CHECK: ret float +float test_normalize_int64_t(int64_t p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> + +// CHECK: ret <2 x float> %hlsl.normalize +float2 test_normalize_int64_t2(int64_t2 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32( +// CHECK: ret <3 x float> %hlsl.normalize +float3 test_normalize_int64_t3(int64_t3 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32( +// CHECK: ret <4 x float> %hlsl.normalize +float4 test_length_int64_t4(int64_t4 p0) +{ + return normalize(p0); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float +// CHECK: ret float +float test_normalize_uint64_t(uint64_t p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> + +// CHECK: ret <2 x float> %hlsl.normalize +float2 test_normalize_uint64_t2(uint64_t2 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32( +// CHECK: ret <3 x float> %hlsl.normalize +float3 test_normalize_uint64_t3(uint64_t3 p0) +{ + return normalize(p0); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32( +// CHECK: ret <4 x float> %hlsl.normalize +float4 test_length_uint64_t4(uint64_t4 p0) +{ + return normalize(p0); +} diff --git a/clang/test/CodeGenHLSL/builtins/normalize.hlsl b/clang/test/CodeGenHLSL/builtins/normalize.hlsl index d17ab4fd09a13..830fc26b7acf0 100644 --- a/clang/test/CodeGenHLSL/builtins/normalize.hlsl +++ b/clang/test/CodeGenHLSL/builtins/normalize.hlsl @@ -83,33 +83,3 @@ float4 test_length_float4(float4 p0) { return normalize(p0); } - -// CHECK: define [[FNATTRS]] float @ -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].normalize.f32(float -// CHECK: ret float -float test_normalize_double(double p0) -{ - return normalize(p0); -} -// CHECK: define [[FNATTRS]] <2 x float> @ -// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].normalize.v2f32(<2 x float> - -// CHECK: ret <2 x float> %hlsl.normalize -float2 test_normalize_double2(double2 p0) -{ - return normalize(p0); -} -// CHECK: define [[FNATTRS]] <3 x float> @ -// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].normalize.v3f32( -// CHECK: ret <3 x float> %hlsl.normalize -float3 test_normalize_double3(double3 p0) -{ - return normalize(p0); -} -// CHECK: define [[FNATTRS]] <4 x float> @ -// CHECK: %hlsl.normalize = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].normalize.v4f32( -// CHECK: ret <4 x float> %hlsl.normalize -float4 test_length_double4(double4 p0) -{ - return normalize(p0); -} diff --git a/clang/test/CodeGenHLSL/builtins/pow-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/pow-overloads.hlsl new file mode 100644 index 0000000000000..0d61c07666dc8 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/pow-overloads.hlsl @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_pow_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.pow.f32( +float test_pow_double(double p0, double p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_pow_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.pow.v2f32 +float2 test_pow_double2(double2 p0, double2 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_pow_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.pow.v3f32 +float3 test_pow_double3(double3 p0, double3 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_pow_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 +float4 test_pow_double4(double4 p0, double4 p1) { return pow(p0, p1); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_pow_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.pow.f32( +float test_pow_int(int p0, int p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_pow_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.pow.v2f32 +float2 test_pow_int2(int2 p0, int2 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_pow_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.pow.v3f32 +float3 test_pow_int3(int3 p0, int3 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_pow_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 +float4 test_pow_int4(int4 p0, int4 p1) { return pow(p0, p1); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_pow_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.pow.f32( +float test_pow_uint(uint p0, uint p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_pow_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.pow.v2f32 +float2 test_pow_uint2(uint2 p0, uint2 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_pow_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.pow.v3f32 +float3 test_pow_uint3(uint3 p0, uint3 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_pow_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 +float4 test_pow_uint4(uint4 p0, uint4 p1) { return pow(p0, p1); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_pow_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.pow.f32( +float test_pow_int64_t(int64_t p0, int64_t p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_pow_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.pow.v2f32 +float2 test_pow_int64_t2(int64_t2 p0, int64_t2 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_pow_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.pow.v3f32 +float3 test_pow_int64_t3(int64_t3 p0, int64_t3 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_pow_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 +float4 test_pow_int64_t4(int64_t4 p0, int64_t4 p1) { return pow(p0, p1); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_pow_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.pow.f32( +float test_pow_uint64_t(uint64_t p0, uint64_t p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_pow_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.pow.v2f32 +float2 test_pow_uint64_t2(uint64_t2 p0, uint64_t2 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_pow_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.pow.v3f32 +float3 test_pow_uint64_t3(uint64_t3 p0, uint64_t3 p1) { return pow(p0, p1); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_pow_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 +float4 test_pow_uint64_t4(uint64_t4 p0, uint64_t4 p1) { return pow(p0, p1); } diff --git a/clang/test/CodeGenHLSL/builtins/pow.hlsl b/clang/test/CodeGenHLSL/builtins/pow.hlsl index b8b9c68698237..fd21f1b94c57e 100644 --- a/clang/test/CodeGenHLSL/builtins/pow.hlsl +++ b/clang/test/CodeGenHLSL/builtins/pow.hlsl @@ -38,16 +38,3 @@ float3 test_pow_float3(float3 p0, float3 p1) { return pow(p0, p1); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z15test_pow_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 float4 test_pow_float4(float4 p0, float4 p1) { return pow(p0, p1); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_pow_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.pow.f32( -float test_pow_double(double p0, double p1) { return pow(p0, p1); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_pow_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.pow.v2f32 -float2 test_pow_double2(double2 p0, double2 p1) { return pow(p0, p1); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_pow_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.pow.v3f32 -float3 test_pow_double3(double3 p0, double3 p1) { return pow(p0, p1); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_pow_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.pow.v4f32 -float4 test_pow_double4(double4 p0, double4 p1) { return pow(p0, p1); } diff --git a/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl new file mode 100644 index 0000000000000..d0cfc7b60265b --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/radians-overloads.hlsl @@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -std=hlsl202x -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 \ +// RUN: -DTARGET=dx -DFNATTRS="noundef nofpclass(nan inf)" +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DTARGET=spv -DFNATTRS="spir_func noundef nofpclass(nan inf)" + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32( +// CHECK: ret float %{{.*}} +float test_radians_double(double p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_radians_double2(double2 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_radians_double3(double3 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_radians_double4(double4 p0) { return radians(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32( +// CHECK: ret float %{{.*}} +float test_radians_int(int p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_radians_int2(int2 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_radians_int3(int3 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_radians_int4(int4 p0) { return radians(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32( +// CHECK: ret float %{{.*}} +float test_radians_uint(uint p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_radians_uint2(uint2 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_radians_uint3(uint3 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_radians_uint4(uint4 p0) { return radians(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32( +// CHECK: ret float %{{.*}} +float test_radians_int64_t(int64_t p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_radians_int64_t2(int64_t2 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_radians_int64_t3(int64_t3 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_radians_int64_t4(int64_t4 p0) { return radians(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32( +// CHECK: ret float %{{.*}} +float test_radians_uint64_t(uint64_t p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_radians_uint64_t2(uint64_t2 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_radians_uint64_t3(uint64_t3 p0) { return radians(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_radians_uint64_t4(uint64_t4 p0) { return radians(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/radians.hlsl b/clang/test/CodeGenHLSL/builtins/radians.hlsl index 0cc5d24f921af..efdeb9f6e142a 100644 --- a/clang/test/CodeGenHLSL/builtins/radians.hlsl +++ b/clang/test/CodeGenHLSL/builtins/radians.hlsl @@ -63,20 +63,3 @@ float3 test_radians_float3(float3 p0) { return radians(p0); } // CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 // CHECK: ret <4 x float> %{{.*}} float4 test_radians_float4(float4 p0) { return radians(p0); } - -// CHECK: define [[FNATTRS]] float @ -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].radians.f32( -// CHECK: ret float %{{.*}} -float test_radians_double(double p0) { return radians(p0); } -// CHECK: define [[FNATTRS]] <2 x float> @ -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].radians.v2f32 -// CHECK: ret <2 x float> %{{.*}} -float2 test_radians_double2(double2 p0) { return radians(p0); } -// CHECK: define [[FNATTRS]] <3 x float> @ -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].radians.v3f32 -// CHECK: ret <3 x float> %{{.*}} -float3 test_radians_double3(double3 p0) { return radians(p0); } -// CHECK: define [[FNATTRS]] <4 x float> @ -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].radians.v4f32 -// CHECK: ret <4 x float> %{{.*}} -float4 test_radians_double4(double4 p0) { return radians(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl new file mode 100644 index 0000000000000..109633a64d34e --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/round-overloads.hlsl @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_round_double +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn float @llvm.roundeven.f32( +// CHECK: ret float %elt.roundeven +float test_round_double(double p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_round_double2 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.roundeven.v2f32 +// CHECK: ret <2 x float> %elt.roundeven +float2 test_round_double2(double2 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_round_double3 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.roundeven.v3f32 +// CHECK: ret <3 x float> %elt.roundeven +float3 test_round_double3(double3 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_round_double4 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 +// CHECK: ret <4 x float> %elt.roundeven +float4 test_round_double4(double4 p0) { return round(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_round_int +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn float @llvm.roundeven.f32( +// CHECK: ret float %elt.roundeven +float test_round_int(int p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_round_int2 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.roundeven.v2f32 +// CHECK: ret <2 x float> %elt.roundeven +float2 test_round_int2(int2 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_round_int3 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.roundeven.v3f32 +// CHECK: ret <3 x float> %elt.roundeven +float3 test_round_int3(int3 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_round_int4 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 +// CHECK: ret <4 x float> %elt.roundeven +float4 test_round_int4(int4 p0) { return round(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_round_uint +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn float @llvm.roundeven.f32( +// CHECK: ret float %elt.roundeven +float test_round_uint(uint p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_round_uint2 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.roundeven.v2f32 +// CHECK: ret <2 x float> %elt.roundeven +float2 test_round_uint2(uint2 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_round_uint3 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.roundeven.v3f32 +// CHECK: ret <3 x float> %elt.roundeven +float3 test_round_uint3(uint3 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_round_uint4 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 +// CHECK: ret <4 x float> %elt.roundeven +float4 test_round_uint4(uint4 p0) { return round(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_round_int64_t +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn float @llvm.roundeven.f32( +// CHECK: ret float %elt.roundeven +float test_round_int64_t(int64_t p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_round_int64_t2 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.roundeven.v2f32 +// CHECK: ret <2 x float> %elt.roundeven +float2 test_round_int64_t2(int64_t2 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_round_int64_t3 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.roundeven.v3f32 +// CHECK: ret <3 x float> %elt.roundeven +float3 test_round_int64_t3(int64_t3 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_round_int64_t4 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 +// CHECK: ret <4 x float> %elt.roundeven +float4 test_round_int64_t4(int64_t4 p0) { return round(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_round_uint64_t +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn float @llvm.roundeven.f32( +// CHECK: ret float %elt.roundeven +float test_round_uint64_t(uint64_t p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_round_uint64_t2 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.roundeven.v2f32 +// CHECK: ret <2 x float> %elt.roundeven +float2 test_round_uint64_t2(uint64_t2 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_round_uint64_t3 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.roundeven.v3f32 +// CHECK: ret <3 x float> %elt.roundeven +float3 test_round_uint64_t3(uint64_t3 p0) { return round(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_round_uint64_t4 +// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 +// CHECK: ret <4 x float> %elt.roundeven +float4 test_round_uint64_t4(uint64_t4 p0) { return round(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/round.hlsl b/clang/test/CodeGenHLSL/builtins/round.hlsl index a2c00c8cb36fc..a945a9677abbb 100644 --- a/clang/test/CodeGenHLSL/builtins/round.hlsl +++ b/clang/test/CodeGenHLSL/builtins/round.hlsl @@ -50,20 +50,3 @@ float3 test_round_float3(float3 p0) { return round(p0); } // CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 // CHECK: ret <4 x float> %elt.roundeven float4 test_round_float4(float4 p0) { return round(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_round_double -// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn float @llvm.roundeven.f32( -// CHECK: ret float %elt.roundeven -float test_round_double(double p0) { return round(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_round_double2 -// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.roundeven.v2f32 -// CHECK: ret <2 x float> %elt.roundeven -float2 test_round_double2(double2 p0) { return round(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_round_double3 -// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.roundeven.v3f32 -// CHECK: ret <3 x float> %elt.roundeven -float3 test_round_double3(double3 p0) { return round(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_round_double4 -// CHECK: %elt.roundeven = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.roundeven.v4f32 -// CHECK: ret <4 x float> %elt.roundeven -float4 test_round_double4(double4 p0) { return round(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl new file mode 100644 index 0000000000000..09f21f366b9d2 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/rsqrt-overloads.hlsl @@ -0,0 +1,93 @@ +// RUN: %clang_cc1 -std=hlsl202x -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 \ +// RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].rsqrt.f32( +// CHECK: ret float %hlsl.rsqrt +float test_rsqrt_double(double p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].rsqrt.v2f32 +// CHECK: ret <2 x float> %hlsl.rsqrt +float2 test_rsqrt_double2(double2 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].rsqrt.v3f32 +// CHECK: ret <3 x float> %hlsl.rsqrt +float3 test_rsqrt_double3(double3 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 +// CHECK: ret <4 x float> %hlsl.rsqrt +float4 test_rsqrt_double4(double4 p0) { return rsqrt(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].rsqrt.f32( +// CHECK: ret float %hlsl.rsqrt +float test_rsqrt_int(int p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].rsqrt.v2f32 +// CHECK: ret <2 x float> %hlsl.rsqrt +float2 test_rsqrt_int2(int2 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].rsqrt.v3f32 +// CHECK: ret <3 x float> %hlsl.rsqrt +float3 test_rsqrt_int3(int3 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 +// CHECK: ret <4 x float> %hlsl.rsqrt +float4 test_rsqrt_int4(int4 p0) { return rsqrt(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].rsqrt.f32( +// CHECK: ret float %hlsl.rsqrt +float test_rsqrt_uint(uint p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].rsqrt.v2f32 +// CHECK: ret <2 x float> %hlsl.rsqrt +float2 test_rsqrt_uint2(uint2 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].rsqrt.v3f32 +// CHECK: ret <3 x float> %hlsl.rsqrt +float3 test_rsqrt_uint3(uint3 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 +// CHECK: ret <4 x float> %hlsl.rsqrt +float4 test_rsqrt_uint4(uint4 p0) { return rsqrt(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].rsqrt.f32( +// CHECK: ret float %hlsl.rsqrt +float test_rsqrt_int64_t(int64_t p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].rsqrt.v2f32 +// CHECK: ret <2 x float> %hlsl.rsqrt +float2 test_rsqrt_int64_t2(int64_t2 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].rsqrt.v3f32 +// CHECK: ret <3 x float> %hlsl.rsqrt +float3 test_rsqrt_int64_t3(int64_t3 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 +// CHECK: ret <4 x float> %hlsl.rsqrt +float4 test_rsqrt_int64_t4(int64_t4 p0) { return rsqrt(p0); } + +// CHECK: define [[FNATTRS]] float @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].rsqrt.f32( +// CHECK: ret float %hlsl.rsqrt +float test_rsqrt_uint64_t(uint64_t p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].rsqrt.v2f32 +// CHECK: ret <2 x float> %hlsl.rsqrt +float2 test_rsqrt_uint64_t2(uint64_t2 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].rsqrt.v3f32 +// CHECK: ret <3 x float> %hlsl.rsqrt +float3 test_rsqrt_uint64_t3(uint64_t3 p0) { return rsqrt(p0); } +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 +// CHECK: ret <4 x float> %hlsl.rsqrt +float4 test_rsqrt_uint64_t4(uint64_t4 p0) { return rsqrt(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/rsqrt.hlsl b/clang/test/CodeGenHLSL/builtins/rsqrt.hlsl index 512bb6170a491..6c9b1f643713b 100644 --- a/clang/test/CodeGenHLSL/builtins/rsqrt.hlsl +++ b/clang/test/CodeGenHLSL/builtins/rsqrt.hlsl @@ -62,20 +62,3 @@ float3 test_rsqrt_float3(float3 p0) { return rsqrt(p0); } // CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 // CHECK: ret <4 x float> %hlsl.rsqrt float4 test_rsqrt_float4(float4 p0) { return rsqrt(p0); } - -// CHECK: define [[FNATTRS]] float @ -// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].rsqrt.f32( -// CHECK: ret float %hlsl.rsqrt -float test_rsqrt_double(double p0) { return rsqrt(p0); } -// CHECK: define [[FNATTRS]] <2 x float> @ -// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].rsqrt.v2f32 -// CHECK: ret <2 x float> %hlsl.rsqrt -float2 test_rsqrt_double2(double2 p0) { return rsqrt(p0); } -// CHECK: define [[FNATTRS]] <3 x float> @ -// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].rsqrt.v3f32 -// CHECK: ret <3 x float> %hlsl.rsqrt -float3 test_rsqrt_double3(double3 p0) { return rsqrt(p0); } -// CHECK: define [[FNATTRS]] <4 x float> @ -// CHECK: %hlsl.rsqrt = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].rsqrt.v4f32 -// CHECK: ret <4 x float> %hlsl.rsqrt -float4 test_rsqrt_double4(double4 p0) { return rsqrt(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl new file mode 100644 index 0000000000000..a5522e4f28b7f --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/sin-overloads.hlsl @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sin_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sin.f32( +float test_sin_double(double p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sin_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sin.v2f32 +float2 test_sin_double2(double2 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sin_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sin.v3f32 +float3 test_sin_double3(double3 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sin_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 +float4 test_sin_double4(double4 p0) { return sin(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sin_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sin.f32( +float test_sin_int(int p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sin_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sin.v2f32 +float2 test_sin_int2(int2 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sin_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sin.v3f32 +float3 test_sin_int3(int3 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sin_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 +float4 test_sin_int4(int4 p0) { return sin(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sin_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sin.f32( +float test_sin_uint(uint p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sin_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sin.v2f32 +float2 test_sin_uint2(uint2 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sin_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sin.v3f32 +float3 test_sin_uint3(uint3 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sin_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 +float4 test_sin_uint4(uint4 p0) { return sin(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sin_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sin.f32( +float test_sin_int64_t(int64_t p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sin_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sin.v2f32 +float2 test_sin_int64_t2(int64_t2 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sin_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sin.v3f32 +float3 test_sin_int64_t3(int64_t3 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sin_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 +float4 test_sin_int64_t4(int64_t4 p0) { return sin(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sin_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sin.f32( +float test_sin_uint64_t(uint64_t p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sin_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sin.v2f32 +float2 test_sin_uint64_t2(uint64_t2 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sin_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sin.v3f32 +float3 test_sin_uint64_t3(uint64_t3 p0) { return sin(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sin_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 +float4 test_sin_uint64_t4(uint64_t4 p0) { return sin(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/sin.hlsl b/clang/test/CodeGenHLSL/builtins/sin.hlsl index fc44f35f838a9..69c657239ef95 100644 --- a/clang/test/CodeGenHLSL/builtins/sin.hlsl +++ b/clang/test/CodeGenHLSL/builtins/sin.hlsl @@ -38,16 +38,3 @@ float3 test_sin_float3(float3 p0) { return sin(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z15test_sin_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 float4 test_sin_float4(float4 p0) { return sin(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sin_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sin.f32( -float test_sin_double(double p0) { return sin(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sin_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sin.v2f32 -float2 test_sin_double2(double2 p0) { return sin(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sin_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sin.v3f32 -float3 test_sin_double3(double3 p0) { return sin(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sin_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sin.v4f32 -float4 test_sin_double4(double4 p0) { return sin(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl new file mode 100644 index 0000000000000..64ff8a69d4eec --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/sinh-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: test_sinh_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sinh.f32 +float test_sinh_double ( double p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sinh.v2f32 +float2 test_sinh_double2 ( double2 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sinh.v3f32 +float3 test_sinh_double3 ( double3 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sinh.v4f32 +float4 test_sinh_double4 ( double4 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sinh.f32 +float test_sinh_int ( int p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sinh.v2f32 +float2 test_sinh_int2 ( int2 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sinh.v3f32 +float3 test_sinh_int3 ( int3 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sinh.v4f32 +float4 test_sinh_int4 ( int4 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sinh.f32 +float test_sinh_uint ( uint p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sinh.v2f32 +float2 test_sinh_uint2 ( uint2 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sinh.v3f32 +float3 test_sinh_uint3 ( uint3 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sinh.v4f32 +float4 test_sinh_uint4 ( uint4 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sinh.f32 +float test_sinh_int64_t ( int64_t p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sinh.v2f32 +float2 test_sinh_int64_t2 ( int64_t2 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sinh.v3f32 +float3 test_sinh_int64_t3 ( int64_t3 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sinh.v4f32 +float4 test_sinh_int64_t4 ( int64_t4 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sinh.f32 +float test_sinh_uint64_t ( uint64_t p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sinh.v2f32 +float2 test_sinh_uint64_t2 ( uint64_t2 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sinh.v3f32 +float3 test_sinh_uint64_t3 ( uint64_t3 p0 ) { + return sinh ( p0 ); +} + +// CHECK-LABEL: test_sinh_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sinh.v4f32 +float4 test_sinh_uint64_t4 ( uint64_t4 p0 ) { + return sinh ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/sinh.hlsl b/clang/test/CodeGenHLSL/builtins/sinh.hlsl index 2850877180a4e..d55d60515418c 100644 --- a/clang/test/CodeGenHLSL/builtins/sinh.hlsl +++ b/clang/test/CodeGenHLSL/builtins/sinh.hlsl @@ -57,27 +57,3 @@ float3 test_sinh_float3 ( float3 p0 ) { float4 test_sinh_float4 ( float4 p0 ) { return sinh ( p0 ); } - -// CHECK-LABEL: test_sinh_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.sinh.f32 -float test_sinh_double ( double p0 ) { - return sinh ( p0 ); -} - -// CHECK-LABEL: test_sinh_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sinh.v2f32 -float2 test_sinh_double2 ( double2 p0 ) { - return sinh ( p0 ); -} - -// CHECK-LABEL: test_sinh_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sinh.v3f32 -float3 test_sinh_double3 ( double3 p0 ) { - return sinh ( p0 ); -} - -// CHECK-LABEL: test_sinh_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sinh.v4f32 -float4 test_sinh_double4 ( double4 p0 ) { - return sinh ( p0 ); -} diff --git a/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl new file mode 100644 index 0000000000000..48b74c9db5c64 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/sqrt-overloads.hlsl @@ -0,0 +1,88 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sqrt_double +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32( +// CHECK: ret float %{{.*}} +float test_sqrt_double(double p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sqrt_double2 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sqrt.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_sqrt_double2(double2 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sqrt_double3 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sqrt.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_sqrt_double3(double3 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sqrt_double4 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_sqrt_double4(double4 p0) { return sqrt(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sqrt_int +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32( +// CHECK: ret float %{{.*}} +float test_sqrt_int(int p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sqrt_int2 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sqrt.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_sqrt_int2(int2 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sqrt_int3 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sqrt.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_sqrt_int3(int3 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sqrt_int4 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_sqrt_int4(int4 p0) { return sqrt(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sqrt_uint +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32( +// CHECK: ret float %{{.*}} +float test_sqrt_uint(uint p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sqrt_uint2 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sqrt.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_sqrt_uint2(uint2 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sqrt_uint3 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sqrt.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_sqrt_uint3(uint3 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sqrt_uint4 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_sqrt_uint4(uint4 p0) { return sqrt(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sqrt_int64_t +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32( +// CHECK: ret float %{{.*}} +float test_sqrt_int64_t(int64_t p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sqrt_int64_t2 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sqrt.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_sqrt_int64_t2(int64_t2 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sqrt_int64_t3 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sqrt.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_sqrt_int64_t3(int64_t3 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sqrt_int64_t4 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_sqrt_int64_t4(int64_t4 p0) { return sqrt(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sqrt_uint64_t +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32( +// CHECK: ret float %{{.*}} +float test_sqrt_uint64_t(uint64_t p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sqrt_uint64_t2 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sqrt.v2f32 +// CHECK: ret <2 x float> %{{.*}} +float2 test_sqrt_uint64_t2(uint64_t2 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sqrt_uint64_t3 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sqrt.v3f32 +// CHECK: ret <3 x float> %{{.*}} +float3 test_sqrt_uint64_t3(uint64_t3 p0) { return sqrt(p0); } +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sqrt_uint64_t4 +// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 +// CHECK: ret <4 x float> %{{.*}} +float4 test_sqrt_uint64_t4(uint64_t4 p0) { return sqrt(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/sqrt.hlsl b/clang/test/CodeGenHLSL/builtins/sqrt.hlsl index cda6df9a5bb7a..94d966f0bef8a 100644 --- a/clang/test/CodeGenHLSL/builtins/sqrt.hlsl +++ b/clang/test/CodeGenHLSL/builtins/sqrt.hlsl @@ -50,20 +50,3 @@ float3 test_sqrt_float3(float3 p0) { return sqrt(p0); } // CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 // CHECK: ret <4 x float> %{{.*}} float4 test_sqrt_float4(float4 p0) { return sqrt(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_sqrt_double -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn float @llvm.sqrt.f32( -// CHECK: ret float %{{.*}} -float test_sqrt_double(double p0) { return sqrt(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_sqrt_double2 -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.sqrt.v2f32 -// CHECK: ret <2 x float> %{{.*}} -float2 test_sqrt_double2(double2 p0) { return sqrt(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_sqrt_double3 -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.sqrt.v3f32 -// CHECK: ret <3 x float> %{{.*}} -float3 test_sqrt_double3(double3 p0) { return sqrt(p0); } -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_sqrt_double4 -// CHECK: %{{.*}} = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.sqrt.v4f32 -// CHECK: ret <4 x float> %{{.*}} -float4 test_sqrt_double4(double4 p0) { return sqrt(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl new file mode 100644 index 0000000000000..d3b979254391c --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/step-overloads.hlsl @@ -0,0 +1,153 @@ +// RUN: %clang_cc1 -std=hlsl202x -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 \ +// RUN: -DFNATTRS="noundef nofpclass(nan inf)" -DTARGET=dx +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK \ +// RUN: -DFNATTRS="spir_func noundef nofpclass(nan inf)" -DTARGET=spv + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].step.f32(float +// CHECK: ret float +float test_step_double(double p0, double p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].step.v2f32( +// CHECK: ret <2 x float> %hlsl.step +float2 test_step_double2(double2 p0, double2 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].step.v3f32( +// CHECK: ret <3 x float> %hlsl.step +float3 test_step_double3(double3 p0, double3 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].step.v4f32( +// CHECK: ret <4 x float> %hlsl.step +float4 test_step_double4(double4 p0, double4 p1) +{ + return step(p0, p1); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].step.f32(float +// CHECK: ret float +float test_step_int(int p0, int p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].step.v2f32( +// CHECK: ret <2 x float> %hlsl.step +float2 test_step_int2(int2 p0, int2 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].step.v3f32( +// CHECK: ret <3 x float> %hlsl.step +float3 test_step_int3(int3 p0, int3 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].step.v4f32( +// CHECK: ret <4 x float> %hlsl.step +float4 test_step_int4(int4 p0, int4 p1) +{ + return step(p0, p1); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].step.f32(float +// CHECK: ret float +float test_step_uint(uint p0, uint p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].step.v2f32( +// CHECK: ret <2 x float> %hlsl.step +float2 test_step_uint2(uint2 p0, uint2 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].step.v3f32( +// CHECK: ret <3 x float> %hlsl.step +float3 test_step_uint3(uint3 p0, uint3 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].step.v4f32( +// CHECK: ret <4 x float> %hlsl.step +float4 test_step_uint4(uint4 p0, uint4 p1) +{ + return step(p0, p1); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].step.f32(float +// CHECK: ret float +float test_step_int64_t(int64_t p0, int64_t p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].step.v2f32( +// CHECK: ret <2 x float> %hlsl.step +float2 test_step_int64_t2(int64_t2 p0, int64_t2 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].step.v3f32( +// CHECK: ret <3 x float> %hlsl.step +float3 test_step_int64_t3(int64_t3 p0, int64_t3 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].step.v4f32( +// CHECK: ret <4 x float> %hlsl.step +float4 test_step_int64_t4(int64_t4 p0, int64_t4 p1) +{ + return step(p0, p1); +} + +// CHECK: define [[FNATTRS]] float @ +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].step.f32(float +// CHECK: ret float +float test_step_uint64_t(uint64_t p0, uint64_t p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <2 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].step.v2f32( +// CHECK: ret <2 x float> %hlsl.step +float2 test_step_uint64_t2(uint64_t2 p0, uint64_t2 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <3 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].step.v3f32( +// CHECK: ret <3 x float> %hlsl.step +float3 test_step_uint64_t3(uint64_t3 p0, uint64_t3 p1) +{ + return step(p0, p1); +} +// CHECK: define [[FNATTRS]] <4 x float> @ +// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].step.v4f32( +// CHECK: ret <4 x float> %hlsl.step +float4 test_step_uint64_t4(uint64_t4 p0, uint64_t4 p1) +{ + return step(p0, p1); +} diff --git a/clang/test/CodeGenHLSL/builtins/step.hlsl b/clang/test/CodeGenHLSL/builtins/step.hlsl index 1494f284aa6f5..49d09e5c6fe6f 100644 --- a/clang/test/CodeGenHLSL/builtins/step.hlsl +++ b/clang/test/CodeGenHLSL/builtins/step.hlsl @@ -82,32 +82,3 @@ float4 test_step_float4(float4 p0, float4 p1) { return step(p0, p1); } - -// CHECK: define [[FNATTRS]] float @ -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.[[TARGET]].step.f32(float -// CHECK: ret float -float test_step_double(double p0, double p1) -{ - return step(p0, p1); -} -// CHECK: define [[FNATTRS]] <2 x float> @ -// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.[[TARGET]].step.v2f32( -// CHECK: ret <2 x float> %hlsl.step -float2 test_step_double2(double2 p0, double2 p1) -{ - return step(p0, p1); -} -// CHECK: define [[FNATTRS]] <3 x float> @ -// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.[[TARGET]].step.v3f32( -// CHECK: ret <3 x float> %hlsl.step -float3 test_step_double3(double3 p0, double3 p1) -{ - return step(p0, p1); -} -// CHECK: define [[FNATTRS]] <4 x float> @ -// CHECK: %hlsl.step = call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.[[TARGET]].step.v4f32( -// CHECK: ret <4 x float> %hlsl.step -float4 test_step_double4(double4 p0, double4 p1) -{ - return step(p0, p1); -} diff --git a/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl new file mode 100644 index 0000000000000..cd6b6aa903032 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/tan-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: test_tan_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tan.f32 +float test_tan_double ( double p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tan.v2f32 +float2 test_tan_double2 ( double2 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tan.v3f32 +float3 test_tan_double3 ( double3 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tan.v4f32 +float4 test_tan_double4 ( double4 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tan.f32 +float test_tan_int ( int p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tan.v2f32 +float2 test_tan_int2 ( int2 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tan.v3f32 +float3 test_tan_int3 ( int3 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tan.v4f32 +float4 test_tan_int4 ( int4 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tan.f32 +float test_tan_uint ( uint p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tan.v2f32 +float2 test_tan_uint2 ( uint2 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tan.v3f32 +float3 test_tan_uint3 ( uint3 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tan.v4f32 +float4 test_tan_uint4 ( uint4 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tan.f32 +float test_tan_int64_t ( int64_t p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tan.v2f32 +float2 test_tan_int64_t2 ( int64_t2 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tan.v3f32 +float3 test_tan_int64_t3 ( int64_t3 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tan.v4f32 +float4 test_tan_int64_t4 ( int64_t4 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tan.f32 +float test_tan_uint64_t ( uint64_t p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tan.v2f32 +float2 test_tan_uint64_t2 ( uint64_t2 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tan.v3f32 +float3 test_tan_uint64_t3 ( uint64_t3 p0 ) { + return tan ( p0 ); +} + +// CHECK-LABEL: test_tan_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tan.v4f32 +float4 test_tan_uint64_t4 ( uint64_t4 p0 ) { + return tan ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/tan.hlsl b/clang/test/CodeGenHLSL/builtins/tan.hlsl index 3cc7d00508397..c8c948624a613 100644 --- a/clang/test/CodeGenHLSL/builtins/tan.hlsl +++ b/clang/test/CodeGenHLSL/builtins/tan.hlsl @@ -57,27 +57,3 @@ float3 test_tan_float3 ( float3 p0 ) { float4 test_tan_float4 ( float4 p0 ) { return tan ( p0 ); } - -// CHECK-LABEL: test_tan_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tan.f32 -float test_tan_double ( double p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tan.v2f32 -float2 test_tan_double2 ( double2 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tan.v3f32 -float3 test_tan_double3 ( double3 p0 ) { - return tan ( p0 ); -} - -// CHECK-LABEL: test_tan_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tan.v4f32 -float4 test_tan_double4 ( double4 p0 ) { - return tan ( p0 ); -} diff --git a/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl new file mode 100644 index 0000000000000..457395c6c2a15 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/tanh-overloads.hlsl @@ -0,0 +1,123 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -x hlsl -triple \ +// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \ +// RUN: -o - | FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: test_tanh_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tanh.f32 +float test_tanh_double ( double p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tanh.v2f32 +float2 test_tanh_double2 ( double2 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tanh.v3f32 +float3 test_tanh_double3 ( double3 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tanh.v4f32 +float4 test_tanh_double4 ( double4 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tanh.f32 +float test_tanh_int ( int p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tanh.v2f32 +float2 test_tanh_int2 ( int2 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tanh.v3f32 +float3 test_tanh_int3 ( int3 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tanh.v4f32 +float4 test_tanh_int4 ( int4 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tanh.f32 +float test_tanh_uint ( uint p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tanh.v2f32 +float2 test_tanh_uint2 ( uint2 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tanh.v3f32 +float3 test_tanh_uint3 ( uint3 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tanh.v4f32 +float4 test_tanh_uint4 ( uint4 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tanh.f32 +float test_tanh_int64_t ( int64_t p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tanh.v2f32 +float2 test_tanh_int64_t2 ( int64_t2 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tanh.v3f32 +float3 test_tanh_int64_t3 ( int64_t3 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tanh.v4f32 +float4 test_tanh_int64_t4 ( int64_t4 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tanh.f32 +float test_tanh_uint64_t ( uint64_t p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tanh.v2f32 +float2 test_tanh_uint64_t2 ( uint64_t2 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tanh.v3f32 +float3 test_tanh_uint64_t3 ( uint64_t3 p0 ) { + return tanh ( p0 ); +} + +// CHECK-LABEL: test_tanh_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tanh.v4f32 +float4 test_tanh_uint64_t4 ( uint64_t4 p0 ) { + return tanh ( p0 ); +} diff --git a/clang/test/CodeGenHLSL/builtins/tanh.hlsl b/clang/test/CodeGenHLSL/builtins/tanh.hlsl index 4f34a38bbf9ae..f947c7f53b110 100644 --- a/clang/test/CodeGenHLSL/builtins/tanh.hlsl +++ b/clang/test/CodeGenHLSL/builtins/tanh.hlsl @@ -57,27 +57,3 @@ float3 test_tanh_float3 ( float3 p0 ) { float4 test_tanh_float4 ( float4 p0 ) { return tanh ( p0 ); } - -// CHECK-LABEL: test_tanh_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.tanh.f32 -float test_tanh_double ( double p0 ) { - return tanh ( p0 ); -} - -// CHECK-LABEL: test_tanh_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.tanh.v2f32 -float2 test_tanh_double2 ( double2 p0 ) { - return tanh ( p0 ); -} - -// CHECK-LABEL: test_tanh_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.tanh.v3f32 -float3 test_tanh_double3 ( double3 p0 ) { - return tanh ( p0 ); -} - -// CHECK-LABEL: test_tanh_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.tanh.v4f32 -float4 test_tanh_double4 ( double4 p0 ) { - return tanh ( p0 ); -} diff --git a/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl b/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl new file mode 100644 index 0000000000000..d913aabfb4066 --- /dev/null +++ b/clang/test/CodeGenHLSL/builtins/trunc-overloads.hlsl @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -std=hlsl202x -finclude-default-header -triple dxil-pc-shadermodel6.3-library %s \ +// RUN: -emit-llvm -disable-llvm-passes -o - | \ +// RUN: FileCheck %s --check-prefixes=CHECK + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_trunc_double +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.trunc.f32( +float test_trunc_double(double p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_trunc_double2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.trunc.v2f32 +float2 test_trunc_double2(double2 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_trunc_double3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.trunc.v3f32 +float3 test_trunc_double3(double3 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_trunc_double4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 +float4 test_trunc_double4(double4 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_trunc_int +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.trunc.f32( +float test_trunc_int(int p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_trunc_int2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.trunc.v2f32 +float2 test_trunc_int2(int2 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_trunc_int3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.trunc.v3f32 +float3 test_trunc_int3(int3 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_trunc_int4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 +float4 test_trunc_int4(int4 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_trunc_uint +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.trunc.f32( +float test_trunc_uint(uint p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_trunc_uint2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.trunc.v2f32 +float2 test_trunc_uint2(uint2 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_trunc_uint3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.trunc.v3f32 +float3 test_trunc_uint3(uint3 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_trunc_uint4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 +float4 test_trunc_uint4(uint4 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_trunc_int64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.trunc.f32( +float test_trunc_int64_t(int64_t p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_trunc_int64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.trunc.v2f32 +float2 test_trunc_int64_t2(int64_t2 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_trunc_int64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.trunc.v3f32 +float3 test_trunc_int64_t3(int64_t3 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_trunc_int64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 +float4 test_trunc_int64_t4(int64_t4 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_trunc_uint64_t +// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.trunc.f32( +float test_trunc_uint64_t(uint64_t p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_trunc_uint64_t2 +// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.trunc.v2f32 +float2 test_trunc_uint64_t2(uint64_t2 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_trunc_uint64_t3 +// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.trunc.v3f32 +float3 test_trunc_uint64_t3(uint64_t3 p0) { return trunc(p0); } + +// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_trunc_uint64_t4 +// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 +float4 test_trunc_uint64_t4(uint64_t4 p0) { return trunc(p0); } diff --git a/clang/test/CodeGenHLSL/builtins/trunc.hlsl b/clang/test/CodeGenHLSL/builtins/trunc.hlsl index 66bd165cbd370..26de5bf94c3cc 100644 --- a/clang/test/CodeGenHLSL/builtins/trunc.hlsl +++ b/clang/test/CodeGenHLSL/builtins/trunc.hlsl @@ -44,19 +44,3 @@ float3 test_trunc_float3(float3 p0) { return trunc(p0); } // CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> @_Z17test_trunc_float4 // CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 float4 test_trunc_float4(float4 p0) { return trunc(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) float {{.*}}test_trunc_double -// CHECK: call reassoc nnan ninf nsz arcp afn float @llvm.trunc.f32( -float test_trunc_double(double p0) { return trunc(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) <2 x float> {{.*}}test_trunc_double2 -// CHECK: call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.trunc.v2f32 -float2 test_trunc_double2(double2 p0) { return trunc(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) <3 x float> {{.*}}test_trunc_double3 -// CHECK: call reassoc nnan ninf nsz arcp afn <3 x float> @llvm.trunc.v3f32 -float3 test_trunc_double3(double3 p0) { return trunc(p0); } - -// CHECK-LABEL: define noundef nofpclass(nan inf) <4 x float> {{.*}}test_trunc_double4 -// CHECK: call reassoc nnan ninf nsz arcp afn <4 x float> @llvm.trunc.v4f32 -float4 test_trunc_double4(double4 p0) { return trunc(p0); }