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

            Bug ID: 107863
           Summary: ICE with unrecognizable insn when using
                    -funsigned-char with some AVX builtins
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bouanto at zoho dot com
  Target Milestone: ---

Hi.
When I compile the following code:

#include <immintrin.h>

int main(int argc, char* argv[]) {
    __m256i a = _mm256_set1_epi8(4);
    __m256i b = _mm256_set1_epi8(2);
    __m256i mask = _mm256_insert_epi8(_mm256_set1_epi8(0), -1, 2);
    __m256i r = (__m256i) __builtin_ia32_pblendvb256 ((__v32qi)a, (__v32qi)b,
(__v32qi)mask);
    return 0;
}

with the following command:

gcc main.c -o main -mavx512f -funsigned-char

I get the following error:

main.c: In function ‘main’:
main.c:9:1: error: unrecognizable insn:
    9 | }
      | ^
(insn 655 654 656 2 (set (reg:QI 607)
        (const_int 255 [0xff])) "main.c":6:20 -1
     (nil))
during RTL pass: vregs
main.c:9:1: internal compiler error: in extract_insn, at recog.cc:2791
0x1840d78 internal_error(char const*, ...)
        ???:0
0x62a3ac fancy_abort(char const*, int, char const*)
        ???:0
0x60555b _fatal_insn(char const*, rtx_def const*, char const*, int, char
const*)
        ???:0
0x60557d _fatal_insn_not_found(rtx_def const*, char const*, int, char const*)
        ???:0

The code compiles when not using -funsigned-char.

I'm not sure what would be the fix for this. Would it make sense that builtins
never use the char type, but instead use either unsigned char or signed char?

Reply via email to