-
Notifications
You must be signed in to change notification settings - Fork 218
Description
This issue is for explaining the reason we need each flag I added in #191
Also see: trunk-rs/trunk#866
optional WASM feature of wasm-opt
There are wasm features that wasm-opt does not support by default, including:
--enable-bulk-memoryis formemcpylike instructtions:memory.copy,memory.fill, ...1--enable-nontrapping-float-to-intprovides _sat variants ofixx.trunc_fxx_s2--enable-threadsenables atomic operations. WASM is currently single-threaded though
LLVM used the _sat for its fp_to_sint_sat
A empty repo (whether added poll_promise) will compile with trunk under release mode fine, but once one of them are involved, we must provide such options.
I'm trying to write a minimum reproduce code, but it's hard to know how to make the assembly result contain specific instruction without naked asm.
This also depends on LLVM version, because rustc compiles to LLVM IR.
For my rustc 1.93 and doukutsu-save-editor, I found --enable-threads can be removed, but --enable-bulk-memory and --enable-nontrapping-float-to-int were used
Looking into LLVM source code, the wasm memcpy was defined as CPY_A#B, COPY_A#B, etc.
And to determine whether it's being used, see llvm frontend code, and look.up for COPY_I32, COPY_I64.