<html><body><p><tt><font size="2">Ulrich Weigand/Germany/IBM wrote on 29.09.2021 20:54:00:<br>> "Reid Kleckner" <rnk@google.com> wrote on 29.09.2021 20:35:09:<br>> <br>> > I think it would instead be reasonable to pick a safer default for <br>> > the target, like always zero extending unannotated parameters on <br>> > both the caller side and the callee side. This is less efficient <br>> > than only extending once in the caller, but it makes it much easier <br>> > to retarget an IR producer over to SystemZ. It makes the attributes <br>> > into performance improvements, not correctness requirements. I <br>> > suspect this will not actually break passing a 4 byte struct, it <br>> > just makes it less efficient.</font></tt><br><tt><font size="2">> <br>> Unfortunately there is no "safe" default.  If the callee expects</font></tt><br><tt><font size="2">> a signed value, the argument has to be sign-extended; if the</font></tt><br><tt><font size="2">> callee expects an unsigned value, the argument has to be zero-</font></tt><br><tt><font size="2">> extended.  Using the wrong extension is just as much a codegen</font></tt><br><tt><font size="2">> bug as not extending at all.</font></tt><br><br><tt><font size="2">That said, of course you're right that using some extension by</font></tt><br><tt><font size="2">default is "safer" in the sense that it'll just do the right</font></tt><br><tt><font size="2">thing in more cases than simply not extending at all.</font></tt><br><br><tt><font size="2">So maybe one option might be to implement Jonas' original idea</font></tt><br><tt><font size="2">of an abort unless the parameter is marked either zeroext or</font></tt><br><tt><font size="2">signext or anyext, but only under control of a command line</font></tt><br><tt><font size="2">option enabling "strict checking".  This would be off by default,</font></tt><br><tt><font size="2">in which case the back-end would default to some extension</font></tt><br><tt><font size="2">as per your suggestion.</font></tt><br><br><tt><font size="2">The strict option could be on e.g. for the buildbot jobs, so</font></tt><br><tt><font size="2">we'd at least have a good chance of catching missing extensions</font></tt><br><tt><font size="2">in code that's part of the LLVM repo and checked by the bot.</font></tt><br><br><tt><font size="2">Bye,</font></tt><br><tt><font size="2">Ulrich</font></tt><br><BR>
<BR>
</body></html>