This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/27682] float to int conversion doesn't raise invalid exception
- From: "amodra at bigpond dot net dot au" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 May 2006 02:48:04 -0000
- Subject: [Bug target/27682] float to int conversion doesn't raise invalid exception
- References: <bug-27682-4503@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from amodra at bigpond dot net dot au 2006-05-29 02:48 -------
Note that fctidz is used because we are converting to unsigned. gcc uses
fctiwz if converting to int. Of course, it isn't correct to simply replace
fctidz with fctiwz.. To get this right, gcc would need to generate something
like the following
fctidz 0,0
stfd 0,temp_slot(1)
ld 9,temp_slot(1)
rldicl 0,9,0,32
cmpd 0,9
beq .+8
mtfsb1 23
with the last three insns being the extras needed to set the invalid operation.
Conversion to unsigned int on ppc32 will also need some tweaks.
Hmm, there we are using code generated by optabs.c (search for comment "For an
unsigned conversion, there is one more way to do it.") Why doesn't this code
always subtract off 2**(n-1), convert, then add 2**(n-1)? That way we'd get
the invalid op bits set correctly.
--
amodra at bigpond dot net dot au changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |amodra at bigpond dot net
| |dot au
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-05-29 02:48:03
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27682