[Bug target/84154] New: PowerPC GCC 7 and 8 have regression in converting fp to short/char and returning it
meissner at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 31 20:24:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84154
Bug ID: 84154
Summary: PowerPC GCC 7 and 8 have regression in converting fp
to short/char and returning it
Product: gcc
Version: 8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: meissner at gcc dot gnu.org
Target Milestone: ---
In preparing to close target/79038, I decided to run some tests. I discovered
that both GCC 8 and GCC 7 regress compared to GCC 6 if you have a function that
returns a short/char value and the value is converted from floating point when
you are compiling for a target with direct move (i.e. power8/power9).
In particular, if you have a function of the form:
unsigned char d2u (double x) { return x; }
it will generate the following code for power8:
fctiwuz 0,1
mfvsrwz 9,0
stw 9,-16(1)
ori 2,2,0
lbz 3,-16(1)
blr
I.e., it will generate a store and then a load. GCC 6 would just do the zero
extend inline: fctiwuz 1,1
mfvsrd 3,1
rlwinm 3,3,0,0xff
blr
For -mcpu=power8, the following combinations generate store/load (double to
signed char is ok):
double -> unsigned char
double -> unsigned short
double -> signed short
For -mcpu=power9, the following combinations generate store/load (double to all
char/short is ok, also _Float128 to signed char is ok):
_Float128 -> unsigned char
_Float128 -> unsigned short
_Float128 -> signed short
More information about the Gcc-bugs
mailing list