Skip to content

Commit fdbb606

Browse files
committed
Refactor simd/conf.rb - conditions to enable
See the results of `have_type` and `try_compile` in addition to `have_header` for NEON as well as x86_64. The former results were just ignored, and `HAVE_TYPE_` macros are unused too.
1 parent 2211e30 commit fdbb606

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ext/json/ext/simd/conf.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
case RbConfig::CONFIG['host_cpu']
22
when /^(arm|aarch64)/
33
# Try to compile a small program using NEON instructions
4-
if have_header('arm_neon.h')
5-
have_type('uint8x16_t', headers=['arm_neon.h']) && try_compile(<<~'SRC')
4+
if have_header('arm_neon.h') &&
5+
have_type('uint8x16_t', headers=['arm_neon.h']) && try_compile(<<~'SRC')
66
#include <arm_neon.h>
77
int main(int argc, char **argv) {
88
uint8x16_t test = vdupq_n_u8(32);
@@ -13,7 +13,8 @@
1313
$defs.push("-DJSON_ENABLE_SIMD")
1414
end
1515
when /^(x86_64|x64)/
16-
if have_header('x86intrin.h') && have_type('__m128i', headers=['x86intrin.h']) && try_compile(<<~'SRC')
16+
if have_header('x86intrin.h') &&
17+
have_type('__m128i', headers=['x86intrin.h']) && try_compile(<<~'SRC')
1718
#include <x86intrin.h>
1819
int main(int argc, char **argv) {
1920
__m128i test = _mm_set1_epi8(32);

0 commit comments

Comments
 (0)