public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM][3/3] Add vectorization support for rounding functions
@ 2012-12-18 13:34 Kyrylo Tkachov
  2012-12-18 18:07 ` Mike Stump
  2013-02-07 15:51 ` Kyrylo Tkachov
  0 siblings, 2 replies; 4+ messages in thread
From: Kyrylo Tkachov @ 2012-12-18 13:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

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

Hi all,
This patch adds arm and v8 NEON to the effective target checks that are used
in the rounding functions vectorisation tests.
A new effective target check for NEON hardware is added This check is used
to determine
whether to do runtime tests or just compilation.

With these changes the following tests now PASS on arm instead of being
UNSUPPORTED:
* gcc.dg/vect/vect-rounding-btrunc.c
* gcc.dg/vect/vect-rounding-ceilf.c
* gcc.dg/vect/vect-rounding-floorf.c
* gcc.dg/vect/vect-rounding-roundf.c

Tested on arm-none-eabi with model and softfp float ABI.

Ok for trunk?

Thanks,
Kyrill

gcc/testuite/ChangeLog

2012-12-18  Kyrylo Tkachov  <kyrylo.tkachov at arm.com>

	* lib/target-supports.exp (check_effective_target_arm_v8_neon_hw):
	  New procedure.
	  (check_effective_target_vect_call_btruncf):
	  Add check for arm and ARMv8 NEON.
	  (check_effective_target_vect_call_ceilf): Likewise.
	  (check_effective_target_vect_call_floorf): Likewise.
	  (check_effective_target_vect_call_roundf): Likewise.
	  (check_vect_support_and_set_flags): Handle ARMv8 NEON effective
target.

[-- Attachment #2: vectorized_vrint_test.txt --]
[-- Type: text/plain, Size: 3204 bytes --]

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index c3151ac..6789428 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2469,6 +2469,24 @@ proc check_effective_target_arm_neonv2_hw { } {
     } [add_options_for_arm_neonv2 ""]]
 }
 
+# Return 1 if the target supports executing ARMv8 NEON instructions, 0
+# otherwise.
+
+proc check_effective_target_arm_v8_neon_hw { } {
+    return [check_runtime arm_v8_neon_hw_available {
+        #include "arm_neon.h"
+	int
+	main (void)
+	{
+	  float32x2_t a;
+	  asm ("vrinta.f32 %P0, %P1"
+	       : "=w" (a)
+	       : "0" (a));
+	  return 0;
+	}
+    } [add_options_for_arm_v8_neon ""]]
+}
+
 # Return 1 if this is a ARM target with NEON enabled.
 
 proc check_effective_target_arm_neon { } {
@@ -3975,7 +3993,9 @@ proc check_effective_target_vect_call_btruncf { } {
 	verbose "check_effective_target_vect_call_btruncf: using cached result" 2
     } else {
 	set et_vect_call_btruncf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_btruncf_saved 1
 	}
     }
@@ -4011,7 +4031,9 @@ proc check_effective_target_vect_call_ceilf { } {
 	verbose "check_effective_target_vect_call_ceilf: using cached result" 2
     } else {
 	set et_vect_call_ceilf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_ceilf_saved 1
 	}
     }
@@ -4047,7 +4069,9 @@ proc check_effective_target_vect_call_floorf { } {
 	verbose "check_effective_target_vect_call_floorf: using cached result" 2
     } else {
 	set et_vect_call_floorf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_floorf_saved 1
 	}
     }
@@ -4155,7 +4179,9 @@ proc check_effective_target_vect_call_roundf { } {
 	verbose "check_effective_target_vect_call_roundf: using cached result" 2
     } else {
 	set et_vect_call_roundf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_roundf_saved 1
 	}
     }
