public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx
@ 2021-08-27 20:22 mpolacek at gcc dot gnu.org
  2021-08-27 20:22 ` [Bug target/102105] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-08-27 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102105
           Summary: x86_64: ABI break with vector in union and -mno-mmx
                    -mavx
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

This looks like another ABI break.  Started with r271213.

-mno-mmx -mavx is an unusual combination I guess, but I'm filing this anyway.

$ cat m.c
void vector_1_x();
int main() { vector_1_x(); }
$ cat x.c
typedef int di;
typedef di __attribute__((vector_size(8))) v1di;
typedef union {
  v1di v;
  di a[1];
} u1di;
v1di g_v1di;
int pass_v1di_j;
di pass_v1di_a[1];
di pass_v1di_a_0;
u1di pass_v1di_u;
void test_v8qi();
void pass_v8qi() {}
void test_v1di();
void checkp_1di();
void pass_v1di(v1di v) {
  pass_v1di_u.v = v;
  pass_v1di_a_0 = pass_v1di_u.a[pass_v1di_j];
  checkp_1di(pass_v1di_a);
}
void vector_1_x() {
  test_v8qi();
  test_v1di();
}
$ cat y.c
typedef int qi;
typedef int __attribute__((mode(DI))) di;
int test_v8qi_i, checkp_1di_i;
extern __attribute__((__vector_size__(sizeof(di)))) di g_v1di;
void abort();
typedef union {
  __attribute__((__vector_size__(2 * sizeof(qi)))) qi v;
  qi a[8];
} u8qi;
void pass_v8qi();
void checkp_8qi(qi *p) {
  for (; 0;)
    if (p)
      abort();
}
void test_v8qi() {
  u8qi u;
  qi *p = u.a;
  for (; test_v8qi_i;)
    u.a[test_v8qi_i] = test_v8qi_i;
  pass_v8qi(u.v);
  checkp_8qi(p);
}
void pass_v1di();
void checkp_1di(di *p) {
  if (p[checkp_1di_i])
    abort();
}
void test_v1di() { pass_v1di(g_v1di); }

And then:
$ xgcc-11 -c m.c
$ xgcc-11 -c x.c -mno-mmx -mavx
$ xgcc-9 -c y.c  -mno-mmx -mavx
$ xgcc-11 m.o x.o y.o -o foo
$ ./foo
Aborted (core dumped)
$ xgcc-10 -c y.c -mno-mmx -mavx
$ xgcc-11 m.o x.o y.o -o foo
$ ./foo && echo ok
ok

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/102105] [10/11/12 Regression] x86_64: ABI break with vector in union and -mno-mmx -mavx
  2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
@ 2021-08-27 20:22 ` mpolacek at gcc dot gnu.org
  2021-08-27 20:28 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-08-27 20:22 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.4
           Keywords|                            |ABI
            Summary|x86_64: ABI break with      |[10/11/12 Regression]
                   |vector in union and         |x86_64: ABI break with
                   |-mno-mmx -mavx              |vector in union and
                   |                            |-mno-mmx -mavx

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/102105] [10/11/12 Regression] x86_64: ABI break with vector in union and -mno-mmx -mavx
  2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
  2021-08-27 20:22 ` [Bug target/102105] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
@ 2021-08-27 20:28 ` mpolacek at gcc dot gnu.org
  2021-08-27 21:33 ` hjl.tools at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-08-27 20:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
diff between r271212 and r271213:

$ diff -up ~/y12.s ~/y13.s
--- /home/mpolacek/y12.s        2021-08-27 16:25:46.000000000 -0400
+++ /home/mpolacek/y13.s        2021-08-27 16:25:53.000000000 -0400
@@ -87,8 +87,8 @@ test_v1di:
        movq    %rsp, %rbp
 .LCFI10:
        movq    g_v1di(%rip), %rax
-       movq    %rax, %rdi
-       movl    $0, %eax
+       vmovq   %rax, %xmm0
+       movl    $1, %eax
        call    pass_v1di
        nop
        popq    %rbp

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/102105] [10/11/12 Regression] x86_64: ABI break with vector in union and -mno-mmx -mavx
  2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
  2021-08-27 20:22 ` [Bug target/102105] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
  2021-08-27 20:28 ` mpolacek at gcc dot gnu.org
@ 2021-08-27 21:33 ` hjl.tools at gmail dot com
  2021-08-28  1:09 ` [Bug target/102105] " hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-27 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-08-27
                 CC|hjl at gcc dot gnu.org             |hjl.tools at gmail dot com
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/102105] x86_64: ABI break with vector in union and -mno-mmx -mavx
  2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-08-27 21:33 ` hjl.tools at gmail dot com
