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}
        ^

Reply via email to