public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw
@ 2014-05-09 18:44 Peter Bergner
  2014-05-09 19:05 ` David Edelsohn
  2014-05-09 19:32 ` Rainer Orth
  0 siblings, 2 replies; 5+ messages in thread
From: Peter Bergner @ 2014-05-09 18:44 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Pat Haugen, GCC Patches

Pat noticed that the updated pack03.c DFP test case is FAILing on
older Power hardware without DFP support (ie, power5 and earlier).
The problem is that the dg-require-effective-target dfprt use
only protects against use on system without a DFP runtime, not
a system without dfp hardware instructions.  It seems we don't
have test, so the following patch added a dfp_hw test that fixes
the problem.

This passed bootstrap and regtesting on powerpc64-linux with no
regressions on both power5 and power8 systems.
Ok for mainline, 4.9 and 4.8 branches to fixup the test cases
there?

Peter


gcc/testsuite/

	* lib/target-support.exp (check_dfp_hw_available): New function.
	(is-effective-target): Check $arg for dfp_hw.
	(is-effective-target-keyword): Likewise.
	* gcc.target/powerpc/pack03.c: (dg-require-effective-target):
	Change target to dfp_hw.

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 210242)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -1956,6 +1956,32 @@ proc check_effective_target_dfprt { } {
     }]
 }
 
