public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Kyrylo Tkachov" <kyrylo.tkachov@arm.com>
To: <gcc-patches@gcc.gnu.org>
Cc: "Ramana Radhakrishnan" <Ramana.Radhakrishnan@arm.com>,
	"Richard Earnshaw" <Richard.Earnshaw@arm.com>
Subject: [PATCH][ARM][3/3] Add vectorization support for rounding functions
Date: Tue, 18 Dec 2012 13:34:00 -0000	[thread overview]
Message-ID: <002a01cddd24$4c641140$e52c33c0$@tkachov@arm.com> (raw)

[-- 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

             reply	other threads:[~2012-12-18 13:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18 13:34 Kyrylo Tkachov [this message]
2012-12-18 18:07 ` Mike Stump
2013-02-07 15:51 ` Kyrylo Tkachov
2013-02-07 18:18   ` Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002a01cddd24$4c641140$e52c33c0$@tkachov@arm.com' \
    --to=kyrylo.tkachov@arm.com \
    --cc=Ramana.Radhakrishnan@arm.com \
    --cc=Richard.Earnshaw@arm.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).