Skip to content

Commit

Permalink
deps: add simdutf dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
anonrig committed Dec 10, 2022
1 parent 265ea1e commit 0d3c969
Show file tree
Hide file tree
Showing 9 changed files with 30,645 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -170,6 +170,7 @@ with-code-cache test-code-cache:

out/Makefile: config.gypi common.gypi node.gyp \
deps/uv/uv.gyp deps/llhttp/llhttp.gyp deps/zlib/zlib.gyp \
deps/simdutf/simdutf.gyp \
tools/v8_gypfiles/toolchain.gypi tools/v8_gypfiles/features.gypi \
tools/v8_gypfiles/inspector.gypi tools/v8_gypfiles/v8.gyp
$(PYTHON) tools/gyp_node.py -f make
Expand Down
14 changes: 14 additions & 0 deletions deps/simdutf/README.md
@@ -0,0 +1,14 @@
# simdutf

This project boosts unicode validation and transcoding performance by
utilizing SIMD operations where possible.

The source is pulled from: https://github.com/simdutf/simdutf

Active development occurs in the default branch (currently named `master`).

## Updating

```sh
$ git clone https://github.com/simdutf/simdutf
```
27,967 changes: 27,967 additions & 0 deletions deps/simdutf/simdutf.cpp

Large diffs are not rendered by default.

148 changes: 148 additions & 0 deletions deps/simdutf/simdutf.gyp
@@ -0,0 +1,148 @@
{
'variables': {
'arm_fpu%': '',
'target_arch%': '',
},

'targets': [
{
'target_name': 'simdutf',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'conditions': [
[ 'arm_fpu=="neon" and target_arch=="arm"', {
'dependencies': [ 'simdutf_neon32' ],
}],

# arm64 requires NEON, so it's safe to always use it
[ 'target_arch=="arm64"', {
'dependencies': [ 'simdutf_neon64' ],
}],

# Runtime detection will happen for x86 CPUs
[ 'target_arch in "ia32 x64 x32"', {
'dependencies': [
'simdutf_sse42',
'simdutf_avx',
'simdutf_avx2',
'simdutf_avx512',
],
}],
],
},

{
'target_name': 'simdutf_neon32',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'cflags': [ '-Wno-unused-function' ],
'conditions': [
[ 'OS!="win"', {
'cflags': [ '-mfpu=neon' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-mfpu=neon' ]
},
}],
],
},

{
'target_name': 'simdutf_neon64',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'cflags': [ '-Wno-unused-function' ],
# NEON is required in arm64, so no -mfpu flag is needed
},

{
'target_name': 'simdutf_avx',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'cflags': [ '-Wno-unused-function' ],
'conditions': [
[ 'OS!="win"', {
'cflags': [ '-mavx' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-mavx' ]
},
}, {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/arch:AVX'
],
},
},
}],
],
},

{
'target_name': 'simdutf_avx2',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'cflags': [ '-Wno-unused-function' ],
'conditions': [
[ 'OS!="win"', {
'cflags': [ '-mavx2' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-mavx2' ]
},
}, {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/arch:AVX2'
],
},
},
}],
],
},

{
'target_name': 'simdutf_avx512',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'cflags': [ '-Wno-unused-function' ],
'conditions': [
[ 'OS!="win"', {
'cflags': [ '-mavx512f' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-mavx512f' ]
},
}, {
'msvs_settings': {
'VCCLCompilerTool': {
'AdditionalOptions': [
'/arch:AVX512'
],
},
},
}],
],
},

{
'target_name': 'simdutf_sse42',
'type': 'static_library',
'include_dirs': ['.'],
'sources': ['simdutf.cpp'],
'cflags': [ '-Wno-unused-function' ],
'conditions': [
[ 'OS!="win"', {
'cflags': [ '-msse4.2' ],
'xcode_settings': {
'OTHER_CFLAGS': [ '-msse4.2' ]
},
}],
],
},
]
}

0 comments on commit 0d3c969

Please sign in to comment.