Skip to content

Use SSE2 on x86-64 without checking at runtime - #1116

Merged
byroot merged 2 commits into
masterfrom
claude/forward-port-ruby-commit-d82835
Oct 15, 2026
Merged

byroot merged 2 commits into
masterfrom
claude/forward-port-ruby-commit-d82835

Conversation

@hsbt

@hsbt hsbt commented Oct 15, 2026

Copy link
Copy Markdown
Member

With clang-cl on mswin, generator.so and parser.so failed to link with an undefined __cpu_model. __builtin_cpu_supports refers to it in compiler-rt, which clang-cl does not link. SSE2 is part of the x86-64 baseline, so this uses it without checking, as is already done for NEON on AArch64.

Linux and macOS resolve __cpu_model from libgcc or compiler-rt, and the check always returned SIMD_SSE2 on x86-64, so nothing changes there. The first commit is a forward-port of ruby/ruby@2f88a23ad0.

The second commit removes the __builtin_cpu_supports probe in conf.rb and the cpuid.h check and include, which only existed for that check. The probe was added for #827 and now only keeps SIMD off on GCC older than 4.8, so those compilers get SIMD with this change. The HAVE_CPUID_H guard also made builds fail where x86intrin.h exists without cpuid.h.

Generated with Claude Code

hsbt and others added 2 commits October 15, 2026 13:43
__builtin_cpu_supports refers to __cpu_model in compiler-rt, which clang-cl does not link, so generator.so and parser.so failed with an undefined symbol. SSE2 is part of the x86-64 baseline, as NEON is for AArch64, where no check is made either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Neither the `__builtin_cpu_supports` probe in conf.rb nor `cpuid.h` has a use now that SSE2 is assumed on x86-64. The probe kept SIMD off on GCC older than 4.8, and the `HAVE_CPUID_H` guard broke builds that have `x86intrin.h` but not `cpuid.h` with a redefinition of `find_simd_implementation`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@byroot
byroot merged commit fae76b9 into master Oct 15, 2026
84 checks passed
@byroot
byroot deleted the claude/forward-port-ruby-commit-d82835 branch October 15, 2026 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants