public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* MIPS tests (nan-legacy.c and nans-legacy.c) failing
@ 2013-07-30 23:27 Steve Ellcey 
  2013-08-07 20:20 ` Richard Sandiford
  0 siblings, 1 reply; 6+ messages in thread
From: Steve Ellcey  @ 2013-07-30 23:27 UTC (permalink / raw)
  To: macro; +Cc: gcc-patches

Maciej,

When I run two of your new tests in gcc.target/mips (nan-legacy.c and
nans-legacy.c), they are failing because my GCC is putting out

	.word	4294967295

instead of 

	.word	-1

like the test is expecting.

I believe they are equivalent (0xffffffff) but I am not sure what it
is about my targets (mips-mti-elf and mips-mti-linux-gnu) that would
make this different from yours.  Should the tests be modified to allow
either output?

Steve Ellcey
sellcey@mips.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS tests (nan-legacy.c and nans-legacy.c) failing
  2013-07-30 23:27 MIPS tests (nan-legacy.c and nans-legacy.c) failing Steve Ellcey 
@ 2013-08-07 20:20 ` Richard Sandiford
  2013-08-13 13:28   ` Maciej W. Rozycki
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2013-08-07 20:20 UTC (permalink / raw)
  To: Steve Ellcey ; +Cc: macro, gcc-patches

"Steve Ellcey " <sellcey@mips.com> writes:
> Maciej,
>
> When I run two of your new tests in gcc.target/mips (nan-legacy.c and
> nans-legacy.c), they are failing because my GCC is putting out
>
> 	.word	4294967295
>
> instead of 
>
> 	.word	-1
>
> like the test is expecting.
>
> I believe they are equivalent (0xffffffff) but I am not sure what it
> is about my targets (mips-mti-elf and mips-mti-linux-gnu) that would
> make this different from yours.  Should the tests be modified to allow
> either output?

Maciej, have you had chance to look at this yet?

Thanks,
Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS tests (nan-legacy.c and nans-legacy.c) failing
  2013-08-07 20:20 ` Richard Sandiford
@ 2013-08-13 13:28   ` Maciej W. Rozycki
  2013-08-13 16:49     ` Steve Ellcey
  2013-08-13 17:25     ` Richard Sandiford
  0 siblings, 2 replies; 6+ messages in thread
From: Maciej W. Rozycki @ 2013-08-13 13:28 UTC (permalink / raw)
  To: Richard Sandiford, Steve Ellcey; +Cc: gcc-patches

On Wed, 7 Aug 2013, Richard Sandiford wrote:

> > When I run two of your new tests in gcc.target/mips (nan-legacy.c and
> > nans-legacy.c), they are failing because my GCC is putting out
> >
> > 	.word	4294967295
> >
> > instead of 
> >
> > 	.word	-1
> >
> > like the test is expecting.
> >
> > I believe they are equivalent (0xffffffff) but I am not sure what it
> > is about my targets (mips-mti-elf and mips-mti-linux-gnu) that would
> > make this different from yours.  Should the tests be modified to allow
> > either output?
> 
> Maciej, have you had chance to look at this yet?

 I've had a look now and that is related to the width of `long' on the 
host -- encode_ieee_double returns its output 32-bit bit patterns in a 
buffer of signed longs.  The arithmetic value of these patterns therefore 
depends on whether the width of `long' is 32 bits or wider.

 Here, in the case of nan-legacy.c, we have:

image_hi <- 0x7ff7ffff
image_lo <- 0xffffffff

so the returned pair of long values will be:

2146959359, -1

on a host where the width of `long' is 32 bits and:

2146959359, 4294967295

on a host where the width of `long' is 64 bits.  Then when supplied as the 
argument to the assembly-language .word pseudo-op, the two sets of values 
produce the same bit patterns in the object file produced.

 It's not clear to me if this dependency on the width of `long' is a bug 
or feature, but a path-of-least-resistance fix is as follows.

 This has passed mips-linux-gnu regression testing on a 32-bit host, but I 
can't regression-test a 64-bit host easily -- Steve, can you please verify 
that this change indeed works for you?  Richard, OK to apply assuming that 
it does?

2013-08-13  Maciej W. Rozycki  <macro@codesourcery.com>

	gcc/testsuite/
	* gcc.target/mips/nan-legacy.c: Accept 4294967295 as an 
	alternative to -1.
	* gcc.target/mips/nans-legacy.c: Likewise.

  Maciej

gcc-mips-nan2008-test-fix.diff
Index: gcc-fsf-trunk-quilt/gcc/testsuite/gcc.target/mips/nan-legacy.c
===================================================================
--- gcc-fsf-trunk-quilt.orig/gcc/testsuite/gcc.target/mips/nan-legacy.c	2013-08-13 14:18:50.008738612 +0100
+++ gcc-fsf-trunk-quilt/gcc/testsuite/gcc.target/mips/nan-legacy.c	2013-08-13 14:22:49.568772451 +0100
@@ -4,4 +4,4 @@
 double d = __builtin_nan ("");
 
 /* { dg-final { scan-assembler "\t\\.nan\tlegacy\n" } } */
-/* { dg-final { scan-assembler "\t\\.word\t2146959359\n\t\\.word\t-1\n" } } */
+/* { dg-final { scan-assembler "\t\\.word\t2146959359\n\t\\.word\t(?:-1|4294967295)\n" } } */
Index: gcc-fsf-trunk-quilt/gcc/testsuite/gcc.target/mips/nans-legacy.c
===================================================================
--- gcc-fsf-trunk-quilt.orig/gcc/testsuite/gcc.target/mips/nans-legacy.c	2013-08-13 14:18:50.008738612 +0100
+++ gcc-fsf-trunk-quilt/gcc/testsuite/gcc.target/mips/nans-legacy.c	2013-08-13 14:22:49.568772451 +0100
@@ -4,4 +4,4 @@
 double ds = __builtin_nans ("");
 
 /* { dg-final { scan-assembler "\t\\.nan\tlegacy\n" } } */
-/* { dg-final { scan-assembler "\t\\.word\t2147483647\n\t\\.word\t-1\n" } } */
+/* { dg-final { scan-assembler "\t\\.word\t2147483647\n\t\\.word\t(?:-1|4294967295)\n" } } */

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS tests (nan-legacy.c and nans-legacy.c) failing
  2013-08-13 13:28   ` Maciej W. Rozycki
@ 2013-08-13 16:49     ` Steve Ellcey
  2013-08-13 17:25     ` Richard Sandiford
  1 sibling, 0 replies; 6+ messages in thread
From: Steve Ellcey @ 2013-08-13 16:49 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Richard Sandiford, gcc-patches

On Tue, 2013-08-13 at 14:28 +0100, Maciej W. Rozycki wrote:

>  This has passed mips-linux-gnu regression testing on a 32-bit host, but I 
> can't regression-test a 64-bit host easily -- Steve, can you please verify 
> that this change indeed works for you?  Richard, OK to apply assuming that 
> it does?

Maciej, the patch does work for me.

Steve Ellcey
sellcey@mips.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS tests (nan-legacy.c and nans-legacy.c) failing
  2013-08-13 13:28   ` Maciej W. Rozycki
  2013-08-13 16:49     ` Steve Ellcey
@ 2013-08-13 17:25     ` Richard Sandiford
  2013-08-13 21:53       ` Maciej W. Rozycki
  1 sibling, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2013-08-13 17:25 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: Steve Ellcey, gcc-patches

"Maciej W. Rozycki" <macro@codesourcery.com> writes:
>  I've had a look now and that is related to the width of `long' on the 
> host -- encode_ieee_double returns its output 32-bit bit patterns in a 
> buffer of signed longs.  The arithmetic value of these patterns therefore 
> depends on whether the width of `long' is 32 bits or wider.
>
>  Here, in the case of nan-legacy.c, we have:
>
> image_hi <- 0x7ff7ffff
> image_lo <- 0xffffffff
>
> so the returned pair of long values will be:
>
> 2146959359, -1
>
> on a host where the width of `long' is 32 bits and:
>
> 2146959359, 4294967295
>
> on a host where the width of `long' is 64 bits.  Then when supplied as the 
> argument to the assembly-language .word pseudo-op, the two sets of values 
> produce the same bit patterns in the object file produced.
>
>  It's not clear to me if this dependency on the width of `long' is a bug 
> or feature, but a path-of-least-resistance fix is as follows.

