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

            Bug ID: 79444
           Summary: Inconsistent use of DW_OP_piece for vector registers
                    on s390x
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnez at linux dot vnet.ibm.com
  Target Milestone: ---

GCC emits DW_OP_piece for vector registers on s390x in (at least) two
different incompatible ways:

(1) When describing a float field in a structure that was optimized into a
floating-point register:

  extern void do_something (float a, float b, float s, float p);

  void foo (float a, float b)
  {
    struct { float a; float b; } s = { a, b };

    do_something (a, b, s.a + s.b, s.a * s.b);
  }

Compiling the above with "gcc -march=z13 -O3 -g" yields a location list
for foo's variable 's' with an entry like this:

  (DW_OP_reg16 (f0); DW_OP_piece: 4; DW_OP_reg17 (f2); DW_OP_piece: 4)

Here the piece operations refer to the *upper* bytes of the floating-point
registers f0 and f2 (aka v0 and v2).

(2) When describing an __int128 bit field that was optimized into a vector
register:

  extern void do_something (__int128);

  void foo (__int128 x, __int128 y)
  {
    struct {
      unsigned __int128 p: 32;
      unsigned __int128 a: 96;
    } w = {0, x};
    do_something (w.a + y);
  }

Compiling the above code with "gcc -march=z13 -O3 -g" yields a location
list for foo's variable 'w' with an entry like this:

  (DW_OP_lit0; DW_OP_stack_value; DW_OP_piece: 4; DW_OP_reg16 (f0);
  DW_OP_piece: 12)

And here the latter piece operation refers to the *lower* bytes of the vector
register v0.

Reply via email to