@ 2021-08-28  1:09 ` hjl.tools at gmail dot com
  2022-06-28 10:46 ` [Bug target/102105] x86_64: ABI break with __m64 argument and -mno-mmx jakub at gcc dot gnu.org
  2023-07-07  9:45 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: hjl.tools at gmail dot com @ 2021-08-28  1:09 UTC (permalink / raw)
  To: gcc-bugs

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |9.4.1
            Summary|[10/11/12 Regression]       |x86_64: ABI break with
                   |x86_64: ABI break with      |vector in union and
                   |vector in union and         |-mno-mmx -mavx
                   |-mno-mmx -mavx              |

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> ---
I consider this is a GCC 9 bug:

[hjl@gnu-cfl-2 pr102105]$ cat foo.c
extern __attribute__((__vector_size__(8))) long long g_v1di;
void pass_v1di( __attribute__((__vector_size__(8))) long long);
void test_v1di() { pass_v1di(g_v1di); }
[hjl@gnu-cfl-2 pr102105]$ /usr/gcc-9.3.1-x32/bin/gcc -S -O2 foo.c
[hjl@gnu-cfl-2 pr102105]$ cat foo.s
        .file   "foo.c"
        .text
        .p2align 4
        .globl  test_v1di
        .type   test_v1di, @function
test_v1di:
.LFB0:
        .cfi_startproc
        movq    g_v1di(%rip), %xmm0
        jmp     pass_v1di
        .cfi_endproc
.LFE0:
        .size   test_v1di, .-test_v1di
        .ident  "GCC: (GNU) 9.3.1 20200312"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr102105]$ /usr/gcc-9.3.1-x32/bin/gcc -S -O2 foo.c -mno-mmx
[hjl@gnu-cfl-2 pr102105]$ cat foo.s
        .file   "foo.c"
        .text
        .p2align 4
        .globl  test_v1di
        .type   test_v1di, @function
test_v1di:
.LFB0:
        .cfi_startproc
        movq    g_v1di(%rip), %rdi
        jmp     pass_v1di
        .cfi_endproc
.LFE0:
        .size   test_v1di, .-test_v1di
        .ident  "GCC: (GNU) 9.3.1 20200312"
        .section        .note.GNU-stack,"",@progbits
[hjl@gnu-cfl-2 pr102105]$ 

Since MMX register isn't used, -mno-mmx shouldn't change ABI.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/102105] x86_64: ABI break with __m64 argument and -mno-mmx
  2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-08-28  1:09 ` [Bug target/102105] " hjl.tools at gmail dot com
@ 2022-06-28 10:46 ` jakub at gcc dot gnu.org
  2023-07-07  9:45 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/102105] x86_64: ABI break with __m64 argument and -mno-mmx
  2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-06-28 10:46 ` [Bug target/102105] x86_64: ABI break with __m64 argument and -mno-mmx jakub at gcc dot gnu.org
@ 2023-07-07  9:45 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |---
             Target|                            |x86_64-*-* i?86-*-*

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-07  9:45 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 20:22 [Bug target/102105] New: x86_64: ABI break with vector in union and -mno-mmx -mavx mpolacek at gcc dot gnu.org
2021-08-27 20:22 ` [Bug target/102105] [10/11/12 Regression] " mpolacek at gcc dot gnu.org
2021-08-27 20:28 ` mpolacek at gcc dot gnu.org
2021-08-27 21:33 ` hjl.tools at gmail dot com
2021-08-28  1:09 ` [Bug target/102105] " hjl.tools at gmail dot com
2022-06-28 10:46 ` [Bug target/102105] x86_64: ABI break with __m64 argument and -mno-mmx jakub at gcc dot gnu.org
2023-07-07  9:45 ` rguenth at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).