public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
@ 2023-09-08 22:24 fxcoudert at gcc dot gnu.org
  2023-09-08 22:29 ` [Bug target/111350] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-09-08 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 111350
           Summary: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends
                    fail on x86_64-apple-darwin21
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

We're seeing these failures on x86_64-apple-darwin21:

FAIL: gcc.target/i386/avx512fp16-vfcmulcph-1b.c (test for excess errors)
FAIL: gcc.target/i386/avx512fp16-vfcmulcsh-1b.c (test for excess errors)
FAIL: gcc.target/i386/avx512fp16-vfmulcph-1b.c (test for excess errors)
FAIL: gcc.target/i386/avx512fp16-vfmulcsh-1b.c (test for excess errors)
FAIL: gcc.target/i386/avx512fp16vl-vfcmulcph-1b.c (test for excess errors)
FAIL: gcc.target/i386/avx512fp16vl-vfmulcph-1b.c (test for excess errors)


The errors are all similar-looking:

FAIL: gcc.target/i386/avx512fp16-vfmulcsh-1b.c (test for excess errors)
Excess errors:
/var/folders/_8/7ft0tbns6_l87s21n4s_1sc80000gn/T//cclz0cVD.s:379:2: warning:
Destination register should be distinct from source registers
        vfmulcsh        {rn-sae}, %xmm1, %xmm3, %xmm0{%k1}
        ^


FAIL: gcc.target/i386/avx512fp16-vfcmulcph-1b.c (test for excess errors)
Excess errors:
/var/folders/_8/7ft0tbns6_l87s21n4s_1sc80000gn/T//ccB0dfAf.s:475:2: warning:
Destination register should be distinct from source registers
        vfcmulcph       _src2(%rip), %zmm2, %zmm0{%k1}
        ^
/var/folders/_8/7ft0tbns6_l87s21n4s_1sc80000gn/T//ccB0dfAf.s:540:2: warning:
Destination register should be distinct from source registers
        vfcmulcph       {rn-sae}, %zmm7, %zmm6, %zmm0{%k1}
        ^



I tried to reduce one, and got:

$ cat avx512fp16vl-vfcmulcph-1b.i
typedef _Float16 __m256h __attribute__ ((__vector_size__ (32), __may_alias__));
typedef _Float16 __v16hf __attribute__ ((__vector_size__ (32)));

typedef union {
  __m256h ymmh[2];
  unsigned short u16[32];
} V512;

V512 src1, src2;
int n_errs = 0;

extern __inline __m256h __attribute__ ((__gnu_inline__, __always_inline__,
__artificial__))
_mm256_mask_fcmul_pch (__m256h __A, unsigned char __B, __m256h __C, __m256h
__D)
{ return (__m256h) __builtin_ia32_vfcmulcph256_mask ((__v16hf) __C, (__v16hf)
__D, (__v16hf) __A, __B); }


void check_results(void *got, void *exp, int n_elems, char *banner) {
    int i;
    V512 *v1 = (V512*)got;
    V512 *v2 = (V512*)exp;

    for (i = 0; i < n_elems; i++) {
        if (v1->u16[i] != v2->u16[i] &&
            ((v1->u16[i] > (v2->u16[i] + 1)) ||
             (v1->u16[i] < (v2->u16[i] - 1)))) {
            n_errs++;
            break;
        }
    }
}

int main () {
  V512 res;
  V512 exp;
  res.ymmh[0] = _mm256_mask_fcmul_pch (res.ymmh[0], 0xcc, src1.ymmh[0],
src2.ymmh[0]);
  check_results ((void*)&res, (void*)&exp, (256 / 16),
"_mm256_mask_fcmul_pch");
}


which yields the warning:

$ /Users/fx/ibin/gcc/xgcc -B/Users/fx/ibin/gcc/ avx512fp16vl-vfcmulcph-1b.i -O2
-mavx512fp16 -mavx512vl -mavx512dq -c
/var/folders/_8/7ft0tbns6_l87s21n4s_1sc80000gn/T//ccruiM7F.s:57:2: warning:
Destination register should be distinct from source registers
        vfcmulcph       _src2(%rip), %ymm1, %ymm0{%k1}
        ^

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
@ 2023-09-08 22:29 ` pinskia at gcc dot gnu.org
  2023-09-08 22:32 ` iains at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-08 22:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This seems like a bug in darwin's assembler as all of those registers are
distinct  ...

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
  2023-09-08 22:29 ` [Bug target/111350] " pinskia at gcc dot gnu.org
@ 2023-09-08 22:32 ` iains at gcc dot gnu.org
  2023-09-08 22:33 ` fxcoudert at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2023-09-08 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #1)
> This seems like a bug in darwin's assembler as all of those registers are
> distinct  ...

indeed, it does look that way - what version of Xcode?

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
  2023-09-08 22:29 ` [Bug target/111350] " pinskia at gcc dot gnu.org
  2023-09-08 22:32 ` iains at gcc dot gnu.org
