On 11/4/22 17:00, Philipp Tomsich wrote:
Alexander,

I had missed your comment until now.

On Tue, 6 Sept 2022 at 13:39, Alexander Monakov <amona...@ispras.ru> wrote:
On Mon, 5 Sep 2022, Philipp Tomsich wrote:

+riscv_mode_rep_extended (scalar_int_mode mode, scalar_int_mode
mode_rep)
+{
+  /* On 64-bit targets, SImode register values are sign-extended to
DImode.  */
+  if (TARGET_64BIT && mode == SImode && mode_rep == DImode)
+    return SIGN_EXTEND;
I think this leads to a counter-intuitive requirement that a hand-written
inline asm must sign-extend its output operands that are bound to either
signed or unsigned 32-bit lvalues. Will compiler users be aware of that?
I am not sure if I fully understand your concern, as the mode of the
asm-output will be derived from the variable type.
So "asm (... : "=r" (a))" will take DI/SI/HI/QImode depending on the type
of a.

Correct.



The concern, as far as I understand would be the case where the
assembly-sequence leaves an incompatible extension in the register.

Right.  The question in my mind is whether or not the responsibility should be on the compiler or on the developer to ensure the ASM output is properly extended.  If someone's writing ASMs, then to a large degree, I consider it their responsibility to make sure things are properly extended -- even more so if having the compiler do it results in slower code independent of ASMs.


Jeff

Reply via email to