This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/27682] float to int conversion doesn't raise invalid exception



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]