soft-fp: Support rsigned == 2 in _FP_TO_INT.
commita736ec370a05e4b37e6101eb3168bf8dc4c5af13
authorJoseph Myers <joseph@codesourcery.com>
Thu, 9 Oct 2014 15:00:37 +0000 (9 15:00 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 9 Oct 2014 15:00:37 +0000 (9 15:00 +0000)
tree665968c60d407cb06565ee80c8c2dcc996f42807
parentff12c11f4515a9f83467471e8d4381eb3dbc06b5
soft-fp: Support rsigned == 2 in _FP_TO_INT.

Continuing the addition of soft-fp features in the Linux kernel
version, this patch adds _FP_TO_INT support for rsigned == 2 (reduce
overflowing results modulo 2^rsize to fit in the destination, used for
alpha emulation).

The kernel version is buggy; it can left shift by a negative amount
when right shifting is required in an overflow case (the kernel
version also has other bugs fixed long ago in glibc; at least,
spurious exceptions converting to the most negative integer).  This
version avoids that by handling overflow (other than to 0) for rsigned
== 2 along with the normal non-overflow case, which already properly
determines the direction in which to shift.

Tested for powerpc-nofpu.  Some functions get slightly bigger and some
get slightly smaller, no doubt as a result of the change to where in
the macro "inexact" is raised, but I don't think those changes are
significant.  Also tested for powerpc-nofpu with the relevant __fix*
functions changed to use rsigned == 2 (which is after all just as
valid as rsigned == 1 in IEEE terms), including verifying the results
and exceptions for various cases of conversions.

With these seven patches, the one remaining feature to add for the
soft-fp code to have all the features of the kernel version is
_FP_TO_INT_ROUND.

* soft-fp/op-common.h (_FP_TO_INT): Handle rsigned == 2.
ChangeLog
soft-fp/op-common.h