This is the mail archive of the gcc@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]

Re: A few questions on XFmode for x86


> i386-modes.def has
> 
> ---
> /* In ILP32 mode, XFmode has size 12 and alignment 4.
>    In LP64 mode, XFmode has size and alignment 16.  */
> ADJUST_FLOAT_FORMAT (XF, (TARGET_128BIT_LONG_DOUBLE
>                           ? &ieee_extended_intel_128_format
>                           : TARGET_96_ROUND_53_LONG_DOUBLE
>                           ? &ieee_extended_intel_96_round_53_format
>                           : &ieee_extended_intel_96_format));
> ADJUST_BYTESIZE  (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 12);
> ADJUST_ALIGNMENT (XF, TARGET_128BIT_LONG_DOUBLE ? 16 : 4);
> ---
> 
> The comment don't match the code.  XFmode is independent of ILP32
> and LP64.  However, in i386.h, there is

TARGET_128BIT_LONG_DOUBLE is default in 64bit mode and disabled in
32bit, see unix.h. So transitively the comment is correct but it
probably should comment that in 32bit mode 128bit alignment is possible.
> 
> /* Decide whether a variable of mode MODE should be 128 bit aligned.  */
> #define ALIGN_MODE_128(MODE) \
>  ((MODE) == XFmode || SSE_REG_MODE_P (MODE))
> 
> What is the real alignment of XFmode in ILP32 mode?

It is 4 byte with size of 12 per i386 psABI. We however take care to
increase the alginment whenever possible in non-ABI breaking way. 16
byte aligned long double is faster. So as simple local or static
variables and spill slots should be 16byte aligned, in arrays and
fileds, it should be 4 byte aligned.
> 
> According to i386 and x86-64 psABIs,  in LP32 mode, XFmode has
> size 12 and alignment 4 and in LP64 mode, XFmode has size and
> alignment 16. It doesn't make senses to have XFmode of size 12
> and alignment 16 in ILP32 mode since it doesn't work with array
> of XFmode.
> 
> 
> H.J.


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