This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: _Fract types and conversion routines
- From: Steve Ellcey <sellcey at imgtec dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: GCC Development <gcc at gcc dot gnu dot org>
- Date: Wed, 28 Oct 2015 09:49:39 -0700
- Subject: Re: _Fract types and conversion routines
- Authentication-results: sourceware.org; auth=none
- References: <8ea17595-285a-4062-bb85-bf6d6a3b56e6 at BAMAIL02 dot ba dot imgtec dot org> <CAFiYyc0bG0J=ZxzoNTc18BmNKQnQQ9yb=SaMtixQ2nMv8Gj+dA at mail dot gmail dot com> <1446050092 dot 2982 dot 100 dot camel at ubuntu-sellcey>
- Reply-to: <sellcey at imgtec dot com>
You can ignore that last email. I think I finally found where the
problem is. In the main program:
extern void abort (void);
int main ()
{
signed char a = -1;
_Sat unsigned _Fract b = a;
if (b != 0.0ur)
abort();
return 0;
}
If I compile with -O0, I see:
li $2,-1 # 0xffffffffffffffff
sb $2,24($fp)
lbu $4,24($fp)
jal __satfractqiuhq
We put -1 in register $2, store the byte, then load the byte as an
unsigned char instead of a signed char. When TARGET_PROMOTE_PROTOTYPES
was defined it didn't matter because __satfractqiuhq did another sign
extend before using the value. When I got rid of
TARGET_PROMOTE_PROTOTYPES, that extra sign extend went away and the fact
that we are doing a 'lbu' unsigned load instead of a 'lb' signed byte
load triggered the bug. Now I just need to find out why we are doing an
lbu instead of an lb.
Steve Ellcey
sellcey@imgtec.com