[libcxx-commits] [libcxx] [libc++] <experimental/simd> Reduce compilation time of reference assignment test (PR #72632)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Nov 17 01:56:10 PST 2023


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/72632.diff


1 Files Affected:

- (modified) libcxx/test/std/experimental/simd/simd.reference/reference_assignment.pass.cpp (+6-10) 


``````````diff
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 bf84cc4b04e3d84..3ce632891340fdd 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
@@ -29,11 +29,9 @@ struct CheckSimdReferenceAssignmentHelper {
   void operator()() const {
     if constexpr (std::is_assignable_v<T&, U&&>) {
       ex::simd<T, SimdAbi> origin_simd([](T i) { return i; });
-      for (size_t i = 0; i < origin_simd.size(); ++i) {
-        static_assert(noexcept(origin_simd[i] = static_cast<U>(i + 1)));
-        origin_simd[i] = static_cast<U>(i + 1);
-        assert(origin_simd[i] == static_cast<T>(std::forward<U>(i + 1)));
-      }
+      static_assert(noexcept(origin_simd[0] = static_cast<U>(5)));
+      origin_simd[0] = static_cast<U>(5);
+      assert(origin_simd[0] == static_cast<T>(std::forward<U>(5)));
     }
   }
 };
@@ -44,11 +42,9 @@ struct CheckMaskReferenceAssignmentHelper {
   void operator()() const {
     if constexpr (std::is_assignable_v<bool&, U&&>) {
       ex::simd_mask<T, SimdAbi> origin_mask(true);
-      for (size_t i = 0; i < origin_mask.size(); ++i) {
-        static_assert(noexcept(origin_mask[i] = static_cast<U>(i + 1)));
-        origin_mask[i] = static_cast<U>(i % 2);
-        assert(origin_mask[i] == static_cast<T>(std::forward<U>(i % 2)));
-      }
+      static_assert(noexcept(origin_mask[0] = false));
+      origin_mask[0] = false;
+      assert(origin_mask[0] == false);
     }
   }
 };

``````````

</details>


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


More information about the libcxx-commits mailing list