You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AstSemantics details sext/zext loads and stores for integer types.
Should WebAssembly also support f32→f64 extending loads, and f64→f32 truncating stores?
I'm currently teaching LLVM about load/store, and for now I can tell it to just expand these out to the appropriate instruction pair (what we call promote and demote).
Hm, I don't understand why loads/stores need to duplicate the semantics of half the conversion operators. Instead of adding more of those, wouldn't it be better to only have the minimum set of conversions built in there (i.e., only those to memory types that don't exist outside stores)?
I don't think these are important. The current truncating store and extending loads are present because we don't want fully general i8 and i16 types. But for floating point, we do have f32 and f64, so the justification doesn't apply.
There's also the simple-compiler argument, but on x86 where this would matter most, the unary load-operate instructions don't write a full register, so a second instruction is desirable anyway.
There is a real possibility that we'll want load-float16-and-promote-to-float32 and so on in the future though.
In any case, we do have the basic load/store and ext/trunc operations, so it can be added if/when convenient. I propose that we leave this open for now, and revisit as we get closer to MVP.
No rush, this is about consistency. The outcome could be, as @rossberg-chromium suggests, that we remove the redundant built-in conversions, or that we add the FP ones, or leave things as is. Let's leave this bug open until we're in polish mode.
Activity
rossberg commentedon Aug 29, 2015
Hm, I don't understand why loads/stores need to duplicate the semantics of half the conversion operators. Instead of adding more of those, wouldn't it be better to only have the minimum set of conversions built in there (i.e., only those to memory types that don't exist outside stores)?
jfbastien commentedon Aug 29, 2015
@rossberg-chromium a most wonderful idea which I wholeheartedly agreed with in #82 :-)
sunfishcode commentedon Aug 30, 2015
I don't think these are important. The current truncating store and extending loads are present because we don't want fully general i8 and i16 types. But for floating point, we do have f32 and f64, so the justification doesn't apply.
There's also the simple-compiler argument, but on x86 where this would matter most, the unary load-operate instructions don't write a full register, so a second instruction is desirable anyway.
There is a real possibility that we'll want load-float16-and-promote-to-float32 and so on in the future though.
jfbastien commentedon Aug 31, 2015
In any case, we do have the basic load/store and ext/trunc operations, so it can be added if/when convenient. I propose that we leave this open for now, and revisit as we get closer to MVP.
sunfishcode commentedon Aug 31, 2015
What's the motivation here? If this is about syntax sugar or encoding density, there are much more pressing concerns elsewhere.
jfbastien commentedon Aug 31, 2015
No rush, this is about consistency. The outcome could be, as @rossberg-chromium suggests, that we remove the redundant built-in conversions, or that we add the FP ones, or leave things as is. Let's leave this bug open until we're in polish mode.
rossberg commentedon Sep 2, 2015
I opened #326 for the broader issue.
sunfishcode commentedon Oct 22, 2015
These don't have a strong motivation.