[PATCH] SPU float format: Extended exponent range

Richard Guenther richard.guenther@gmail.com
Fri Aug 15 19:24:00 GMT 2008


On Mon, Aug 4, 2008 at 9:39 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Mon, Aug 4, 2008 at 9:27 PM, Ulrich Weigand <uweigand@de.ibm.com> wrote:
>> Hello,
>>
>> a while back, Trevor started a discussion on making GCC compile-time
>> arithmetic respect the not-quite-IEEE single-precision floating-point
>> format on the SPU.  Unfortunately, this didn't in the end result in
>> anything being committed to mainline.  Here's a link to the last patch:
>> http://gcc.gnu.org/ml/gcc-patches/2007-09/msg00540.html
>>
>> I'd like to take this up again.  Instead of one big patch, I hope to
>> make mainline inclusion more straightforward by proposing a series
>> of smaller patches, each addressing a particular feature.
>>
>> This first patch introduces a new real_format structure to describe
>> the SPU single-precision format.  It handles the extended exponent
>> range (biased exponent of 255 denotes regular numbers, not Inf or Nan
>> values).
>>
>> One interesting feature of SPU floating point is that the single->
>> double and double->single conversion instructions simply ignore the
>> fact that the single-precision format is not IEEE.  This means that
>> after introducing the new format, common code no longer correctly
>> models those instructions.  At some later time, we might want to
>> add back specical knowledge of those conversions; for now this patch
>> simply switches the back-end to use UNSPECs for those instructions.
>>
>> The common code changes are straightforward, but they exposed a bug
>> in spu_split_immediate where bit-wise operation on parts of floating-
>> point constants was peformed in SFmode.  This breaks when the pieces
>> by themselves are not valid in the given floating-point format.  In
>> another case of the switch this was already addressed by doing the
>> bit-wise operation in an integral mode instead.  This patch extends
>> that to the second case of that switch ...
>>
>> In addition, the change exposed another testcase that used
>> _builtin_inff -- this doesn't work on SPU because the format does
>> not support infinity.  The patch disables that testcase (just like
>> similar testcases were disabled).
>>
>> Tested on spu-elf on mainline and 4.3 branch.  OK to commit?
>
> The middle-end parts are ok for the mainline.

Also ok for the branch.

Richard.



More information about the Gcc-patches mailing list