[llvm-branch-commits] [libc] [libc][wctype] Upstream immintrin storage from PtrHash-cc prototype to LLVM libc (PR #175038)

Schrodinger ZHU Yifan via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Jan 13 16:51:11 PST 2026


================
@@ -0,0 +1,76 @@
+//===-- 128-bit storage for StdRng - wctype conversion ----------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+// This is a portable implementation of a 128-bit vector storage implemented
+// with static arrays, parallel of <immintrin.h>'s `__m128i` which works with
+// `constexpr` code.
+// Only little-endian is supported (runtime code is not affected by this).
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_WCTYPE_CONVERSION_RANDOM_VEC128_STORAGE_H
+#define LLVM_LIBC_SRC___SUPPORT_WCTYPE_CONVERSION_RANDOM_VEC128_STORAGE_H
+
+#include "src/__support/CPP/array.h"
+#include "src/__support/wctype/conversion/utils/slice.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+namespace wctype_internal {
+
+namespace random {
+
+namespace vector_storage {
+
+union vec128_storage {
----------------
SchrodingerZhu wrote:

why union is preferred here? You want to make the type to have trivial init pattern?

It seems to be that extended vector types can be used instead of handcrafting this. The only exception is the `read_le` part.

Do you intend to make it this way so that the code can be natually used on MSVC and other targets?

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


More information about the llvm-branch-commits mailing list