@@ -5057,6 +5083,14 @@ proc check_vect_support_and_set_flags { } {
         }
     } elseif [istarget ia64-*-*] {
         set dg-do-what-default run
+    } elseif [is-effective-target arm_v8_neon_ok] {
+        eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_v8_neon ""]
+        lappend DEFAULT_VECTCFLAGS "-ffast-math"
+        if [is-effective-target arm_v8_neon_hw] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
     } elseif [is-effective-target arm_neon_ok] {
         eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
         # NEON does not support denormals, so is not used for vectorization by

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

* Re: [PATCH][ARM][3/3] Add vectorization support for rounding functions
  2012-12-18 13:34 [PATCH][ARM][3/3] Add vectorization support for rounding functions Kyrylo Tkachov
@ 2012-12-18 18:07 ` Mike Stump
  2013-02-07 15:51 ` Kyrylo Tkachov
  1 sibling, 0 replies; 4+ messages in thread
From: Mike Stump @ 2012-12-18 18:07 UTC (permalink / raw)
  To: Kyrylo Tkachov; +Cc: gcc-patches, Ramana Radhakrishnan, Richard Earnshaw

On Dec 18, 2012, at 5:33 AM, Kyrylo Tkachov <kyrylo.tkachov@arm.com> wrote:
> This patch adds arm and v8 NEON to the effective target checks that are used
> in the rounding functions vectorisation tests.

For testsuite port follow ons that follow in the same exact footsteps of previous port work, I'm fine with you just committing as obvious if you'd like…

Since I looked at it, Ok.

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

* RE: [PATCH][ARM][3/3] Add vectorization support for rounding functions
  2012-12-18 13:34 [PATCH][ARM][3/3] Add vectorization support for rounding functions Kyrylo Tkachov
  2012-12-18 18:07 ` Mike Stump
@ 2013-02-07 15:51 ` Kyrylo Tkachov
  2013-02-07 18:18   ` Mike Stump
  1 sibling, 1 reply; 4+ messages in thread
From: Kyrylo Tkachov @ 2013-02-07 15:51 UTC (permalink / raw)
  To: gcc-patches; +Cc: Ramana Radhakrishnan, Richard Earnshaw

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

Hi all,
This testsuite patch has been okayed at
http://gcc.gnu.org/ml/gcc-patches/2012-12/msg01141.html
but I have not applied it and I'd like to add a couple of things to it.

Currently, add_options_for_arm_v8_neon would explicitly set
-mfloat-abi=softfp which would break
check_effective_target_arm_v8_neon_hw for configurations with hard float
ABI, thus preventing the execution tests that use this check in gcc.dg/vect
from running.
This patch fixes that.

Ok to put it in with the other two ARM rounding vectorization patches that
have been okayed for stage1?

Thanks,
Kyrill

gcc/testuite/ChangeLog

2013-02-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* lib/target-supports.exp (check_effective_target_arm_v8_neon_hw):
	New procedure.
	(check_effective_target_arm_v8_neon_ok_nocache):
	Likewise.
	(check_effective_target_arm_v8_neon_ok): Change to use
	check_effective_target_arm_v8_neon_ok_nocache.
	(add_options_for_arm_v8_neon): Use et_arm_v8_neon_flags to set ARMv8
	NEON flags.
	(check_effective_target_vect_call_btruncf):
	Enable for arm and ARMv8 NEON.
	(check_effective_target_vect_call_ceilf): Likewise.
	(check_effective_target_vect_call_floorf): Likewise.
	(check_effective_target_vect_call_roundf): Likewise.
	(check_vect_support_and_set_flags): Handle ARMv8 NEON effective
	target.

> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Kyrylo Tkachov
> Sent: 18 December 2012 13:34
> To: gcc-patches@gcc.gnu.org
> Cc: Ramana Radhakrishnan; Richard Earnshaw
> Subject: [PATCH][ARM][3/3] Add vectorization support for rounding
> functions
> 
> Hi all,
> This patch adds arm and v8 NEON to the effective target checks that are
> used
> in the rounding functions vectorisation tests.
> A new effective target check for NEON hardware is added This check is
> used
> to determine
> whether to do runtime tests or just compilation.
> 
> With these changes the following tests now PASS on arm instead of being
> UNSUPPORTED:
> * gcc.dg/vect/vect-rounding-btrunc.c
> * gcc.dg/vect/vect-rounding-ceilf.c
> * gcc.dg/vect/vect-rounding-floorf.c
> * gcc.dg/vect/vect-rounding-roundf.c
> 
> Tested on arm-none-eabi with model and softfp float ABI.
> 
> Ok for trunk?
> 
> Thanks,
> Kyrill
> 
> gcc/testuite/ChangeLog
> 
> 2012-12-18  Kyrylo Tkachov  <kyrylo.tkachov at arm.com>
> 
> 	* lib/target-supports.exp
> (check_effective_target_arm_v8_neon_hw):
> 	  New procedure.
> 	  (check_effective_target_vect_call_btruncf):
> 	  Add check for arm and ARMv8 NEON.
> 	  (check_effective_target_vect_call_ceilf): Likewise.
> 	  (check_effective_target_vect_call_floorf): Likewise.
> 	  (check_effective_target_vect_call_roundf): Likewise.
> 	  (check_vect_support_and_set_flags): Handle ARMv8 NEON effective
> target.

[-- Attachment #2: vectorized_vrint_test.txt --]
[-- Type: text/plain, Size: 5592 bytes --]

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 0c824b8..3158e87 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -2147,22 +2147,6 @@ proc check_effective_target_arm_v8_vfp_ok {} {
     }
 }
 
-# Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8
-# -mfloat-abi=softfp
-proc check_effective_target_arm_v8_neon_ok {} {
-    if { [check_effective_target_arm32] } {
-	return [check_no_compiler_messages arm_v8_neon_ok object {
-	  int foo (void)
-	  {
-	     __asm__ volatile ("vrintn.f32 q0, q0");
-	       return 0;
-	  }
-	} "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"]
-    } else {
-	return 0
-    }
-}
-
 # Return 1 if this is an ARM target supporting -mfpu=vfp
 # -mfloat-abi=hard.  Some multilibs may be incompatible with these
 # options.
@@ -2226,7 +2210,8 @@ proc add_options_for_arm_v8_neon { flags } {
     if { ! [check_effective_target_arm_v8_neon_ok] } {
         return "$flags"
     }
-    return "$flags -march=armv8-a -mfpu=neon-fp-armv8 -mfloat-abi=softfp"
+    global et_arm_v8_neon_flags
+    return "$flags $et_arm_v8_neon_flags"
 }
 
 # Add the options needed for NEON.  We need either -mfloat-abi=softfp
@@ -2270,6 +2255,38 @@ proc check_effective_target_arm_neon_ok { } {
 		check_effective_target_arm_neon_ok_nocache]
 }
 
+# Return 1 if this is an ARM target supporting -mfpu=neon-fp-armv8
+# -mfloat-abi=softfp or equivalent options.  Some multilibs may be
+# incompatible with these options.  Also set et_arm_v8_neon_flags to the
+# best options to add.
+
+proc check_effective_target_arm_v8_neon_ok_nocache { } {
+    global et_arm_v8_neon_flags
+    set et_arm_v8_neon_flags ""
+    if { [check_effective_target_arm32] } {
+	foreach flags {"" "-mfloat-abi=softfp" "-mfpu=neon-fp-armv8" "-mfpu=neon-fp-armv8 -mfloat-abi=softfp"} {
+	    if { [check_no_compiler_messages_nocache arm_v8_neon_ok object {
+		#include "arm_neon.h"
+		void
+		foo ()
+		{
+	          __asm__ volatile ("vrintn.f32 q0, q0");
+		}
+	    } "$flags"] } {
+		set et_arm_v8_neon_flags $flags
+		return 1
+	    }
+	}
+    }
+
+    return 0
+}
+
+proc check_effective_target_arm_v8_neon_ok { } {
+    return [check_cached_effective_target arm_v8_neon_ok \
+		check_effective_target_arm_v8_neon_ok_nocache]
+}
+
 # Return 1 if this is an ARM target supporting -mfpu=neon-vfpv4
 # -mfloat-abi=softfp or equivalent options.  Some multilibs may be
 # incompatible with these options.  Also set et_arm_neonv2_flags to the
@@ -2509,6 +2526,24 @@ proc check_effective_target_arm_neonv2_hw { } {
     } [add_options_for_arm_neonv2 ""]]
 }
 
+# Return 1 if the target supports executing ARMv8 NEON instructions, 0
+# otherwise.
+
+proc check_effective_target_arm_v8_neon_hw { } {
+    return [check_runtime arm_v8_neon_hw_available {
+        #include "arm_neon.h"
+	int
+	main (void)
+	{
+	  float32x2_t a;
+	  asm ("vrinta.f32 %P0, %P1"
+	       : "=w" (a)
+	       : "0" (a));
+	  return 0;
+	}
+    } [add_options_for_arm_v8_neon ""]]
+}
+
 # Return 1 if this is a ARM target with NEON enabled.
 
 proc check_effective_target_arm_neon { } {
@@ -4035,7 +4070,9 @@ proc check_effective_target_vect_call_btruncf { } {
 	verbose "check_effective_target_vect_call_btruncf: using cached result" 2
     } else {
 	set et_vect_call_btruncf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_btruncf_saved 1
 	}
     }
@@ -4071,7 +4108,9 @@ proc check_effective_target_vect_call_ceilf { } {
 	verbose "check_effective_target_vect_call_ceilf: using cached result" 2
     } else {
 	set et_vect_call_ceilf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_ceilf_saved 1
 	}
     }
@@ -4107,7 +4146,9 @@ proc check_effective_target_vect_call_floorf { } {
 	verbose "check_effective_target_vect_call_floorf: using cached result" 2
     } else {
 	set et_vect_call_floorf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_floorf_saved 1
 	}
     }
@@ -4215,7 +4256,9 @@ proc check_effective_target_vect_call_roundf { } {
 	verbose "check_effective_target_vect_call_roundf: using cached result" 2
     } else {
 	set et_vect_call_roundf_saved 0
-	if { [istarget aarch64*-*-*] } {
+	if { [istarget aarch64*-*-*]
+	     || ([istarget arm*-*-*]
+	         && [check_effective_target_arm_v8_neon_ok]) } {
 	  set et_vect_call_roundf_saved 1
 	}
     }
@@ -5117,6 +5160,14 @@ proc check_vect_support_and_set_flags { } {
         }
     } elseif [istarget ia64-*-*] {
         set dg-do-what-default run
+    } elseif [is-effective-target arm_v8_neon_ok] {
+        eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_v8_neon ""]
+        lappend DEFAULT_VECTCFLAGS "-ffast-math"
+        if [is-effective-target arm_v8_neon_hw] {
+            set dg-do-what-default run
+        } else {
+            set dg-do-what-default compile
+        }
     } elseif [is-effective-target arm_neon_ok] {
         eval lappend DEFAULT_VECTCFLAGS [add_options_for_arm_neon ""]
         # NEON does not support denormals, so is not used for vectorization by

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

* Re: [PATCH][ARM][3/3] Add vectorization support for rounding functions
  2013-02-07 15:51 ` Kyrylo Tkachov
@ 2013-02-07 18:18   ` Mike Stump
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Stump @ 2013-02-07 18:18 UTC (permalink / raw)
  To: Kyrylo Tkachov; +Cc: gcc-patches, Ramana Radhakrishnan, Richard Earnshaw

On Feb 7, 2013, at 7:51 AM, Kyrylo Tkachov <kyrylo.tkachov@arm.com> wrote:
> Ok to put it in with the other two ARM rounding vectorization patches that
> have been okayed for stage1?

Ok.

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

end of thread, other threads:[~2013-02-07 18:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-18 13:34 [PATCH][ARM][3/3] Add vectorization support for rounding functions Kyrylo Tkachov
2012-12-18 18:07 ` Mike Stump
2013-02-07 15:51 ` Kyrylo Tkachov
2013-02-07 18:18   ` Mike Stump

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