public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c
@ 2013-04-08  9:37 James Greenhalgh
  2013-04-19 10:01 ` James Greenhalgh
       [not found] ` <CACxje5_Tp0an2rRwyUWKsqdE9vMOwDxfkSgGYTiankAH0bQLFQ@mail.gmail.com>
  0 siblings, 2 replies; 5+ messages in thread
From: James Greenhalgh @ 2013-04-08  9:37 UTC (permalink / raw)
  To: libffi-discuss

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]


Hi,

A recent patch fixed libffi.call/many.c to check that the absolute
value of the difference of its two test results was smaller than FLT_EPSILON,
rather than just checking their difference.

Sadly, this exposes a problem with the testcase for targets with
a fused-multiply-add instruction. After inlining the non-ffi function
body, GCC will happily contract the final multiply with the subtract
for the comparison. Thus skipping the rounding step after the multiply
and causing an error large enough to cause the test to fail.

Fixed by adding -ffp-contract=off to the list of dg-options thus
suppressing the introduction of fused-multiply-add.

Tested on aarch64-none-linux-gnu to ensure the failure becomes
a pass.

Thanks,
James Greenhalgh

---

2013-04-08  James Greenhalgh  <james.greenhalgh@arm.com>

	* testsuite/libffi.call/many.c: Set -ffp-contract=off.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-libffi-testsuite-Set-ffp-contract-off-for-libffi.cal.patch --]
[-- Type: text/x-patch;  name=0001-libffi-testsuite-Set-ffp-contract-off-for-libffi.cal.patch, Size: 358 bytes --]

diff --git a/testsuite/libffi.call/many.c b/testsuite/libffi.call/many.c
index 67a367f..afade91 100644
--- a/testsuite/libffi.call/many.c
+++ b/testsuite/libffi.call/many.c
@@ -5,6 +5,8 @@
    Originator:	From the original ffitest.c  */
 
 /* { dg-do run } */
+/* { dg-options -ffp-contract=off } */
+
 #include "ffitest.h"
 
 #include <stdlib.h>

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

