Closed
Description
Right now fastcomp uses the asmjs triple, and the new wasm backend in LLVM uses the wasm triple. For most purposes they are the same - both are simple 32-bit targets - but they also differ in some ways, such as the wasm triple having extended long double support (like x86), while the asmjs triple defines long doubles as doubles (like ARM).
It would be nice to use the same triple for everything. Then bitcode would be the same in both cases, and it could be compiled to asm.js or wasm at the last stage, without generating all new bitcode.
Things stopping this are:
- Extended long double support in the wasm triple means that libc will include more code, every math function has a long double version, etc. This currently is an issue even without using long doubles, as printf can call it internally (but @sunfishcode suggests that might be optimized away). So switching the asmjs triple to wasm would increase code size and build times. We should measure this, and consider options given that.
- Other differences may exist. For example, the asm.js target in fastcomp defines a cost for various operations, sets up SIMD to work properly, etc. wasm might not set those costs, so it might use defaults that differ, and it has no SIMD so I assume that isn't set up either. We'd need to make sure all this stuff does not regress when considering moving the asmjs triple to wasm.
Metadata
Metadata
Assignees
Labels
No labels