@ 2023-09-08 22:33 ` fxcoudert at gcc dot gnu.org
  2023-09-08 22:41 ` iains at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2023-09-08 22:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Clang: 14.0.0 build 1400
CLT: 14.2.0.0.1.1668646533

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2023-09-08 22:33 ` fxcoudert at gcc dot gnu.org
@ 2023-09-08 22:41 ` iains at gcc dot gnu.org
  2023-09-08 22:47 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2023-09-08 22:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #3)
> Clang: 14.0.0 build 1400
> CLT: 14.2.0.0.1.1668646533

ah, it seems the vfcmulcph insn, at least, is not supported before XC14, and it
gives the error at 14.0b3 and 14.3.  It seems fixed at XC 15b7.

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2023-09-08 22:41 ` iains at gcc dot gnu.org
@ 2023-09-08 22:47 ` iains at gcc dot gnu.org
  2023-09-09  9:35 ` iains at gcc dot gnu.org
  2023-09-09  9:39 ` iains at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2023-09-08 22:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #4)
> (In reply to Francois-Xavier Coudert from comment #3)
> > Clang: 14.0.0 build 1400
> > CLT: 14.2.0.0.1.1668646533
> 
> ah, it seems the vfcmulcph insn, at least, is not supported before XC14, and
> it gives the error at 14.0b3 and 14.3.  It seems fixed at XC 15b7.

perhaps we can add something to the "avx512fp16" target test that requires
assembly of one of those insns so that the tests will be automatically
unsupported for broken assemblers.

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2023-09-08 22:47 ` iains at gcc dot gnu.org
@ 2023-09-09  9:35 ` iains at gcc dot gnu.org
  2023-09-09  9:39 ` iains at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2023-09-09  9:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #5)
> (In reply to Iain Sandoe from comment #4)
> > (In reply to Francois-Xavier Coudert from comment #3)
> > > Clang: 14.0.0 build 1400
> > > CLT: 14.2.0.0.1.1668646533
> > 
> > ah, it seems the vfcmulcph insn, at least, is not supported before XC14, and
> > it gives the error at 14.0b3 and 14.3.  It seems fixed at XC 15b7.
> 
> perhaps we can add something to the "avx512fp16" target test that requires
> assembly of one of those insns so that the tests will be automatically
> unsupported for broken assemblers.

maybe something like this (untested because 15b7 is only supported on macOS13
and my avx512 box has an earlier install)

diff --git a/gcc/testsuite/lib/target-supports.exp
b/gcc/testsuite/lib/target-supports.exp
index 0ea8bcb24e1..2d74f62e887 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -9776,6 +9776,7 @@ proc check_effective_target_avx512fp16 { } {
        void foo (void)
        {
          asm volatile ("vmovw %edi, %xmm0");
+         asm volatile ("vfcmulcph %xmm1, %xmm2, %xmm3");
        }
     } "-O2 -mavx512fp16" ]
 }

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

* [Bug target/111350] gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21
  2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2023-09-09  9:35 ` iains at gcc dot gnu.org
@ 2023-09-09  9:39 ` iains at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: iains at gcc dot gnu.org @ 2023-09-09  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-09-09

--- Comment #7 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Iain Sandoe from comment #6)
> (In reply to Iain Sandoe from comment #5)
> > (In reply to Iain Sandoe from comment #4)
> > > (In reply to Francois-Xavier Coudert from comment #3)
> > > > Clang: 14.0.0 build 1400
> > > > CLT: 14.2.0.0.1.1668646533

> maybe something like this (untested because 15b7 is only supported on
> macOS13 and my avx512 box has an earlier install)
> 
> diff --git a/gcc/testsuite/lib/target-supports.exp
> b/gcc/testsuite/lib/target-supports.exp
> index 0ea8bcb24e1..2d74f62e887 100644
> --- a/gcc/testsuite/lib/target-supports.exp
> +++ b/gcc/testsuite/lib/target-supports.exp
> @@ -9776,6 +9776,7 @@ proc check_effective_target_avx512fp16 { } {
>         void foo (void)
>         {
>           asm volatile ("vmovw %edi, %xmm0");
> +         asm volatile ("vfcmulcph %xmm1, %xmm2, %xmm3");
>         }
>      } "-O2 -mavx512fp16" ]
>  }

hmm not enough it needs:
+         asm volatile ("vfcmulcph %xmm1, %xmm2, %xmm3{%k1}");
to fail on XC14 and pass on XC15

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-08 22:24 [Bug target/111350] New: gcc.target/i386/avx512fp16-vfcmulcph-1b.c and friends fail on x86_64-apple-darwin21 fxcoudert at gcc dot gnu.org
2023-09-08 22:29 ` [Bug target/111350] " pinskia at gcc dot gnu.org
2023-09-08 22:32 ` iains at gcc dot gnu.org
2023-09-08 22:33 ` fxcoudert at gcc dot gnu.org
2023-09-08 22:41 ` iains at gcc dot gnu.org
2023-09-08 22:47 ` iains at gcc dot gnu.org
2023-09-09  9:35 ` iains at gcc dot gnu.org
2023-09-09  9:39 ` iains 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).