aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGenHLSL/builtins/cosh.hlsl
diff options
context:
space:
mode:
authorFarzon Lotfi <1802579+farzonl@users.noreply.github.com>2024-06-22 20:17:34 -0400
committerGitHub <noreply@github.com>2024-06-22 17:17:34 -0700
commitf73ac218a666e2017565f2210b47332ddcf55f00 (patch)
treeeea6bcf40a4736a0111a44e1bf2f6faf35cf8d8e /clang/test/CodeGenHLSL/builtins/cosh.hlsl
parentf3005d5b86ca947977f6056552b2a4648b9f0460 (diff)
downloadllvm-f73ac218a666e2017565f2210b47332ddcf55f00.zip
llvm-f73ac218a666e2017565f2210b47332ddcf55f00.tar.gz
llvm-f73ac218a666e2017565f2210b47332ddcf55f00.tar.bz2
[HLSL][clang] Add elementwise builtins for trig intrinsics (#95999)
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This is part 3 of 4 PRs. It sets the ground work for using the intrinsics in HLSL. Add HLSL frontend apis for `acos`, `asin`, `atan`, `cosh`, `sinh`, and `tanh` https://github.com/llvm/llvm-project/issues/70079 https://github.com/llvm/llvm-project/issues/70080 https://github.com/llvm/llvm-project/issues/70081 https://github.com/llvm/llvm-project/issues/70083 https://github.com/llvm/llvm-project/issues/70084 https://github.com/llvm/llvm-project/issues/95966
Diffstat (limited to 'clang/test/CodeGenHLSL/builtins/cosh.hlsl')
-rw-r--r--clang/test/CodeGenHLSL/builtins/cosh.hlsl59
1 files changed, 59 insertions, 0 deletions
diff --git a/clang/test/CodeGenHLSL/builtins/cosh.hlsl b/clang/test/CodeGenHLSL/builtins/cosh.hlsl
new file mode 100644
index 0000000..a192404
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/cosh.hlsl
@@ -0,0 +1,59 @@
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \
+// RUN: -emit-llvm -disable-llvm-passes -o - | FileCheck %s \
+// RUN: --check-prefixes=CHECK,NATIVE_HALF
+// RUN: %clang_cc1 -finclude-default-header -x hlsl -triple \
+// RUN: spirv-unknown-vulkan-compute %s -emit-llvm -disable-llvm-passes \
+// RUN: -o - | FileCheck %s --check-prefixes=CHECK,NO_HALF
+
+// CHECK-LABEL: test_cosh_half
+// NATIVE_HALF: call half @llvm.cosh.f16
+// NO_HALF: call float @llvm.cosh.f32
+half test_cosh_half ( half p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_half2
+// NATIVE_HALF: call <2 x half> @llvm.cosh.v2f16
+// NO_HALF: call <2 x float> @llvm.cosh.v2f32
+half2 test_cosh_half2 ( half2 p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_half3
+// NATIVE_HALF: call <3 x half> @llvm.cosh.v3f16
+// NO_HALF: call <3 x float> @llvm.cosh.v3f32
+half3 test_cosh_half3 ( half3 p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_half4
+// NATIVE_HALF: call <4 x half> @llvm.cosh.v4f16
+// NO_HALF: call <4 x float> @llvm.cosh.v4f32
+half4 test_cosh_half4 ( half4 p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_float
+// CHECK: call float @llvm.cosh.f32
+float test_cosh_float ( float p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_float2
+// CHECK: call <2 x float> @llvm.cosh.v2f32
+float2 test_cosh_float2 ( float2 p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_float3
+// CHECK: call <3 x float> @llvm.cosh.v3f32
+float3 test_cosh_float3 ( float3 p0 ) {
+ return cosh ( p0 );
+}
+
+// CHECK-LABEL: test_cosh_float4
+// CHECK: call <4 x float> @llvm.cosh.v4f32
+float4 test_cosh_float4 ( float4 p0 ) {
+ return cosh ( p0 );
+}