On 9/28/19 8:14 PM, Oleg Endo wrote:
> Hi,
> 
> I've been dragging this patch along with me for a while.
> At the moment, I don't have the resources to fully test it as requested
> by Ian in the PR discussion.
> 
> So I would like to ask for general comments on this one and hope that
> folks with bigger automated test setups can run the patch through their
> machinery for little endian targets.
> 
> 
> Summary of the story:
> 
> I've noticed this issue on the RX on GCC 6, but it seems it's been
> there forever.
> 
> On RX, fp-bit is used for software floating point emulation.  The RX
> target also uses "MS bit-field" layout by default.  This means that
> code like
> 
> struct
> {
>   fractype fraction:FRACBITS __attribute__ ((packed));
>   unsigned int exp:EXPBITS __attribute__ ((packed));
>   unsigned int sign:1 __attribute__ ((packed));
> } bits;
> 
> will result in sizeof (bits) != 8
> 
> For some reason, this bit-field style declaration is used only for
> FLOAT_BIT_ORDER_MISMATCH, which generally seems to be set for little
> endian targets.  In other cases (i.e. big endian) open coded bit field
> extraction and packing is used on the base integer type, like
> 
>  fraction = src->value_raw & ((((fractype)1) << FRACBITS) - 1);
>  exp = ((int)(src->value_raw >> FRACBITS)) & ((1 << EXPBITS) - 1);
>  sign = ((int)(src->value_raw >> (FRACBITS + EXPBITS))) & 1;
> 
> This works of course regardless of the bit-field packing layout of the
> target.
> 
> Joseph suggested to pack the struct bit, which would fix the issue.  
> https://gcc.gnu.org/ml/gcc-bugs/2017-08/msg01651.html
> 
> However, I would like to propose to remove the special case of
> FLOAT_BIT_ORDER_MISMATCH altogether as in the attached patch.
> 
> Any comments?
So probably the most interesting target for this test is v850-elf as
it's got a reasonably well functioning simulator, hard and soft FP
targets, little endian, and I'm familiar with its current set of failures.

I can confirm that your patch makes no difference in the test results
(which includes execution results).

In fact, there haven't been any problems on any target in my tester that
I can tie back to this change.

At this point I'd say let's go for it.

jeff


> 
> Cheers,
> Oleg
> 
> 
> 
> libgcc/ChangeLog
> 
>       PR libgcc/77804
>       * fp-bit.h: Remove FLOAT_BIT_ORDER_MISMATCH.
>       * fp-bit.c (pack_d, unpack_d): Remove special cases for 
>       FLOAT_BIT_ORDER_MISMATCH.
>       * config/arc/t-arc: Remove FLOAT_BIT_ORDER_MISMATCH.
> 

Reply via email to