aboutsummaryrefslogtreecommitdiff
path: root/clang/test
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
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')
-rw-r--r--clang/test/CodeGen/builtins-elementwise-math.c96
-rw-r--r--clang/test/CodeGen/strictfp-elementwise-bulitins.cpp60
-rw-r--r--clang/test/CodeGenHLSL/builtins/acos.hlsl59
-rw-r--r--clang/test/CodeGenHLSL/builtins/asin.hlsl59
-rw-r--r--clang/test/CodeGenHLSL/builtins/atan.hlsl59
-rw-r--r--clang/test/CodeGenHLSL/builtins/cosh.hlsl59
-rw-r--r--clang/test/CodeGenHLSL/builtins/sinh.hlsl59
-rw-r--r--clang/test/CodeGenHLSL/builtins/tanh.hlsl59
-rw-r--r--clang/test/Sema/aarch64-sve-vector-trig-ops.c35
-rw-r--r--clang/test/Sema/builtins-elementwise-math.c126
-rw-r--r--clang/test/Sema/riscv-rvv-vector-trig-ops.c36
-rw-r--r--clang/test/SemaCXX/builtins-elementwise-math.cpp42
-rw-r--r--clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl6
13 files changed, 755 insertions, 0 deletions
diff --git a/clang/test/CodeGen/builtins-elementwise-math.c b/clang/test/CodeGen/builtins-elementwise-math.c
index 1b5466a..b52a11cc 100644
--- a/clang/test/CodeGen/builtins-elementwise-math.c
+++ b/clang/test/CodeGen/builtins-elementwise-math.c
@@ -375,6 +375,54 @@ void test_builtin_elementwise_ceil(float f1, float f2, double d1, double d2,
vf2 = __builtin_elementwise_ceil(vf1);
}
+void test_builtin_elementwise_acos(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_acos(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK-NEXT: call float @llvm.acos.f32(float [[F1]])
+ f2 = __builtin_elementwise_acos(f1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK-NEXT: call double @llvm.acos.f64(double [[D1]])
+ d2 = __builtin_elementwise_acos(d1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.acos.v4f32(<4 x float> [[VF1]])
+ vf2 = __builtin_elementwise_acos(vf1);
+}
+
+void test_builtin_elementwise_asin(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_asin(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK-NEXT: call float @llvm.asin.f32(float [[F1]])
+ f2 = __builtin_elementwise_asin(f1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK-NEXT: call double @llvm.asin.f64(double [[D1]])
+ d2 = __builtin_elementwise_asin(d1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.asin.v4f32(<4 x float> [[VF1]])
+ vf2 = __builtin_elementwise_asin(vf1);
+}
+
+void test_builtin_elementwise_atan(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_atan(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK-NEXT: call float @llvm.atan.f32(float [[F1]])
+ f2 = __builtin_elementwise_atan(f1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK-NEXT: call double @llvm.atan.f64(double [[D1]])
+ d2 = __builtin_elementwise_atan(d1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.atan.v4f32(<4 x float> [[VF1]])
+ vf2 = __builtin_elementwise_atan(vf1);
+}
+
void test_builtin_elementwise_cos(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2) {
// CHECK-LABEL: define void @test_builtin_elementwise_cos(
@@ -391,6 +439,22 @@ void test_builtin_elementwise_cos(float f1, float f2, double d1, double d2,
vf2 = __builtin_elementwise_cos(vf1);
}
+void test_builtin_elementwise_cosh(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_cosh(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK-NEXT: call float @llvm.cosh.f32(float [[F1]])
+ f2 = __builtin_elementwise_cosh(f1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK-NEXT: call double @llvm.cosh.f64(double [[D1]])
+ d2 = __builtin_elementwise_cosh(d1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.cosh.v4f32(<4 x float> [[VF1]])
+ vf2 = __builtin_elementwise_cosh(vf1);
+}
+
void test_builtin_elementwise_exp(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2) {
// CHECK-LABEL: define void @test_builtin_elementwise_exp(
@@ -588,6 +652,22 @@ void test_builtin_elementwise_sin(float f1, float f2, double d1, double d2,
vf2 = __builtin_elementwise_sin(vf1);
}
+void test_builtin_elementwise_sinh(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_sinh(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK-NEXT: call float @llvm.sinh.f32(float [[F1]])
+ f2 = __builtin_elementwise_sinh(f1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK-NEXT: call double @llvm.sinh.f64(double [[D1]])
+ d2 = __builtin_elementwise_sinh(d1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.sinh.v4f32(<4 x float> [[VF1]])
+ vf2 = __builtin_elementwise_sinh(vf1);
+}
+
void test_builtin_elementwise_sqrt(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2) {
// CHECK-LABEL: define void @test_builtin_elementwise_sqrt(
@@ -620,6 +700,22 @@ void test_builtin_elementwise_tan(float f1, float f2, double d1, double d2,
vf2 = __builtin_elementwise_tan(vf1);
}
+void test_builtin_elementwise_tanh(float f1, float f2, double d1, double d2,
+ float4 vf1, float4 vf2) {
+ // CHECK-LABEL: define void @test_builtin_elementwise_tanh(
+ // CHECK: [[F1:%.+]] = load float, ptr %f1.addr, align 4
+ // CHECK-NEXT: call float @llvm.tanh.f32(float [[F1]])
+ f2 = __builtin_elementwise_tanh(f1);
+
+ // CHECK: [[D1:%.+]] = load double, ptr %d1.addr, align 8
+ // CHECK-NEXT: call double @llvm.tanh.f64(double [[D1]])
+ d2 = __builtin_elementwise_tanh(d1);
+
+ // CHECK: [[VF1:%.+]] = load <4 x float>, ptr %vf1.addr, align 16
+ // CHECK-NEXT: call <4 x float> @llvm.tanh.v4f32(<4 x float> [[VF1]])
+ vf2 = __builtin_elementwise_tanh(vf1);
+}
+
void test_builtin_elementwise_trunc(float f1, float f2, double d1, double d2,
float4 vf1, float4 vf2) {
// CHECK-LABEL: define void @test_builtin_elementwise_trunc(
diff --git a/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp b/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp
index c72d594..55ba17a 100644
--- a/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp
+++ b/clang/test/CodeGen/strictfp-elementwise-bulitins.cpp
@@ -57,6 +57,16 @@ float4 strict_elementwise_ceil(float4 a) {
return __builtin_elementwise_ceil(a);
}
+// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_acosDv4_f
+// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[ELT_ACOS:%.*]] = tail call <4 x float> @llvm.acos.v4f32(<4 x float> [[A]]) #[[ATTR4]]
+// CHECK-NEXT: ret <4 x float> [[ELT_ACOS]]
+//
+float4 strict_elementwise_acos(float4 a) {
+ return __builtin_elementwise_acos(a);
+}
+
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_cosDv4_f
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: entry:
@@ -67,6 +77,16 @@ float4 strict_elementwise_cos(float4 a) {
return __builtin_elementwise_cos(a);
}
+// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_coshDv4_f
+// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[ELT_COSH:%.*]] = tail call <4 x float> @llvm.cosh.v4f32(<4 x float> [[A]]) #[[ATTR4]]
+// CHECK-NEXT: ret <4 x float> [[ELT_COSH]]
+//
+float4 strict_elementwise_cosh(float4 a) {
+ return __builtin_elementwise_cosh(a);
+}
+
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_expDv4_f
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: entry:
@@ -167,6 +187,16 @@ float4 strict_elementwise_nearbyint(float4 a) {
return __builtin_elementwise_nearbyint(a);
}
+// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_asinDv4_f
+// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[ELT_ASIN:%.*]] = tail call <4 x float> @llvm.asin.v4f32(<4 x float> [[A]]) #[[ATTR4]]
+// CHECK-NEXT: ret <4 x float> [[ELT_ASIN]]
+//
+float4 strict_elementwise_asin(float4 a) {
+ return __builtin_elementwise_asin(a);
+}
+
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_sinDv4_f
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: entry:
@@ -177,6 +207,16 @@ float4 strict_elementwise_sin(float4 a) {
return __builtin_elementwise_sin(a);
}
+// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_sinhDv4_f
+// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[ELT_SINH:%.*]] = tail call <4 x float> @llvm.sinh.v4f32(<4 x float> [[A]]) #[[ATTR4]]
+// CHECK-NEXT: ret <4 x float> [[ELT_SINH]]
+//
+float4 strict_elementwise_sinh(float4 a) {
+ return __builtin_elementwise_sinh(a);
+}
+
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_sqrtDv4_f
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR0]] {
// CHECK-NEXT: entry:
@@ -187,6 +227,16 @@ float4 strict_elementwise_sqrt(float4 a) {
return __builtin_elementwise_sqrt(a);
}
+// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_atanDv4_f
+// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[ELT_ATAN:%.*]] = tail call <4 x float> @llvm.atan.v4f32(<4 x float> [[A]]) #[[ATTR4]]
+// CHECK-NEXT: ret <4 x float> [[ELT_ATAN]]
+//
+float4 strict_elementwise_atan(float4 a) {
+ return __builtin_elementwise_atan(a);
+}
+
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z22strict_elementwise_tanDv4_f
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: entry:
@@ -197,6 +247,16 @@ float4 strict_elementwise_tan(float4 a) {
return __builtin_elementwise_tan(a);
}
+// CHECK-LABEL: define dso_local noundef <4 x float> @_Z23strict_elementwise_tanhDv4_f
+// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[ELT_TANH:%.*]] = tail call <4 x float> @llvm.tanh.v4f32(<4 x float> [[A]]) #[[ATTR4]]
+// CHECK-NEXT: ret <4 x float> [[ELT_TANH]]
+//
+float4 strict_elementwise_tanh(float4 a) {
+ return __builtin_elementwise_tanh(a);
+}
+
// CHECK-LABEL: define dso_local noundef <4 x float> @_Z24strict_elementwise_truncDv4_f
// CHECK-SAME: (<4 x float> noundef [[A:%.*]]) local_unnamed_addr #[[ATTR2]] {
// CHECK-NEXT: entry:
diff --git a/clang/test/CodeGenHLSL/builtins/acos.hlsl b/clang/test/CodeGenHLSL/builtins/acos.hlsl
new file mode 100644
index 0000000..78a05ca
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/acos.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_acos_half
+// NATIVE_HALF: call half @llvm.acos.f16
+// NO_HALF: call float @llvm.acos.f32
+half test_acos_half ( half p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_half2
+// NATIVE_HALF: call <2 x half> @llvm.acos.v2f16
+// NO_HALF: call <2 x float> @llvm.acos.v2f32
+half2 test_acos_half2 ( half2 p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_half3
+// NATIVE_HALF: call <3 x half> @llvm.acos.v3f16
+// NO_HALF: call <3 x float> @llvm.acos.v3f32
+half3 test_acos_half3 ( half3 p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_half4
+// NATIVE_HALF: call <4 x half> @llvm.acos.v4f16
+// NO_HALF: call <4 x float> @llvm.acos.v4f32
+half4 test_acos_half4 ( half4 p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_float
+// CHECK: call float @llvm.acos.f32
+float test_acos_float ( float p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_float2
+// CHECK: call <2 x float> @llvm.acos.v2f32
+float2 test_acos_float2 ( float2 p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_float3
+// CHECK: call <3 x float> @llvm.acos.v3f32
+float3 test_acos_float3 ( float3 p0 ) {
+ return acos ( p0 );
+}
+
+// CHECK-LABEL: test_acos_float4
+// CHECK: call <4 x float> @llvm.acos.v4f32
+float4 test_acos_float4 ( float4 p0 ) {
+ return acos ( p0 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/asin.hlsl b/clang/test/CodeGenHLSL/builtins/asin.hlsl
new file mode 100644
index 0000000..1d0b457
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/asin.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_asin_half
+// NATIVE_HALF: call half @llvm.asin.f16
+// NO_HALF: call float @llvm.asin.f32
+half test_asin_half ( half p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_half2
+// NATIVE_HALF: call <2 x half> @llvm.asin.v2f16
+// NO_HALF: call <2 x float> @llvm.asin.v2f32
+half2 test_asin_half2 ( half2 p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_half3
+// NATIVE_HALF: call <3 x half> @llvm.asin.v3f16
+// NO_HALF: call <3 x float> @llvm.asin.v3f32
+half3 test_asin_half3 ( half3 p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_half4
+// NATIVE_HALF: call <4 x half> @llvm.asin.v4f16
+// NO_HALF: call <4 x float> @llvm.asin.v4f32
+half4 test_asin_half4 ( half4 p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_float
+// CHECK: call float @llvm.asin.f32
+float test_asin_float ( float p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_float2
+// CHECK: call <2 x float> @llvm.asin.v2f32
+float2 test_asin_float2 ( float2 p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_float3
+// CHECK: call <3 x float> @llvm.asin.v3f32
+float3 test_asin_float3 ( float3 p0 ) {
+ return asin ( p0 );
+}
+
+// CHECK-LABEL: test_asin_float4
+// CHECK: call <4 x float> @llvm.asin.v4f32
+float4 test_asin_float4 ( float4 p0 ) {
+ return asin ( p0 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/atan.hlsl b/clang/test/CodeGenHLSL/builtins/atan.hlsl
new file mode 100644
index 0000000..faee122
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/atan.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_atan_half
+// NATIVE_HALF: call half @llvm.atan.f16
+// NO_HALF: call float @llvm.atan.f32
+half test_atan_half ( half p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_half2
+// NATIVE_HALF: call <2 x half> @llvm.atan.v2f16
+// NO_HALF: call <2 x float> @llvm.atan.v2f32
+half2 test_atan_half2 ( half2 p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_half3
+// NATIVE_HALF: call <3 x half> @llvm.atan.v3f16
+// NO_HALF: call <3 x float> @llvm.atan.v3f32
+half3 test_atan_half3 ( half3 p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_half4
+// NATIVE_HALF: call <4 x half> @llvm.atan.v4f16
+// NO_HALF: call <4 x float> @llvm.atan.v4f32
+half4 test_atan_half4 ( half4 p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_float
+// CHECK: call float @llvm.atan.f32
+float test_atan_float ( float p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_float2
+// CHECK: call <2 x float> @llvm.atan.v2f32
+float2 test_atan_float2 ( float2 p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_float3
+// CHECK: call <3 x float> @llvm.atan.v3f32
+float3 test_atan_float3 ( float3 p0 ) {
+ return atan ( p0 );
+}
+
+// CHECK-LABEL: test_atan_float4
+// CHECK: call <4 x float> @llvm.atan.v4f32
+float4 test_atan_float4 ( float4 p0 ) {
+ return atan ( p0 );
+}
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 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/sinh.hlsl b/clang/test/CodeGenHLSL/builtins/sinh.hlsl
new file mode 100644
index 0000000..167f6f2
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/sinh.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_sinh_half
+// NATIVE_HALF: call half @llvm.sinh.f16
+// NO_HALF: call float @llvm.sinh.f32
+half test_sinh_half ( half p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_half2
+// NATIVE_HALF: call <2 x half> @llvm.sinh.v2f16
+// NO_HALF: call <2 x float> @llvm.sinh.v2f32
+half2 test_sinh_half2 ( half2 p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_half3
+// NATIVE_HALF: call <3 x half> @llvm.sinh.v3f16
+// NO_HALF: call <3 x float> @llvm.sinh.v3f32
+half3 test_sinh_half3 ( half3 p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_half4
+// NATIVE_HALF: call <4 x half> @llvm.sinh.v4f16
+// NO_HALF: call <4 x float> @llvm.sinh.v4f32
+half4 test_sinh_half4 ( half4 p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_float
+// CHECK: call float @llvm.sinh.f32
+float test_sinh_float ( float p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_float2
+// CHECK: call <2 x float> @llvm.sinh.v2f32
+float2 test_sinh_float2 ( float2 p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_float3
+// CHECK: call <3 x float> @llvm.sinh.v3f32
+float3 test_sinh_float3 ( float3 p0 ) {
+ return sinh ( p0 );
+}
+
+// CHECK-LABEL: test_sinh_float4
+// CHECK: call <4 x float> @llvm.sinh.v4f32
+float4 test_sinh_float4 ( float4 p0 ) {
+ return sinh ( p0 );
+}
diff --git a/clang/test/CodeGenHLSL/builtins/tanh.hlsl b/clang/test/CodeGenHLSL/builtins/tanh.hlsl
new file mode 100644
index 0000000..6d09c8b
--- /dev/null
+++ b/clang/test/CodeGenHLSL/builtins/tanh.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_tanh_half
+// NATIVE_HALF: call half @llvm.tanh.f16
+// NO_HALF: call float @llvm.tanh.f32
+half test_tanh_half ( half p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_half2
+// NATIVE_HALF: call <2 x half> @llvm.tanh.v2f16
+// NO_HALF: call <2 x float> @llvm.tanh.v2f32
+half2 test_tanh_half2 ( half2 p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_half3
+// NATIVE_HALF: call <3 x half> @llvm.tanh.v3f16
+// NO_HALF: call <3 x float> @llvm.tanh.v3f32
+half3 test_tanh_half3 ( half3 p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_half4
+// NATIVE_HALF: call <4 x half> @llvm.tanh.v4f16
+// NO_HALF: call <4 x float> @llvm.tanh.v4f32
+half4 test_tanh_half4 ( half4 p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_float
+// CHECK: call float @llvm.tanh.f32
+float test_tanh_float ( float p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_float2
+// CHECK: call <2 x float> @llvm.tanh.v2f32
+float2 test_tanh_float2 ( float2 p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_float3
+// CHECK: call <3 x float> @llvm.tanh.v3f32
+float3 test_tanh_float3 ( float3 p0 ) {
+ return tanh ( p0 );
+}
+
+// CHECK-LABEL: test_tanh_float4
+// CHECK: call <4 x float> @llvm.tanh.v4f32
+float4 test_tanh_float4 ( float4 p0 ) {
+ return tanh ( p0 );
+}
diff --git a/clang/test/Sema/aarch64-sve-vector-trig-ops.c b/clang/test/Sema/aarch64-sve-vector-trig-ops.c
index 6863f32..dfa77d2 100644
--- a/clang/test/Sema/aarch64-sve-vector-trig-ops.c
+++ b/clang/test/Sema/aarch64-sve-vector-trig-ops.c
@@ -4,6 +4,23 @@
#include <arm_sve.h>
+svfloat32_t test_asin_vv_i8mf8(svfloat32_t v) {
+
+ return __builtin_elementwise_asin(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+}
+
+svfloat32_t test_acos_vv_i8mf8(svfloat32_t v) {
+
+ return __builtin_elementwise_acos(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+}
+
+svfloat32_t test_atan_vv_i8mf8(svfloat32_t v) {
+
+ return __builtin_elementwise_atan(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+}
svfloat32_t test_sin_vv_i8mf8(svfloat32_t v) {
@@ -22,3 +39,21 @@ svfloat32_t test_tan_vv_i8mf8(svfloat32_t v) {
return __builtin_elementwise_tan(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
+
+svfloat32_t test_sinh_vv_i8mf8(svfloat32_t v) {
+
+ return __builtin_elementwise_sinh(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+}
+
+svfloat32_t test_cosh_vv_i8mf8(svfloat32_t v) {
+
+ return __builtin_elementwise_cosh(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+}
+
+svfloat32_t test_tanh_vv_i8mf8(svfloat32_t v) {
+
+ return __builtin_elementwise_tanh(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+}
diff --git a/clang/test/Sema/builtins-elementwise-math.c b/clang/test/Sema/builtins-elementwise-math.c
index 2e4319d..2673f1f 100644
--- a/clang/test/Sema/builtins-elementwise-math.c
+++ b/clang/test/Sema/builtins-elementwise-math.c
@@ -315,6 +315,27 @@ void test_builtin_elementwise_ceil(int i, float f, double d, float4 v, int3 iv,
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}
+void test_builtin_elementwise_acos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_acos(f);
+ // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
+
+ i = __builtin_elementwise_acos();
+ // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_acos(i);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
+
+ i = __builtin_elementwise_acos(f, f);
+ // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_acos(u);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
+
+ uv = __builtin_elementwise_acos(uv);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
+}
+
void test_builtin_elementwise_cos(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
struct Foo s = __builtin_elementwise_cos(f);
@@ -336,6 +357,27 @@ void test_builtin_elementwise_cos(int i, float f, double d, float4 v, int3 iv, u
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}
+void test_builtin_elementwise_cosh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_cosh(f);
+ // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
+
+ i = __builtin_elementwise_cosh();
+ // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_cosh(i);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
+
+ i = __builtin_elementwise_cosh(f, f);
+ // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_cosh(u);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
+
+ uv = __builtin_elementwise_cosh(uv);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
+}
+
void test_builtin_elementwise_exp(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
struct Foo s = __builtin_elementwise_exp(f);
@@ -584,6 +626,27 @@ void test_builtin_elementwise_nearbyint(int i, float f, double d, float4 v, int3
// expected-error@-1 {{1st argument must be a vector, integer or floating point type (was '_Complex float')}}
}
+void test_builtin_elementwise_asin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_asin(f);
+ // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
+
+ i = __builtin_elementwise_asin();
+ // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_asin(i);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
+
+ i = __builtin_elementwise_asin(f, f);
+ // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_asin(u);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
+
+ uv = __builtin_elementwise_asin(uv);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
+}
+
void test_builtin_elementwise_sin(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
struct Foo s = __builtin_elementwise_sin(f);
@@ -605,6 +668,27 @@ void test_builtin_elementwise_sin(int i, float f, double d, float4 v, int3 iv, u
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}
+void test_builtin_elementwise_sinh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_sinh(f);
+ // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
+
+ i = __builtin_elementwise_sinh();
+ // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_sinh(i);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
+
+ i = __builtin_elementwise_sinh(f, f);
+ // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_sinh(u);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
+
+ uv = __builtin_elementwise_sinh(uv);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
+}
+
void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
struct Foo s = __builtin_elementwise_sqrt(f);
@@ -626,6 +710,27 @@ void test_builtin_elementwise_sqrt(int i, float f, double d, float4 v, int3 iv,
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}
+void test_builtin_elementwise_atan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_atan(f);
+ // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
+
+ i = __builtin_elementwise_atan();
+ // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_atan(i);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
+
+ i = __builtin_elementwise_atan(f, f);
+ // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_atan(u);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
+
+ uv = __builtin_elementwise_atan(uv);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
+}
+
void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
struct Foo s = __builtin_elementwise_tan(f);
@@ -647,6 +752,27 @@ void test_builtin_elementwise_tan(int i, float f, double d, float4 v, int3 iv, u
// expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
}
+void test_builtin_elementwise_tanh(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
+
+ struct Foo s = __builtin_elementwise_tanh(f);
+ // expected-error@-1 {{initializing 'struct Foo' with an expression of incompatible type 'float'}}
+
+ i = __builtin_elementwise_tanh();
+ // expected-error@-1 {{too few arguments to function call, expected 1, have 0}}
+
+ i = __builtin_elementwise_tanh(i);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'int')}}
+
+ i = __builtin_elementwise_tanh(f, f);
+ // expected-error@-1 {{too many arguments to function call, expected 1, have 2}}
+
+ u = __builtin_elementwise_tanh(u);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned int')}}
+
+ uv = __builtin_elementwise_tanh(uv);
+ // expected-error@-1 {{1st argument must be a floating point type (was 'unsigned4' (vector of 4 'unsigned int' values))}}
+}
+
void test_builtin_elementwise_trunc(int i, float f, double d, float4 v, int3 iv, unsigned u, unsigned4 uv) {
struct Foo s = __builtin_elementwise_trunc(f);
diff --git a/clang/test/Sema/riscv-rvv-vector-trig-ops.c b/clang/test/Sema/riscv-rvv-vector-trig-ops.c
index 459582f..f0cd5ca 100644
--- a/clang/test/Sema/riscv-rvv-vector-trig-ops.c
+++ b/clang/test/Sema/riscv-rvv-vector-trig-ops.c
@@ -5,6 +5,23 @@
#include <riscv_vector.h>
+vfloat32mf2_t test_asin_vv_i8mf8(vfloat32mf2_t v) {
+
+ return __builtin_elementwise_asin(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+ }
+
+ vfloat32mf2_t test_acos_vv_i8mf8(vfloat32mf2_t v) {
+
+ return __builtin_elementwise_acos(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+ }
+
+ vfloat32mf2_t test_atan_vv_i8mf8(vfloat32mf2_t v) {
+
+ return __builtin_elementwise_atan(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+ }
vfloat32mf2_t test_sin_vv_i8mf8(vfloat32mf2_t v) {
@@ -23,3 +40,22 @@ vfloat32mf2_t test_tan_vv_i8mf8(vfloat32mf2_t v) {
return __builtin_elementwise_tan(v);
// expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
}
+
+vfloat32mf2_t test_sinh_vv_i8mf8(vfloat32mf2_t v) {
+
+ return __builtin_elementwise_sinh(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+ }
+
+ vfloat32mf2_t test_cosh_vv_i8mf8(vfloat32mf2_t v) {
+
+ return __builtin_elementwise_cosh(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+ }
+
+ vfloat32mf2_t test_tanh_vv_i8mf8(vfloat32mf2_t v) {
+
+ return __builtin_elementwise_tanh(v);
+ // expected-error@-1 {{1st argument must be a vector, integer or floating point type}}
+ }
+ \ No newline at end of file
diff --git a/clang/test/SemaCXX/builtins-elementwise-math.cpp b/clang/test/SemaCXX/builtins-elementwise-math.cpp
index 499f279..898d869 100644
--- a/clang/test/SemaCXX/builtins-elementwise-math.cpp
+++ b/clang/test/SemaCXX/builtins-elementwise-math.cpp
@@ -83,6 +83,13 @@ void test_builtin_elementwise_ceil() {
static_assert(!is_const<decltype(__builtin_elementwise_ceil(b))>::value);
}
+void test_builtin_elementwise_acos() {
+ const float a = 42.0;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_acos(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_acos(b))>::value);
+}
+
void test_builtin_elementwise_cos() {
const float a = 42.0;
float b = 42.3;
@@ -90,6 +97,13 @@ void test_builtin_elementwise_cos() {
static_assert(!is_const<decltype(__builtin_elementwise_cos(b))>::value);
}
+void test_builtin_elementwise_cosh() {
+ const float a = 42.0;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_cosh(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_cosh(b))>::value);
+}
+
void test_builtin_elementwise_exp() {
const float a = 42.0;
float b = 42.3;
@@ -104,6 +118,13 @@ void test_builtin_elementwise_exp2() {
static_assert(!is_const<decltype(__builtin_elementwise_exp2(b))>::value);
}
+void test_builtin_elementwise_asin() {
+ const float a = 42.0;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_asin(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_asin(b))>::value);
+}
+
void test_builtin_elementwise_sin() {
const float a = 42.0;
float b = 42.3;
@@ -111,6 +132,20 @@ void test_builtin_elementwise_sin() {
static_assert(!is_const<decltype(__builtin_elementwise_sin(b))>::value);
}
+void test_builtin_elementwise_sinh() {
+ const float a = 42.0;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_sinh(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_sinh(b))>::value);
+}
+
+void test_builtin_elementwise_atan() {
+ const float a = 42.0;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_atan(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_atan(b))>::value);
+}
+
void test_builtin_elementwise_tan() {
const float a = 42.0;
float b = 42.3;
@@ -118,6 +153,13 @@ void test_builtin_elementwise_tan() {
static_assert(!is_const<decltype(__builtin_elementwise_tan(b))>::value);
}
+void test_builtin_elementwise_tanh() {
+ const float a = 42.0;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_tanh(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_tanh(b))>::value);
+}
+
void test_builtin_elementwise_sqrt() {
const float a = 42.0;
float b = 42.3;
diff --git a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
index 4089188..1841f605 100644
--- a/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
+++ b/clang/test/SemaHLSL/BuiltIns/half-float-only-errors.hlsl
@@ -1,5 +1,9 @@
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_acos
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_asin
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_atan
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_ceil
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_cos
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_cosh
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_exp
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_exp2
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_floor
@@ -7,9 +11,11 @@
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_log2
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_log10
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_sin
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_sinh
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_sqrt
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_roundeven
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tan
+// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_tanh
// RUN: %clang_cc1 -finclude-default-header -triple dxil-pc-shadermodel6.6-library %s -fnative-half-type -emit-llvm-only -disable-llvm-passes -verify -DTEST_FUNC=__builtin_elementwise_trunc
double2 test_double_builtin(double2 p0) {