https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100217

Ilya Leoshkevich <iii at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iii at linux dot ibm.com

--- Comment #3 from Ilya Leoshkevich <iii at linux dot ibm.com> ---
There main problem here is that `register long double f0 asm ("f0")` does not
make sense on z14 anymore. long doubles are stored in vector registers now, not
in floating-point register pairs. If we skip the hard reg, the code will end up
having the following semantics:

vr0[0:128] = 1.0L;
asm("/* expect the value in vr0[0:64] . vr2[0:64] */");

and fail during the run time. So I think it's better to use the "best effort"
approach and force it into a pseudo, even if this would mean that the
user-specified register is not honored:

--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -16814,6 +16814,12 @@ s390_md_asm_adjust (vec<rtx> &outputs, vec<rtx>
&inputs,
       gcc_assert (allows_reg);
       /* Copy input value from a vector register into a FPR pair.  */
       rtx fprx2 = gen_reg_rtx (FPRX2mode);
+      if (REG_P (inputs[i]) && HARD_REGISTER_P (inputs[i]))
+       {
+         rtx orig_input = inputs[i];
+         inputs[i] = gen_reg_rtx (TFmode);
+         emit_move_insn (inputs[i], orig_input);
+       }
       emit_insn (gen_tf_to_fprx2 (fprx2, inputs[i]));
       inputs[i] = fprx2;
       input_modes[i] = FPRX2mode;

I need to check whether we can keep the output logic as is.

Ideally the code should be adapted and use the __LONG_DOUBLE_VX__ macro like
this:

#ifdef __LONG_DOUBLE_VX__
  register long double f0 asm ("v0");
#else
  register long double f0 asm ("f0");
#endif

  f0 = 1.0L;

#ifdef __LONG_DOUBLE_VX__
  asm("" : : "v" (f0));
#else
  asm("" : : "f" (f0));
#endif

Maybe a warning recommending to do this should be printed.

Reply via email to