[libcxx-commits] [libcxx] [libc++] <experimental/simd> Reduce types for template parameter U in tests (PR #83781)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Mar 4 00:11:16 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: ZhangYin (joy2myself)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/83781.diff


6 Files Affected:

- (modified) libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp (+1-1) 
- (modified) libcxx/test/std/experimental/simd/simd.class/simd_ctor_conversion.pass.cpp (+2-2) 
- (modified) libcxx/test/std/experimental/simd/simd.class/simd_ctor_load.pass.cpp (+3-3) 
- (modified) libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_ctor_conversion.pass.cpp (+2-2) 
- (modified) libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp (+3-3) 
- (modified) libcxx/test/std/experimental/simd/test_utils.h (+10) 


``````````diff
diff --git a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp
index 679cb1aa167c57..79bd657cef9756 100644
--- a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_broadcast.pass.cpp
@@ -110,7 +110,7 @@ template <class T, std::size_t>
 struct CheckBroadcastCtorTraits {
   template <class SimdAbi>
   void operator()() {
-    types::for_each(arithmetic_no_bool_types(), CheckBroadcastCtorTraitsHelper<T, SimdAbi>());
+    types::for_each(types_for_template_parameter(), CheckBroadcastCtorTraitsHelper<T, SimdAbi>());
 
     static_assert(!has_broadcast_ctor<no_implicit_type<T>, T, SimdAbi>::value);
     static_assert(has_broadcast_ctor<implicit_type<T>, T, SimdAbi>::value);
diff --git a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_conversion.pass.cpp b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_conversion.pass.cpp
index 5920d62e0e5a61..041592f50c8b44 100644
--- a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_conversion.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_conversion.pass.cpp
@@ -50,7 +50,7 @@ struct CheckConversionSimdCtor {
     for (size_t i = 0; i < array_size; ++i)
       expected_value[i] = static_cast<T>(i);
 
-    types::for_each(arithmetic_no_bool_types(), ConversionHelper<T, SimdAbi, array_size>(expected_value));
+    types::for_each(types_for_template_parameter(), ConversionHelper<T, SimdAbi, array_size>(expected_value));
   }
 };
 
@@ -74,7 +74,7 @@ struct CheckConversionSimdCtorTraits {
   void operator()() {
     constexpr std::size_t array_size = ex::simd_size_v<T, SimdAbi>;
 
-    types::for_each(arithmetic_no_bool_types(), CheckConversionSimdCtorTraitsHelper<T, SimdAbi, array_size>());
+    types::for_each(types_for_template_parameter(), CheckConversionSimdCtorTraitsHelper<T, SimdAbi, array_size>());
   }
 };
 
diff --git a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_load.pass.cpp b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_load.pass.cpp
index 3992f3e450cb2a..feee69daee9c29 100644
--- a/libcxx/test/std/experimental/simd/simd.class/simd_ctor_load.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.class/simd_ctor_load.pass.cpp
@@ -59,9 +59,9 @@ struct CheckSimdLoadCtor {
   void operator()() {
     constexpr std::size_t array_size = ex::simd_size_v<T, SimdAbi>;
 
-    types::for_each(arithmetic_no_bool_types(), ElementAlignedLoadCtorHelper<T, SimdAbi, array_size>());
-    types::for_each(arithmetic_no_bool_types(), VectorAlignedLoadCtorHelper<T, SimdAbi, array_size>());
-    types::for_each(arithmetic_no_bool_types(), OveralignedLoadCtorHelper<T, SimdAbi, array_size>());
+    types::for_each(types_for_template_parameter(), ElementAlignedLoadCtorHelper<T, SimdAbi, array_size>());
+    types::for_each(types_for_template_parameter(), VectorAlignedLoadCtorHelper<T, SimdAbi, array_size>());
+    types::for_each(types_for_template_parameter(), OveralignedLoadCtorHelper<T, SimdAbi, array_size>());
   }
 };
 
diff --git a/libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_ctor_conversion.pass.cpp b/libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_ctor_conversion.pass.cpp
index dc0764f937fc04..82f1fcb142f24b 100644
--- a/libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_ctor_conversion.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.mask.class/simd_mask_ctor_conversion.pass.cpp
@@ -42,7 +42,7 @@ struct CheckConversionMaskCtor {
     constexpr std::size_t array_size = ex::simd_size_v<T, SimdAbi>;
     std::array<bool, array_size> expected_value{};
 
-    types::for_each(arithmetic_no_bool_types(), ConversionHelper<T, SimdAbi, array_size>(expected_value));
+    types::for_each(types_for_template_parameter(), ConversionHelper<T, SimdAbi, array_size>(expected_value));
   }
 };
 
@@ -65,7 +65,7 @@ struct CheckConversionMaskCtorTraits {
   void operator()() {
     constexpr std::size_t array_size = ex::simd_size_v<T, SimdAbi>;
 
-    types::for_each(arithmetic_no_bool_types(), CheckConversionMaskCtorTraitsHelper<T, SimdAbi, array_size>());
+    types::for_each(types_for_template_parameter(), CheckConversionMaskCtorTraitsHelper<T, SimdAbi, array_size>());
   }
 };
 
diff --git a/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp b/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
index cfef55a868ba01..7bc9c6886204ac 100644
--- a/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
+++ b/libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp
@@ -72,10 +72,10 @@ template <class T, std::size_t>
 struct CheckReferenceAssignment {
   template <class SimdAbi>
   void operator()() {
-    types::for_each(arithmetic_no_bool_types(), CheckSimdReferenceAssignmentHelper<T, SimdAbi>());
-    types::for_each(arithmetic_no_bool_types(), CheckMaskReferenceAssignmentHelper<T, SimdAbi>());
+    types::for_each(types_for_template_parameter(), CheckSimdReferenceAssignmentHelper<T, SimdAbi>());
+    types::for_each(types_for_template_parameter(), CheckMaskReferenceAssignmentHelper<T, SimdAbi>());
 
-    types::for_each(arithmetic_no_bool_types(), CheckReferenceAssignmentTraitsHelper<T, SimdAbi>());
+    types::for_each(types_for_template_parameter(), CheckReferenceAssignmentTraitsHelper<T, SimdAbi>());
   }
 };
 
diff --git a/libcxx/test/std/experimental/simd/test_utils.h b/libcxx/test/std/experimental/simd/test_utils.h
index b3679b51e50b50..039ee073099503 100644
--- a/libcxx/test/std/experimental/simd/test_utils.h
+++ b/libcxx/test/std/experimental/simd/test_utils.h
@@ -48,6 +48,16 @@ using arithmetic_no_bool_types = types::concatenate_t<types::integer_types, type
 using arithmetic_no_bool_types = types::concatenate_t<types::integer_types, types::floating_point_types>;
 #endif
 
+using types_for_template_parameter =
+    types::type_list<char,
+                     unsigned,
+                     int,
+#ifndef TEST_HAS_NO_INT128
+                     __int128_t,
+#endif
+                     float,
+                     double>;
+
 template <template <class T, std::size_t N> class Func>
 void test_all_simd_abi() {
   types::for_each(arithmetic_no_bool_types(), TestAllSimdAbiFunctor<Func>());

``````````

</details>


https://github.com/llvm/llvm-project/pull/83781


More information about the libcxx-commits mailing list