On Sun, Nov 26, 2017 at 06:16:43PM +0100, Sebastien Marie wrote: > On Sun, Nov 26, 2017 at 01:40:06PM +0000, Stuart Henderson wrote: > > On 2017/11/26 14:00, Sebastien Marie wrote: > > > Hi, > > > > > > The following diff makes i386 to be compiled without --enable-rust-simd. > > > simd is "Single instruction, multiple data" (aka MMX, SSE, SSE2...). > > > > > > rustc when compiled with external LLVM doesn't export target_features as > > > compilation variable, making firefox building to fail. > > > > > > I workarounded the problem on amd64 by manually exported SSE2 symbol > > > (always present on amd64). But for i386, same hack isn't possible (as > > > not all i386 processors have such extensions). So it is preferable to > > > not enable simd on i386. > > > > > > I tested the diff with rustc 1.22.1 and firefox still build well (but no > > > runtime test). > > > > Is it actually needed? I can't imagine anything that can actually *run* > > firefox (RAM-wise) that doesn't at least have SSE. > > > > Regarding firefox, I agree that SSE2 should be available on any > processor that will use firefox. > > But the same hack for i386 isn't possible. It is a compiler change and I > am unsure about controlled effects on rust programs. > > But it is possible to force simd crate to not check the target_feature, > and always assumes SSE2 to be present. But it will be a new > (unmergeable) patch on firefox and landry@ disagree. > > > Due to the serious lack of registers on i386 (especially with PIE) I think > > it needs all the help it can get... > > My diff on rustc doesn't change the way the compiler uses LLVM. With > external LLVM (opposed to using the embedded one), rustc has no way to > get the list of target_feature that LLVM part has used to generate the > code. So my hack on rustc is to always announce "SSE2" as present for > amd64.
Hacks in rust port are fine with me, im not responsible for this port :) > For me, dropping --enable-rust-simd on i386 isn't problem for > compilation. The impact will be performance wise at runtime for decoding > pages (simd is used by encoding_rs). After discussing it oob with sebastien this makes sense - if we go through hacks to keep rust-simd on i386 and someone crazy tries to run firefox on a pentium II, it will crash on sse, while it wouldnt if we disable rust-simd on i386. It will probably crash elsewhere (because lots of other bits of firefox probably use sse in hidden places) but we wont blame rust for this :) Landry