IMO a bug.  If we're sure 32 bits is enough then we should use "int".
If we're not sure we should use HOST_WIDE_INT.  The only thing using
"long" is going to do is create this kind of weird host dependence.

I can't argue with the path of least resistance though.

> 2013-08-13  Maciej W. Rozycki  <macro@codesourcery.com>
>
> 	gcc/testsuite/
> 	* gcc.target/mips/nan-legacy.c: Accept 4294967295 as an 
> 	alternative to -1.
> 	* gcc.target/mips/nans-legacy.c: Likewise.

OK, thanks.

Richard

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: MIPS tests (nan-legacy.c and nans-legacy.c) failing
  2013-08-13 17:25     ` Richard Sandiford
@ 2013-08-13 21:53       ` Maciej W. Rozycki
  0 siblings, 0 replies; 6+ messages in thread
From: Maciej W. Rozycki @ 2013-08-13 21:53 UTC (permalink / raw)
  To: Richard Sandiford; +Cc: Steve Ellcey, gcc-patches

On Tue, 13 Aug 2013, Richard Sandiford wrote:

> >  I've had a look now and that is related to the width of `long' on the 
> > host -- encode_ieee_double returns its output 32-bit bit patterns in a 
> > buffer of signed longs.  The arithmetic value of these patterns therefore 
> > depends on whether the width of `long' is 32 bits or wider.
> >
> >  Here, in the case of nan-legacy.c, we have:
> >
> > image_hi <- 0x7ff7ffff
> > image_lo <- 0xffffffff
> >
> > so the returned pair of long values will be:
> >
> > 2146959359, -1
> >
> > on a host where the width of `long' is 32 bits and:
> >
> > 2146959359, 4294967295
> >
> > on a host where the width of `long' is 64 bits.  Then when supplied as the 
> > argument to the assembly-language .word pseudo-op, the two sets of values 
> > produce the same bit patterns in the object file produced.
> >
> >  It's not clear to me if this dependency on the width of `long' is a bug 
> > or feature, but a path-of-least-resistance fix is as follows.
> 
> IMO a bug.  If we're sure 32 bits is enough then we should use "int".
> If we're not sure we should use HOST_WIDE_INT.  The only thing using
> "long" is going to do is create this kind of weird host dependence.

 Since encode_ieee_double will always return 32-bit chunks I think these 
days this should really use explicit `int32_t' rather than `long' or 
trying to guess what `int' or HOST_WIDE_INT might be.  The type can be 
easily autoconf'ed if missing on pre-C99 hosts.

 Of course all the real.c handlers would have to be reviewed and adjusted 
accordingly, as would the callers, e.g. assemble_real in varasm.c which is 
where the buffer in this particular case comes from (`data').

> > 	gcc/testsuite/
> > 	* gcc.target/mips/nan-legacy.c: Accept 4294967295 as an 
> > 	alternative to -1.
> > 	* gcc.target/mips/nans-legacy.c: Likewise.
> 
> OK, thanks.

 Thanks for review, applied.  Steve, thanks for verifying.

  Maciej

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-13 21:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30 23:27 MIPS tests (nan-legacy.c and nans-legacy.c) failing Steve Ellcey 
2013-08-07 20:20 ` Richard Sandiford
2013-08-13 13:28   ` Maciej W. Rozycki
2013-08-13 16:49     ` Steve Ellcey
2013-08-13 17:25     ` Richard Sandiford
2013-08-13 21:53       ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).