• Pierrick Bouvier's avatar
    [msvc] fix build with neon intrinsics · 1b3a4f0c
    Pierrick Bouvier authored
    This compilation error was found by NodeJS when updating V8:
    https://github.com/nodejs/node-v8/issues/240
    
    MSVC reports an error with "too many initializer" for type uint32x4_t.
    
    ---
    
    Under gcc/clang, this is a typedef to a builtin type.
    
    For MSVC, it is a typedef to this union:
    typedef union __n128
    {
         unsigned __int64   n128_u64[2];
         unsigned __int32   n128_u32[4];
         ...
    } __n128;
    
    C++ mandates that only first member of union can be initialized at
    declaration. Thus, it can only be initialized with {uint64_t, uint64_t}.
    
    VS people proposed to use designated initializer instead:
    var = {.n128_u32={1, 2, 3, 8}}
    https://developercommunity.visualstudio.com/t/error-c2078-too-many-initializers-when-using-arm-n/402911
    But, you need to use /std:c++20 for this, which is not the case in v8.
    
    ---
    
    Thus, the only solution is to implement a hack specifically for MSVC,
    where you build two uint64, from four uint32.
    
    ---------------------------------------
    
    Once solved, another error is reported:
    templated function extract_first_nonzero_index is specialized twice.
    
    This is because, with MSVC, uint32x4_t and uint64x2_t are typedef to the
    same __n128 union. The fix is to drop templates, and use explicit
    function names instead.
    
    Bug: v8:13312
    Change-Id: I231d8cf01c05af01af319d56d5666c415f8b989b
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3913035Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
    Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
    Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#83404}
    1b3a4f0c
Name
Last commit
Last update
.github Loading commit data...
bazel Loading commit data...
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.bazelrc Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.mailmap Loading commit data...
.style.yapf Loading commit data...
.vpython3 Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.bazel Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
DIR_METADATA Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LOONG_OWNERS Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
RISCV_OWNERS Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
WORKSPACE Loading commit data...
codereview.settings Loading commit data...