[clang] e248955 - clang: Add missing cases to elementwise builtin SemaCXX test
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 23 16:52:13 PDT 2023
Author: Matt Arsenault
Date: 2023-06-23T19:52:06-04:00
New Revision: e248955aeda50bd7e0910eabdabdf7bd617e649f
URL: https://github.com/llvm/llvm-project/commit/e248955aeda50bd7e0910eabdabdf7bd617e649f
DIFF: https://github.com/llvm/llvm-project/commit/e248955aeda50bd7e0910eabdabdf7bd617e649f.diff
LOG: clang: Add missing cases to elementwise builtin SemaCXX test
Added:
Modified:
clang/test/SemaCXX/builtins-elementwise-math.cpp
Removed:
################################################################################
diff --git a/clang/test/SemaCXX/builtins-elementwise-math.cpp b/clang/test/SemaCXX/builtins-elementwise-math.cpp
index 4895c111584ce..9a0e622f7bf97 100644
--- a/clang/test/SemaCXX/builtins-elementwise-math.cpp
+++ b/clang/test/SemaCXX/builtins-elementwise-math.cpp
@@ -21,6 +21,13 @@ void test_builtin_elementwise_abs() {
static_assert(!is_const<decltype(__builtin_elementwise_abs(b))>::value);
}
+void test_builtin_elementwise_abs_fp() {
+ const float a = -2.0f;
+ float b = 1.0f;
+ static_assert(!is_const<decltype(__builtin_elementwise_abs(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_abs(b))>::value);
+}
+
void test_builtin_elementwise_add_sat() {
const int a = 2;
int b = 1;
@@ -53,6 +60,22 @@ void test_builtin_elementwise_min() {
static_assert(!is_const<decltype(__builtin_elementwise_min(a, a))>::value);
}
+void test_builtin_elementwise_max_fp() {
+ const float a = 2.0f;
+ float b = 1.0f;
+ static_assert(!is_const<decltype(__builtin_elementwise_max(a, b))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_max(b, a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_max(a, a))>::value);
+}
+
+void test_builtin_elementwise_min_fp() {
+ const float a = 2.0f;
+ float b = 1.0f;
+ static_assert(!is_const<decltype(__builtin_elementwise_min(a, b))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_min(b, a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_min(a, a))>::value);
+}
+
void test_builtin_elementwise_ceil() {
const float a = 42.0;
float b = 42.3;
@@ -122,3 +145,56 @@ void test_builtin_elementwise_nearbyint() {
static_assert(!is_const<decltype(__builtin_elementwise_nearbyint(a))>::value);
static_assert(!is_const<decltype(__builtin_elementwise_nearbyint(b))>::value);
}
+
+void test_builtin_elementwise_round() {
+ const float a = 42.5;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_round(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_round(b))>::value);
+}
+
+void test_builtin_elementwise_roundeven() {
+ const float a = 42.5;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_roundeven(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_roundeven(b))>::value);
+}
+
+void test_builtin_elementwise_trunc() {
+ const float a = 42.5;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_trunc(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_trunc(b))>::value);
+}
+
+void test_builtin_elementwise_floor() {
+ const float a = 42.5;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_floor(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_floor(b))>::value);
+}
+
+void test_builtin_elementwise_canonicalize() {
+ const float a = 42.5;
+ float b = 42.3;
+ static_assert(!is_const<decltype(__builtin_elementwise_canonicalize(a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_canonicalize(b))>::value);
+}
+
+void test_builtin_elementwise_copysign() {
+ const float a = 2.0f;
+ float b = -4.0f;
+ static_assert(!is_const<decltype(__builtin_elementwise_copysign(a, b))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_copysign(b, a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_copysign(a, a))>::value);
+}
+
+void test_builtin_elementwise_fma() {
+ const float a = 2.0f;
+ float b = -4.0f;
+ float c = 1.0f;
+ static_assert(!is_const<decltype(__builtin_elementwise_fma(a, a, a))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_fma(a, b, c))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_fma(b, a, c))>::value);
+ static_assert(!is_const<decltype(__builtin_elementwise_fma(c, c, c))>::value);
+}
More information about the cfe-commits
mailing list