Skip to content

Conversation

joy2myself
Copy link
Member

No description provided.

@joy2myself joy2myself requested a review from a team as a code owner November 17, 2023 09:55
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 17, 2023
@llvmbot
Copy link
Member

llvmbot commented Nov 17, 2023

@llvm/pr-subscribers-libcxx

Author: ZhangYin (joy2myself)

Changes

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 --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);
     }
   }
 };

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)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this actually reduces the compilation time since there's no additional instantiations being performed here. This is just code running at runtime, and the runtime of the test is not the issue. Did I miss something?

@ldionne
Copy link
Member

ldionne commented Dec 13, 2023

I'm going to close this since I don't think this achieves the desired results and I'd like to clean up the PR queue a bit.

@ldionne ldionne closed this Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants