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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
          Component|c++                         |inline-asm

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
it looks reduced ad absurdum but the issue must lie in

 asm("":"=rmf"(f),"=d"([t(reinterpret_cast<int>(0))]{}):"0"(((0))),""((0)));

which I can't really parse but we expand from

int {anonymous}::n ()
{
  int D.2351;
  struct ._anon_1 t;
  float f;
  int D.2422;
  struct ._anon_0 D.2374;
  register int * D.2360;
  void * _1;
  int _5;

;;   basic block 2, loop depth 0
;;    pred:       ENTRY
  D.2374.__t = 0;
  __asm__("" : "=rmf" f, "=d" D.2374 : "0" 0, "" 0);

likely D.2374 is not re-loadable into DREG.  The zero seems to be SFmode:

(insn 6 2 7 2 (set (reg:SI 86)
        (const_int 0 [0])) "t.ii":1:163 75 {*movsi_internal}
     (nil))
(insn 7 6 11 2 (parallel [
            (set (mem/c:SF (plus:DI (reg/f:DI 19 frame)
                        (const_int -4 [0xfffffffffffffffc])) [1 f+0 S4 A32])
                (asm_operands:SF ("") ("=rmf") 0 [
                        (reg:SI 86)
                        (const_int 0 [0])
                    ]
                     [
                        (asm_input:SI ("0") t.ii:1)
                        (asm_input:SI ("") t.ii:1)
                    ]
                     [] t.ii:1))
            (set (reg:SI 84 [ D.2374 ])
                (asm_operands:SI ("") ("=d") 1 [
                        (reg:SI 86)
                        (const_int 0 [0])
                    ]
                     [
                        (asm_input:SI ("0") t.ii:1)
                        (asm_input:SI ("") t.ii:1)
                    ]
                     [] t.ii:1))
            (clobber (reg:CC 17 flags))
        ]) "t.ii":1:163 -1
     (expr_list:REG_DEAD (reg:SI 86)
        (expr_list:REG_UNUSED (reg:SI 84 [ D.2374 ])
            (expr_list:REG_UNUSED (reg:CC 17 flags)
                (nil)))))

and we fail to reload.  It _looks_ similar to

void foo(float f)
{
  struct { float f; } x;
  asm("": "=f" (f), "=d" (x) : "0" (0), "" (0));
}

but we reject this via

t.i: In function 'void foo(float)':
t.i:4:3: error: inconsistent operand constraints in an 'asm'
    4 |   asm("": "=f" (f), "=d" (x) : "0" (0), "" (0));
      |   ^~~

Reply via email to