This is the mail archive of the gcc-patches@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: PATCH: real.c cross 64bit -> 32bit portability


Any news with this? 

On Thu, 23 Oct 2003 00:11:47 -0500 (CDT)
Loren James Rittle <rittle@latour.rsch.comm.mot.com> wrote:

> I am passing this patch on for real.c expert opinion.  The trick is
> that a bit-field r->sign undergoes promotion from 'unsigned int :1' to
> 'signed int' since 31 is signed with greater range.  On the 3.3
> branch, "GCC cross-compiler running on AMD64 64bit host [to i386
> target; forced with -mcpu switch] will output the following incorrect
> assembly instruction which causes as(1) to choke:
> 
> movl    $0xffffffffbfc90fdb, %eax
> 
> while native compiler outputs
> 
> movl    $0xbfc90fdb, %eax" (from Alexander Kabaev)
> 
> May this be installed on mainline and 3.3 branch?  As an alternate, it
> is a one-line cast (appears to be used in the local file).
> 
> 	* real.c (encode_ieee_single): Ensure proper promotion.
> 
> Index: real.c
> ===================================================================
> RCS file: /home/ncvs/src/contrib/gcc/real.c,v
> retrieving revision 1.1.1.6
> diff -u -r1.1.1.6 real.c
> --- real.c	11 Jul 2003 03:40:49 -0000	1.1.1.6
> +++ real.c	21 Oct 2003 21:05:31 -0000
> @@ -2612,9 +2612,10 @@
>       const REAL_VALUE_TYPE *r;
>  {
>    unsigned long image, sig, exp;
> +  unsigned long sign = r->sign;
>    bool denormal = (r->sig[SIGSZ-1] & SIG_MSB) == 0;
>  
> -  image = r->sign << 31;
> +  image = sign << 31;
>    sig = (r->sig[SIGSZ-1] >> (HOST_BITS_PER_LONG - 24)) & 0x7fffff;
>  
>    switch (r->class)


-- 
Alexander Kabaev


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