+# Return 1 if the target supports executing DFP hardware instructions,
+# 0 otherwise.  Cache the result.
+
+proc check_dfp_hw_available { } {
+    return [check_cached_effective_target dfp_hw_available {
+	# For now, disable on Darwin
+	if { [istarget powerpc-*-eabi] || [istarget powerpc*-*-eabispe] || [istarget *-*-darwin*]} {
+	    expr 0
+	} else {
+	    check_runtime_nocache dfp_hw_available {
+		volatile _Decimal64 r;
+		volatile _Decimal64 a = 4.0DD;
+		volatile _Decimal64 b = 2.0DD;
+		int main()
+		{
+		  asm volatile ("dadd %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+		  asm volatile ("dsub %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+		  asm volatile ("dmul %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+		  asm volatile ("ddiv %0,%1,%2" : "=d" (r) : "d" (a), "d" (b));
+		  return 0;
+		}
+	    } "-mcpu=power6 -mhard-float"
+	}
+    }]
+}
+
 # Return 1 if the target supports compiling and assembling UCN, 0 otherwise.
 
 proc check_effective_target_ucn_nocache { } {
@@ -4936,6 +4962,7 @@ proc is-effective-target { arg } {
 	  "vsx_hw"         { set selected [check_vsx_hw_available] }
 	  "p8vector_hw"    { set selected [check_p8vector_hw_available] }
 	  "ppc_recip_hw"   { set selected [check_ppc_recip_hw_available] }
+	  "dfp_hw"         { set selected [check_dfp_hw_available] }
 	  "named_sections" { set selected [check_named_sections_available] }
 	  "gc_sections"    { set selected [check_gc_sections_available] }
 	  "cxa_atexit"     { set selected [check_cxa_atexit_available] }
@@ -4958,6 +4985,7 @@ proc is-effective-target-keyword { arg }
 	  "vsx_hw"         { return 1 }
 	  "p8vector_hw"    { return 1 }
 	  "ppc_recip_hw"   { return 1 }
+	  "dfp_hw"         { return 1 }
 	  "named_sections" { return 1 }
 	  "gc_sections"    { return 1 }
 	  "cxa_atexit"     { return 1 }
Index: gcc/testsuite/gcc.target/powerpc/pack03.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pack03.c	(revision 210242)
+++ gcc/testsuite/gcc.target/powerpc/pack03.c	(working copy)
@@ -1,7 +1,7 @@
 /* { dg-do run { target { powerpc*-*-linux* } } } */
 /* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
 /* { dg-skip-if "" { powerpc*-*-*spe* } { "*" } { "" } } */
-/* { dg-require-effective-target dfprt } */
+/* { dg-require-effective-target dfp_hw } */
 /* { dg-options "-O2 -mhard-dfp" } */
 
 #include <stddef.h>


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

* Re: [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw
  2014-05-09 18:44 [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw Peter Bergner
@ 2014-05-09 19:05 ` David Edelsohn
  2014-05-14  0:16   ` Peter Bergner
  2014-05-09 19:32 ` Rainer Orth
  1 sibling, 1 reply; 5+ messages in thread
From: David Edelsohn @ 2014-05-09 19:05 UTC (permalink / raw)
  To: Peter Bergner; +Cc: Pat Haugen, GCC Patches

On Fri, May 9, 2014 at 2:43 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> Pat noticed that the updated pack03.c DFP test case is FAILing on
> older Power hardware without DFP support (ie, power5 and earlier).
> The problem is that the dg-require-effective-target dfprt use
> only protects against use on system without a DFP runtime, not
> a system without dfp hardware instructions.  It seems we don't
> have test, so the following patch added a dfp_hw test that fixes
> the problem.
>
> This passed bootstrap and regtesting on powerpc64-linux with no
> regressions on both power5 and power8 systems.
> Ok for mainline, 4.9 and 4.8 branches to fixup the test cases
> there?
>
> Peter
>
>
> gcc/testsuite/
>
>         * lib/target-support.exp (check_dfp_hw_available): New function.
>         (is-effective-target): Check $arg for dfp_hw.
>         (is-effective-target-keyword): Likewise.
>         * gcc.target/powerpc/pack03.c: (dg-require-effective-target):
>         Change target to dfp_hw.

Okay.

thanks, David

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

* Re: [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw
  2014-05-09 18:44 [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw Peter Bergner
  2014-05-09 19:05 ` David Edelsohn
@ 2014-05-09 19:32 ` Rainer Orth
  1 sibling, 0 replies; 5+ messages in thread
From: Rainer Orth @ 2014-05-09 19:32 UTC (permalink / raw)
  To: Peter Bergner; +Cc: David Edelsohn, Pat Haugen, GCC Patches

Peter Bergner <bergner@vnet.ibm.com> writes:

> Pat noticed that the updated pack03.c DFP test case is FAILing on
> older Power hardware without DFP support (ie, power5 and earlier).
> The problem is that the dg-require-effective-target dfprt use
> only protects against use on system without a DFP runtime, not
> a system without dfp hardware instructions.  It seems we don't
> have test, so the following patch added a dfp_hw test that fixes
> the problem.

Please document the new keyword in doc/sourcebuild.texi.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

* Re: [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw
  2014-05-09 19:05 ` David Edelsohn
@ 2014-05-14  0:16   ` Peter Bergner
  2014-05-14 14:19     ` Rainer Orth
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Bergner @ 2014-05-14  0:16 UTC (permalink / raw)
  To: David Edelsohn; +Cc: Pat Haugen, GCC Patches, Rainer Orth

On Fri, 2014-05-09 at 15:05 -0400, David Edelsohn wrote:
> On Fri, May 9, 2014 at 2:43 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> > gcc/testsuite/
> >
> >         * lib/target-support.exp (check_dfp_hw_available): New function.
> >         (is-effective-target): Check $arg for dfp_hw.
> >         (is-effective-target-keyword): Likewise.
> >         * gcc.target/powerpc/pack03.c: (dg-require-effective-target):
> >         Change target to dfp_hw.
> 
> Okay.

Ok, I committed this to mainline as revision 210404, 4.9 as revision
210405 and 4.8 as revision 210406.  Thanks.

I'll note that the patch includes documentation for the new keyword
along with a few others I noticed that were missing, which I've
included below for posterity.

Peter


	* doc/sourcebuild.texi: (dfp_hw): Document.
	(p8vector_hw): Likewise.
	(powerpc_eabi_ok): Likewise.
	(powerpc_elfv2): Likewise.
	(powerpc_htm_ok): Likewise.
	(ppc_recip_hw): Likewise.
	(vsx_hw): Likewise.

Index: gcc/doc/sourcebuild.texi
===================================================================
--- gcc/doc/sourcebuild.texi	(revision 210403)
+++ gcc/doc/sourcebuild.texi	(working copy)
@@ -1601,6 +1601,13 @@ MIPS target supports @code{-mpaired-sing
 @subsubsection PowerPC-specific attributes
 
 @table @code
+
+@item dfp_hw
+PowerPC target supports executing hardware DFP instructions.
+
+@item p8vector_hw
+PowerPC target supports executing VSX instructions (ISA 2.07).
+
 @item powerpc64
 Test system supports executing 64-bit instructions.
 
@@ -1610,12 +1617,24 @@ PowerPC target supports AltiVec.
 @item powerpc_altivec_ok
 PowerPC target supports @code{-maltivec}.
 
+@item powerpc_eabi_ok
+PowerPC target supports @code{-meabi}.
+
+@item powerpc_elfv2
+PowerPC target supports @code{-mabi=elfv2}.
+
 @item powerpc_fprs
 PowerPC target supports floating-point registers.
 
 @item powerpc_hard_double
 PowerPC target supports hardware double-precision floating-point.
 
+@item powerpc_htm_ok
+PowerPC target supports @code{-mhtm}
+
+@item powerpc_p8vector_ok
+PowerPC target supports @code{-mpower8-vector}
+
 @item powerpc_ppu_ok
 PowerPC target supports @code{-mcpu=cell}.
 
@@ -1629,9 +1648,6 @@ PowerPC target supports PowerPC SPE.
 @item powerpc_spu
 PowerPC target supports PowerPC SPU.
 
-@item spu_auto_overlay
-SPU target has toolchain that supports automatic overlay generation.
-
 @item powerpc_vsx_ok
 PowerPC target supports @code{-mvsx}.
 
@@ -1639,8 +1655,17 @@ PowerPC target supports @code{-mvsx}.
 Including the options used to compile this particular test, the
 PowerPC target supports PowerPC 405.
 
+@item ppc_recip_hw
+PowerPC target supports executing reciprocal estimate instructions.
+
+@item spu_auto_overlay
+SPU target has toolchain that supports automatic overlay generation.
+
 @item vmx_hw
 PowerPC target supports executing AltiVec instructions.
+
+@item vsx_hw
+PowerPC target supports executing VSX instructions (ISA 2.06).
 @end table
 
 @subsubsection Other hardware attributes


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

* Re: [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw
  2014-05-14  0:16   ` Peter Bergner
@ 2014-05-14 14:19     ` Rainer Orth
  0 siblings, 0 replies; 5+ messages in thread
From: Rainer Orth @ 2014-05-14 14:19 UTC (permalink / raw)
  To: Peter Bergner; +Cc: David Edelsohn, Pat Haugen, GCC Patches

Hi Peter,

> I'll note that the patch includes documentation for the new keyword
> along with a few others I noticed that were missing, which I've
> included below for posterity.

fine, thanks for doing this.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

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

end of thread, other threads:[~2014-05-14 14:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-09 18:44 [PATCH, testsuite] Fix rs6000 test case pack03.c to use new dg-require-effective-target dfp_hw Peter Bergner
2014-05-09 19:05 ` David Edelsohn
2014-05-14  0:16   ` Peter Bergner
2014-05-14 14:19     ` Rainer Orth
2014-05-09 19:32 ` Rainer Orth

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