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

            Bug ID: 109174
           Summary: incorrect intrinsic signature for AVX-512 srai*
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: malat at debian dot org
  Target Milestone: ---

gcc-13 currently rejects the following:

% /usr/lib/gcc-snapshot/bin/gcc -c -Wsign-conversion -Werror  -mavx512bw -O2
tu2.c
tu2.c: In function 'foo':
tu2.c:7:24: error: conversion to 'int' from 'unsigned int' may change the sign
of the result [-Werror=sign-conversion]
    7 |   _mm512_slli_epi16(a, bar());
      |                        ^~~~~
tu2.c:8:24: error: conversion to 'int' from 'unsigned int' may change the sign
of the result [-Werror=sign-conversion]
    8 |   _mm512_srai_epi16(a, bar());
      |                        ^~~~~
tu2.c:9:24: error: conversion to 'int' from 'unsigned int' may change the sign
of the result [-Werror=sign-conversion]
    9 |   _mm512_srli_epi16(a, bar());
      |                        ^~~~~
cc1: all warnings being treated as errors

with

% cat tu2.c
#include <immintrin.h>

extern unsigned int bar();

void foo(__m512i a)
{
  _mm512_slli_epi16(a, bar());
  _mm512_srai_epi16(a, bar());
  _mm512_srli_epi16(a, bar());
}

intel documentation declares it as unsigned int

https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-8/intrinsics-for-shift-operations.html

[...]
__m512i _mm512_slli_epi16(__m512i a, unsigned int imm)
[...]

% /usr/lib/gcc-snapshot/bin/gcc --version
gcc (Debian 20230315-1) 13.0.1 20230315 (experimental) [master
r13-6680-ga9ae16db8cb]

Reply via email to