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

            Bug ID: 121437
           Summary: Issues seen in gcc/testsuite/jit/test-types.c with
                    bfloat16 support
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: jit
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
                CC: antoyo at gcc dot gnu.org
  Target Milestone: ---

test-types.c seems to have been broken by r15-1863-g1c314247aab43a:

which added:

  #include <immintrin.h>

and:

  #ifdef HAVE_BFmode
    CHECK_VALUE (gcc_jit_type_get_size (gcc_jit_context_get_type (ctxt,
GCC_JIT_TYPE_BFLOAT16)), sizeof (__bfloat16));
  #endif

to the test.

This fails on e.g. aarch64 with:

  rpmbuild/BUILD/gcc-15.1.1-20250521/gcc/testsuite/jit.dg/test-types.c:1:10:
fatal error: immintrin.h: No such file or directory


immintrin.h only exists for x86 and ppc:

$ find -name immintrin.h
./gcc/config/i386/immintrin.h
./gcc/config/rs6000/immintrin.h

but does appear to be the correct place to get __bfloat16 from; it's defined
here:

gcc/config/i386/avx512bf16vlintrin.h:typedef __bf16 __bfloat16;

where that header has:

#ifndef _IMMINTRIN_H_INCLUDED
#error "Never use <avx512bf16vlintrin.h> directly; include <immintrin.h>
instead."
#endif

Additionally, I don't think that HAVE_BFmode is meant to be "visible" to
libgccjit client code:

$ git grep HAVE_BFmode
gcc/jit/jit-playback.cc:#ifndef HAVE_BFmode
gcc/jit/jit-recording.cc:#ifdef HAVE_BFmode
gcc/testsuite/jit.dg/test-types.c:#ifdef HAVE_BFmode
gcc/tree.cc:#ifdef HAVE_BFmode

e.g. on x86_64 it's in the generated BUILD/gcc/insn-modes.h which I don't think
is visible to libgccjit.h

Checking the test logs shows that the test guarded with #ifdef HAVE_BFmode is
indeed being discarded by the preprocessor.

In summary, it looks like:
 * that commit broke test-types.c for all archs except: x86 and ppc
 * the test coverage for bfloat16 that was attempted to be added by that commit
is accidentally disabled on all archs

Reply via email to