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

            Bug ID: 79683
           Summary: SLP vectorizer drops gs: prefix
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: me at manueljacob dot de
                CC: amker at gcc dot gnu.org, jakub at redhat dot com,
                    rguenth at gcc dot gnu.org
  Target Milestone: ---

This happens at least on x86-64 with -ftree-slp-vectorize.  This is the C
source:

struct s {
    long a;
    long b;
};
void test(struct s __seg_gs *x) {
    x->a += 1;
    x->b -= 1;
}

This is the resulting code with -O1:

addq    $1, %gs:(%rdi)
subq    $1, %gs:8(%rdi)

This is the resulting code with -O1 -ftree-slp-vectorize:

movdqu  (%rdi), %xmm0
paddq   .LC0(%rip), %xmm0
movups  %xmm0, %gs:(%rdi)
[...]
.LC0:
.quad   1
.quad   -1

The memory access in movdqu is missing the gs: prefix.

(Apart from that I would say that this transformation, even if done right, may
not be a good idea, but that's not part of this bug report).

Reply via email to