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

--- Comment #4 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---
Nothing fancy at all, no arch-specific flags.

$ gcc-7-20170226 -v
Using built-in specs.
COLLECT_GCC=.../bin/gcc
COLLECT_LTO_WRAPPER=.../lib/gcc/x86_64-pc-linux-gnu/7.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure --enable-languages=c,c++,fortran,lto
--enable-checking=yes --disable-bootstrap --disable-multilib
Thread model: posix
gcc version 7.0.1 20170226 (experimental) (GCC)


How about this reduction ?

$ cat z1.c
typedef unsigned short __mmask16;

extern __inline int
__attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
_mm512_kortestc (__mmask16 __A, __mmask16 __B)
{
  return (__mmask16) __builtin_ia32_kortestchi ((__mmask16) __A,
                                                (__mmask16) __B);
}

void
avx512f_test ()
{
  volatile __mmask16 k1 = 0;
  __mmask16 k2 = 0;
  volatile short r;
  r = _mm512_kortestc (k1, k2);
}


$ gcc-7-20170226 -O0 -mavx512f -c z1.c
$ gcc-7-20170226 -O2 -mavx512f -c z1.c
z1.c: In function 'avx512f_test':
z1.c:7:10: internal compiler error: in int_mode_for_mode, at stor-layout.c:406
   return (__mmask16) __builtin_ia32_kortestchi ((__mmask16) __A,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       (__mmask16) __B);
       ~~~~~~~~~~~~~~~~
0xbe8a9f int_mode_for_mode(machine_mode)
        ../../gcc/stor-layout.c:406
0x8bccae emit_move_via_integer
        ../../gcc/expr.c:3289
0x8c9a7a emit_move_insn_1(rtx_def*, rtx_def*)
        ../../gcc/expr.c:3670
0x8c9dd4 emit_move_insn(rtx_def*, rtx_def*)
        ../../gcc/expr.c:3738
0x8ad0f2 copy_to_reg(rtx_def*)
        ../../gcc/explow.c:585
0xf6d4d1 ix86_expand_builtin
        ../../gcc/config/i386/i386.c:37800
0x793606 expand_builtin(tree_node*, rtx_def*, rtx_def*, machine_mode, int)
        ../../gcc/builtins.c:6362
0x8c5a14 expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ../../gcc/expr.c:10810
0x8d1be6 store_expr_with_bounds(tree_node*, rtx_def*, int, bool, bool,
tree_node*)
        ../../gcc/expr.c:5552
0x8d37d0 expand_assignment(tree_node*, tree_node*, bool)
        ../../gcc/expr.c:5321
0x7b7cfa expand_call_stmt
        ../../gcc/cfgexpand.c:2656
0x7b7cfa expand_gimple_stmt_1
        ../../gcc/cfgexpand.c:3571
0x7b7cfa expand_gimple_stmt
        ../../gcc/cfgexpand.c:3737
0x7b998e expand_gimple_basic_block
        ../../gcc/cfgexpand.c:5744
0x7bfa56 execute
        ../../gcc/cfgexpand.c:6357


---

BTW, these variants (w/o "volatile") compile :

// ...
void
avx512f_test ()
{
  volatile __mmask16 k1 = 0;
  volatile __mmask16 k2 = 0;
  volatile short r;
  r = _mm512_kortestc (k1, k2);
}

// ...
void
avx512f_test ()
{
  volatile __mmask16 k1 = 0;
  __mmask16 k2 = 0;
  short r;
  r = _mm512_kortestc (k1, k2);
}

Reply via email to