Bug 12749 - i386 LP64 bug.
Summary: i386 LP64 bug.
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.0
Assignee: Andrew Pinski
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2003-10-23 20:41 UTC by matt
Modified: 2003-12-20 21:57 UTC (History)
1 user (show)

See Also:
Host: x86_64--netbsd
Target: i386--netbsdelf
Build: x86_64--netbsd
Known to work:
Known to fail:
Last reconfirmed: 2003-10-23 20:48:34


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description matt 2003-10-23 20:41:07 UTC
The attached program will emit assembly that gas will complain about:
e_sinhf.s:134: Error: missing or invalid immediate expression 
`0xffffffffbf000000' taken as 0
e_sinhf.s:134: Error: suffix or operands invalid for `mov'

--- i386.c      18 Oct 2003 11:10:38 -0000      1.1.1.2
+++ i386.c      23 Oct 2003 20:39:10 -0000
@@ -7076,21 +7076,21 @@
   else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == SFmode)
     {
       REAL_VALUE_TYPE r;
       long l;
 
       REAL_VALUE_FROM_CONST_DOUBLE (r, x);
       REAL_VALUE_TO_TARGET_SINGLE (r, l);
 
       if (ASSEMBLER_DIALECT == ASM_ATT)
        putc ('$', file);
-      fprintf (file, "0x%lx", l);
+      fprintf (file, "0x%lx", l & 0xffffffff);
     }
 
  /* These float cases don't actually occur as immediate operands.  */
  else if (GET_CODE (x) == CONST_DOUBLE && GET_MODE (x) == DFmode)
     {
       char dstr[30];
 
       real_to_decimal (dstr, CONST_DOUBLE_REAL_VALUE (x), sizeof (dstr), 0, 1);
       fprintf (file, "%s", dstr);
     }





float fabsf (float);
typedef int __int32_t;
typedef unsigned int __uint32_t;
typedef union
{
  float value;
  __uint32_t word;
} ieee_float_shape_type;
extern float __ieee754_expf (float);
extern float __ieee754_sinhf (float);
static const float one = 1.0, shuge = 1.0e37;
float
__ieee754_sinhf(float x)
{
        float t,w,h;
        __int32_t ix,jx;
        do { ieee_float_shape_type gf_u; gf_u.value = (x); (jx) = gf_u.word; } w
hile (0);
        ix = jx&0x7fffffff;
        if(ix>=0x7f800000) return x+x;
        h = 0.5;
        if (jx<0) h = -h;
        if (ix < 0x41b00000) {
            if (ix<0x31800000)
                if(shuge+x>one) return x;
            t = expm1f(fabsf(x));
            if(ix<0x3f800000) return h*((float)2.0*t-t*t/(t+one));
            return h*(t+t/(t+one));
        }
        if (ix < 0x42b17180) return h*__ieee754_expf(fabsf(x));
        if (ix<=0x42b2d4fc) {
            w = __ieee754_expf((float)0.5*fabsf(x));
            t = h*w;
            return t*w;
        }
        return x*shuge;
}
Comment 1 Andrew Pinski 2003-10-23 20:48:34 UTC
Agree, but always send your patches to gcc-patches@ first.
Comment 2 Andrew Pinski 2003-12-20 08:28:34 UTC
This is an obvious patch I will apply it later today.
Comment 3 GCC Commits 2003-12-20 21:56:55 UTC
Subject: Bug 12749

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pinskia@gcc.gnu.org	2003-12-20 21:56:48

Modified files:
	gcc            : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/config/i386: i386.c 
Added files:
	gcc/testsuite/gcc.c-torture/compile: 20031220-2.c 

Log message:
	2003-12-20  Andrew Pinski  <pinskia@gcc.gnu.org>
	Matt Thomas  <matt@3am-software.com>
	
	PR target/12749
	* config/i386/i386.c (print_operand): Print only the first
	8 characters of the float in hex.
	
	2003-12-20  Andrew Pinski  <pinskia@gcc.gnu.org>
	
	PR target/12749
	* gcc.c-torture/compile/20031220-2.c: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2062&r2=2.2063
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3292&r2=1.3293
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.c-torture/compile/20031220-2.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.624&r2=1.625

Comment 4 Andrew Pinski 2003-12-20 21:57:24 UTC
Fixed.