https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117547
Bug ID: 117547
Summary: FAIL: gcc.target/i386/*-pr93673.c without
TARGET_PROMOTE_PROTOTYPES
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: hjl.tools at gmail dot com
CC: liuhongt at gcc dot gnu.org, rguenth at gcc dot gnu.org,
uros at gcc dot gnu.org
Target Milestone: ---
Target: x86
On i386, when TARGET_PROMOTE_PROTOTYPES is undefined, the C frontend doesn't
promote char/short argument to int, I got
FAIL: gcc.target/i386/avx512bw-pr93673.c (test for excess errors)
FAIL: gcc.target/i386/avx512dq-pr93673.c (test for excess errors)
FAIL: gcc.target/i386/avx512f-pr93673.c (test for excess errors)
$ cat /tmp/x.c
#include <x86intrin.h>
void
foo (__mmask32 *c, __mmask64 *d)
{
d[8] = _kshiftli_mask64 (d[8], 0xff);
}
$ ./xgcc -B./
-B/export/build/gnu/tools-build/gcc-gitlab-debug/build-x86_64-linux/gcc/
/tmp/x.c -fdiagnostics-plain-output -O2 -mavx512bw -S
In file included from ./include/immintrin.h:61,
from ./include/x86intrin.h:32,
from /tmp/x.c:1:
In function ‘_kshiftli_mask64’,
inlined from ‘foo’ at /tmp/x.c:6:10:
./include/avx512bwintrin.h:2846:10: error: the last argument must be an 8-bit
immediate
$
When passing 0xff as an unsigned char function argument, the C frontend
promotion will promote it to int:
<integer_cst 0x7fffe6aa23a8 type <integer_type 0x7fffe98225e8 int> constant
255>
and expand_normal always returns the rtx value using the sign-extended
representation,
(const_int 255 [0xff])
If the C frontend doesn't promote unsigned char to int, expand_normal will
get
<integer_cst 0x7fffe9824018 type <integer_type 0x7fffe9822348 unsigned char >
co
nstant 255>
and return
(const_int -1 [0xffffffffffffffff])