* RE: [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c
  2013-04-08  9:37 [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c James Greenhalgh
@ 2013-04-19 10:01 ` James Greenhalgh
  2013-05-09 12:59   ` James Greenhalgh
       [not found] ` <CACxje5_Tp0an2rRwyUWKsqdE9vMOwDxfkSgGYTiankAH0bQLFQ@mail.gmail.com>
  1 sibling, 1 reply; 5+ messages in thread
From: James Greenhalgh @ 2013-04-19 10:01 UTC (permalink / raw)
  To: James Greenhalgh, libffi-discuss; +Cc: 'Anthony Green'

*ping*

> -----Original Message-----
> From: James Greenhalgh
> Sent: 08 April 2013 10:37
> To: libffi-discuss@sourceware.org
> Subject: [libffi testsuite] Set -ffp-contract=off for
> libffi.call/many.c
> 
> 
> Hi,
> 
> A recent patch fixed libffi.call/many.c to check that the absolute
> value of the difference of its two test results was smaller than
> FLT_EPSILON,
> rather than just checking their difference.
> 
> Sadly, this exposes a problem with the testcase for targets with
> a fused-multiply-add instruction. After inlining the non-ffi function
> body, GCC will happily contract the final multiply with the subtract
> for the comparison. Thus skipping the rounding step after the multiply
> and causing an error large enough to cause the test to fail.
> 
> Fixed by adding -ffp-contract=off to the list of dg-options thus
> suppressing the introduction of fused-multiply-add.
> 
> Tested on aarch64-none-linux-gnu to ensure the failure becomes
> a pass.
> 
> Thanks,
> James Greenhalgh
> 
> ---
> 
> 2013-04-08  James Greenhalgh  <james.greenhalgh@arm.com>
> 
> 	* testsuite/libffi.call/many.c: Set -ffp-contract=off.




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

* RE: [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c
  2013-04-19 10:01 ` James Greenhalgh
@ 2013-05-09 12:59   ` James Greenhalgh
  0 siblings, 0 replies; 5+ messages in thread
From: James Greenhalgh @ 2013-05-09 12:59 UTC (permalink / raw)
  To: James Greenhalgh, libffi-discuss; +Cc: 'Anthony Green'

*ping^2*

(Can we still submit patches via this list, or does there need to
be a pull request?)

Thanks,
James

> -----Original Message-----
> From: James Greenhalgh
> Sent: 19 April 2013 11:02
> To: James Greenhalgh; libffi-discuss@sourceware.org
> Cc: 'Anthony Green'
> Subject: RE: [libffi testsuite] Set -ffp-contract=off for
> libffi.call/many.c
> 
> *ping*
> 
> > -----Original Message-----
> > From: James Greenhalgh
> > Sent: 08 April 2013 10:37
> > To: libffi-discuss@sourceware.org
> > Subject: [libffi testsuite] Set -ffp-contract=off for
> > libffi.call/many.c
> >
> >
> > Hi,
> >
> > A recent patch fixed libffi.call/many.c to check that the absolute
> > value of the difference of its two test results was smaller than
> > FLT_EPSILON,
> > rather than just checking their difference.
> >
> > Sadly, this exposes a problem with the testcase for targets with
> > a fused-multiply-add instruction. After inlining the non-ffi function
> > body, GCC will happily contract the final multiply with the subtract
> > for the comparison. Thus skipping the rounding step after the
> multiply
> > and causing an error large enough to cause the test to fail.
> >
> > Fixed by adding -ffp-contract=off to the list of dg-options thus
> > suppressing the introduction of fused-multiply-add.
> >
> > Tested on aarch64-none-linux-gnu to ensure the failure becomes
> > a pass.
> >
> > Thanks,
> > James Greenhalgh
> >
> > ---
> >
> > 2013-04-08  James Greenhalgh  <james.greenhalgh@arm.com>
> >
> > 	* testsuite/libffi.call/many.c: Set -ffp-contract=off.
> 
> 
>
> diff --git a/testsuite/libffi.call/many.c b/testsuite/libffi.call/many.c
> index 67a367f..afade91 100644
> --- a/testsuite/libffi.call/many.c
> +++ b/testsuite/libffi.call/many.c
> @@ -5,6 +5,8 @@
>     Originator:	From the original ffitest.c  */
>  
>  /* { dg-do run } */
> +/* { dg-options -ffp-contract=off } */
> +
> #include "ffitest.h"
> 
> #include <stdlib.h>



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

* RE: [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c
       [not found] ` <CACxje5_Tp0an2rRwyUWKsqdE9vMOwDxfkSgGYTiankAH0bQLFQ@mail.gmail.com>
@ 2013-05-29  8:39   ` James Greenhalgh
  2013-06-25 12:55     ` James Greenhalgh
  0 siblings, 1 reply; 5+ messages in thread
From: James Greenhalgh @ 2013-05-29  8:39 UTC (permalink / raw)
  To: 'Anthony Green'; +Cc: libffi-discuss

>   The problem with unqualified dg-options is that non-GCC compilers
> will complain about them, and libffi currently supports compilers from
> IBM, Oracle and Microsoft.  Could you please resubmit with the
> appropriate target qualifier? Just look at other uses of dg-options.
> (to answer your other question, either a patch email or pull request
> would be fine)

Hi Anthony,

I'm sorry, but I'm not sure what you are asking me to do. Looking at
other test cases I see, for example:

testsuite/libffi.call/huge_struct.c:/* { dg-options -Wformat=0 { target
moxie*-*-elf } } */

But my understanding is that this restricts adding the option to
moxie*-*-elf targets rather than compilers.

I think to implement what you are asking I would want something like

/* { dg-options -ffp-contract=off { compiler *gcc* } } */

As best as I understand it, any GCC target which can contract
fused multiply adds will require this change, which would require
me to write:

/* { dg-options -ffp-contract=off { target *-*-* } } */

But then I think I have opened myself up to failing with other compilers
again.

Have I completely misunderstood what you are requesting? Could you
point me towards some other examples which achieve what I want?

Thanks,
James




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

* RE: [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c
  2013-05-29  8:39   ` James Greenhalgh
@ 2013-06-25 12:55     ` James Greenhalgh
  0 siblings, 0 replies; 5+ messages in thread
From: James Greenhalgh @ 2013-06-25 12:55 UTC (permalink / raw)
  To: James Greenhalgh, 'Anthony Green'
  Cc: libffi-discuss, Marcus Shawcroft

Hi Anthony,

Any thoughts on this?

Regards,
James

> >   The problem with unqualified dg-options is that non-GCC compilers
> > will complain about them, and libffi currently supports compilers
> from
> > IBM, Oracle and Microsoft.  Could you please resubmit with the
> > appropriate target qualifier? Just look at other uses of dg-options.
> > (to answer your other question, either a patch email or pull request
> > would be fine)
> 
> Hi Anthony,
> 
> I'm sorry, but I'm not sure what you are asking me to do. Looking at
> other test cases I see, for example:
> 
> testsuite/libffi.call/huge_struct.c:/* { dg-options -Wformat=0 { target
moxie*-*-elf } } */
> 
> But my understanding is that this restricts adding the option to
> moxie*-*-elf targets rather than compilers.
> 
> I think to implement what you are asking I would want something like
> 
> /* { dg-options -ffp-contract=off { compiler *gcc* } } */
> 
> As best as I understand it, any GCC target which can contract
> fused multiply adds will require this change, which would require
> me to write:
> 
> /* { dg-options -ffp-contract=off { target *-*-* } } */
> 
> But then I think I have opened myself up to failing with other
> compilers
> again.
> 
> Have I completely misunderstood what you are requesting? Could you
> point me towards some other examples which achieve what I want?
> 
> Thanks,
> James




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

end of thread, other threads:[~2013-06-25 12:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-08  9:37 [libffi testsuite] Set -ffp-contract=off for libffi.call/many.c James Greenhalgh
2013-04-19 10:01 ` James Greenhalgh
2013-05-09 12:59   ` James Greenhalgh
     [not found] ` <CACxje5_Tp0an2rRwyUWKsqdE9vMOwDxfkSgGYTiankAH0bQLFQ@mail.gmail.com>
2013-05-29  8:39   ` James Greenhalgh
2013-06-25 12:55     ` James Greenhalgh

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).