[Bug target/91897] Very poor optimization on large attribute vector_size

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 25 13:31:00 GMT 2019


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |missed-optimization
             Target|                            |x86_64-*-*, i?86-*-*
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2019-09-25
          Component|c++                         |target
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.  This seems to be a target / RTL expansion issue when expanding

  BIT_FIELD_REF <<retval>, 256, 0> = _10;
  BIT_FIELD_REF <<retval>, 256, 256> = _13;
  BIT_FIELD_REF <<retval>, 256, 512> = _16;
  BIT_FIELD_REF <<retval>, 256, 768> = _19;
  return <retval>;

which individually are expanded as

;; BIT_FIELD_REF <<retval>, 256, 512> = _16;

(insn 24 23 25 (set (mem/j/c:DI (plus:DI (reg/f:DI 94 [ .result_ptr ])
                (const_int 64 [0x40])) [0 +64 S8 A512])
        (subreg:DI (reg:V4DF 90 [ _16 ]) 0)) "t.c":5:17 -1
     (nil))

(insn 25 24 26 (set (mem/j/c:DI (plus:DI (reg/f:DI 94 [ .result_ptr ])
                (const_int 72 [0x48])) [0 +72 S8 A64])
        (subreg:DI (reg:V4DF 90 [ _16 ]) 8)) "t.c":5:17 -1
     (nil))

(insn 26 25 27 (set (mem/j/c:DI (plus:DI (reg/f:DI 94 [ .result_ptr ])
                (const_int 80 [0x50])) [0 +80 S8 A128])
        (subreg:DI (reg:V4DF 90 [ _16 ]) 16)) "t.c":5:17 -1
     (nil))

(insn 27 26 0 (set (mem/j/c:DI (plus:DI (reg/f:DI 94 [ .result_ptr ])
                (const_int 88 [0x58])) [0 +88 S8 A64])
        (subreg:DI (reg:V4DF 90 [ _16 ]) 24)) "t.c":5:17 -1
     (nil))

instead of a single ymm store.

The same happens with the following which effectively mimics the ABI:

typedef double Double16 __attribute__((vector_size(8*16)));

void mult(Double16 &res, const Double16& v1, const Double16& v2)
{
    res = v1 * v2;
}


More information about the Gcc-bugs mailing list