Skip to content
Merged
8 changes: 6 additions & 2 deletions emcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,8 +391,6 @@ def get_clang_flags(user_args):
# Bulk memory may be enabled via threads or directly via -s.
if not settings.BULK_MEMORY:
flags.append('-mno-bulk-memory')
if '-mnontrapping-fptoint' not in user_args and '-mno-nontrapping-fptoint' not in user_args:
flags.append('-mno-nontrapping-fptoint')

if settings.RELOCATABLE and '-fPIC' not in user_args:
flags.append('-fPIC')
Expand Down Expand Up @@ -1416,6 +1414,12 @@ def consume_arg_file():
override=True)
elif arg == '-mno-sign-ext':
feature_matrix.disable_feature(feature_matrix.Feature.SIGN_EXT)
elif arg == '-mnontrappting-fptoint':
feature_matrix.enable_feature(feature_matrix.Feature.NON_TRAPPING_FPTOINT,
'-mnontrapping-fptoint',
override=True)
elif arg == '-mno-nontrapping-fptoint':
feature_matrix.disable_feature(feature_matrix.Feature.NON_TRAPPING_FPTOINT)
elif arg == '-fexceptions':
# TODO Currently -fexceptions only means Emscripten EH. Switch to wasm
# exception handling by default when -fexceptions is given when wasm
Expand Down
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl2_wasm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"a.html.gz": 328,
"a.js": 4532,
"a.js.gz": 2315,
"a.wasm": 10402,
"a.wasm.gz": 6704,
"total": 15388,
"total_gz": 9347
"a.wasm": 10206,
"a.wasm.gz": 6663,
"total": 15192,
"total_gz": 9306
}
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl2_wasm2js.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"a.html": 346,
"a.html.gz": 262,
"a.js": 22200,
"a.js.gz": 11582,
"total": 22546,
"total_gz": 11844
"a.js": 22196,
"a.js.gz": 11599,
"total": 22542,
"total_gz": 11861
}
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl_wasm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"a.html.gz": 328,
"a.js": 4070,
"a.js.gz": 2158,
"a.wasm": 10402,
"a.wasm.gz": 6704,
"total": 14926,
"total_gz": 9190
"a.wasm": 10206,
"a.wasm.gz": 6663,
"total": 14730,
"total_gz": 9149
}
8 changes: 4 additions & 4 deletions test/code_size/hello_webgl_wasm2js.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"a.html": 346,
"a.html.gz": 262,
"a.js": 21726,
"a.js.gz": 11415,
"total": 22072,
"total_gz": 11677
"a.js": 21722,
"a.js.gz": 11432,
"total": 22068,
"total_gz": 11694
}
8 changes: 4 additions & 4 deletions test/code_size/math_wasm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"a.html.gz": 380,
"a.js": 110,
"a.js.gz": 125,
"a.wasm": 2719,
"a.wasm.gz": 1675,
"total": 3381,
"total_gz": 2180
"a.wasm": 2695,
"a.wasm.gz": 1664,
"total": 3357,
"total_gz": 2169
}
8 changes: 4 additions & 4 deletions test/code_size/random_printf_wasm.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"a.html": 12686,
"a.html.gz": 6930,
"total": 12686,
"total_gz": 6930
"a.html": 12558,
"a.html.gz": 6876,
"total": 12558,
"total_gz": 6876
}
4 changes: 2 additions & 2 deletions test/code_size/random_printf_wasm2js.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"a.html": 17266,
"a.html.gz": 7510,
"a.html.gz": 7517,
"total": 17266,
"total_gz": 7510
"total_gz": 7517
}
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors1.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
129276
129213
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_ctors2.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
128722
128659
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
171403
171421
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_except_wasm.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
142503
142527
Original file line number Diff line number Diff line change
@@ -1 +1 @@
145140
145114
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_lto.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
121982
121922
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_mangle.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
232914
233090
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_noexcept.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
132080
132020
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_cxx_wasmfs.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
169523
169463
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14531
14476
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O1.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2535
2556
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_O0.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
975
996
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_O1.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
376
397
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_pthreads.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
19501
19462
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.wasm.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14531
14476
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_no_asserts.wasm.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
11724
11669
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_strict.wasm.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14531
14476
8 changes: 4 additions & 4 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -10432,7 +10432,7 @@ def compile(flags):

compile(['-c'])
verify_features_sec('bulk-memory', False)
verify_features_sec('nontrapping-fptoint', False)
verify_features_sec('nontrapping-fptoint', True)
verify_features_sec('sign-ext', True)
verify_features_sec('mutable-globals', True)
verify_features_sec('multivalue', True)
Expand All @@ -10453,8 +10453,8 @@ def compile(flags):
compile(['-sMIN_FIREFOX_VERSION=61', '-msign-ext'])
verify_features_sec_linked('sign-ext', True)

compile(['-mnontrapping-fptoint', '-c'])
verify_features_sec('nontrapping-fptoint', True)
compile(['-mno-nontrapping-fptoint'])
verify_features_sec_linked('nontrapping-fptoint', False)

# Setting this SAFARI_VERSION should enable bulk memory because it links in emscripten_memcpy_bulkmem
# However it does not enable nontrapping-fptoint yet because it has no effect at compile time and
Expand All @@ -10464,7 +10464,7 @@ def compile(flags):
verify_features_sec_linked('mutable-globals', True)
verify_features_sec_linked('multivalue', True)
verify_features_sec_linked('bulk-memory', True)
verify_features_sec_linked('nontrapping-fptoint', False)
verify_features_sec_linked('nontrapping-fptoint', True)

compile(['-sMIN_SAFARI_VERSION=150000', '-mno-bulk-memory'])
# -mno-bulk-memory at link time overrides MIN_SAFARI_VERSION
Expand Down
3 changes: 2 additions & 1 deletion tools/feature_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class Feature(IntEnum):
Feature.NON_TRAPPING_FPTOINT: {
'chrome': 75,
'firefox': 65,
'safari': 150000,
'safari': 140100, # TODO: Reset back to 150000 when the default changes
'node': 130000,
},
Feature.SIGN_EXT: {
'chrome': 74,
Expand Down
3 changes: 3 additions & 0 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,9 @@ def get_binaryen_passes():
if not feature_matrix.caniuse(feature_matrix.Feature.SIGN_EXT):
logger.debug('lowering sign-ext feature due to incompatible target browser engines')
passes += ['--signext-lowering']
# nontrapping-fp is enabled by default in llvm. Lower it away if requested.
if not feature_matrix.caniuse(feature_matrix.Feature.NON_TRAPPING_FPTOINT):
passes += ['--llvm-nontrapping-fptoint-lowering']
if optimizing:
passes += ['--post-emscripten']
if settings.SIDE_MODULE:
Expand Down