Revision 146874:

http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01518.html

breaks %z on x87 insns:

[...@gnu-16 float-1]$ cat foo.c
#define fp_to_int(func,ftype,itype) \
itype \
__attribute__((noinline)) \
func (ftype value) \
{ \
  itype res; \
  __asm__ __volatile__ ("fistp%z0 %0" : "=m" (res) : "t" (value) : "st"); \
  return res; \
}

#define int_to_fp(func,itype,ftype) \
ftype \
__attribute__((noinline)) \
func (itype value) \
{ \
  ftype res; \
  __asm__ __volatile__ ("fild%z1 %1" : "=t" (res) : "m" (value)); \
  return res; \
}

fp_to_int (float_to_short, float, short);
fp_to_int (float_to_int, float, int);
fp_to_int (float_to_long_long, float, long long);

int_to_fp (short_to_float, short, float);
int_to_fp (int_to_float, int, float);
int_to_fp (long_long_to_float, long long, float);

extern void abort (void);

int
main ()
{
  float f = -2.0;
  short s = float_to_short (f);
  int i = float_to_int (f);
  long long l = float_to_long_long (f);

  if (f != short_to_float (s)
      || f != int_to_float (i)
      || f != long_long_to_float (i))
    abort ();
  return 0;
}
[...@gnu-16 float-1]$ make
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -o foo -O2 -m32 foo.c
foo.c: Assembler messages:
foo.c:21: Error: suffix or operands invalid for `fistp'
foo.c:25: Error: suffix or operands invalid for `fild'
make: *** [foo] Error 1
[...@gnu-16 float-1]$


-- 
           Summary: [4.5 regression] Revision 146874 breaks %z on x87 insns
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39949

Reply via email to