public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <richard.sandiford@linaro.org>
To: gcc-patches@gcc.gnu.org
Subject: [3/10] Add available_vector_sizes to target-supports.exp
Date: Fri, 03 Nov 2017 16:18:00 -0000	[thread overview]
Message-ID: <874lqbqqta.fsf@linaro.org> (raw)
In-Reply-To: <87inerqqyz.fsf@linaro.org> (Richard Sandiford's message of "Fri,	03 Nov 2017 16:14:44 +0000")

This patch adds a routine that lists the available vector sizes
for a target and uses it for some existing target conditions.
Later patches add more uses.

The cases are taken from multiple_sizes.


2017-11-03  Richard Sandiford  <richard.sandiford@linaro.org>
	    Alan Hayward  <alan.hayward@arm.com>
	    David Sherwood  <david.sherwood@arm.com>

gcc/testsuite/
	* lib/target-supports.exp (available_vector_sizes): New proc.
	(check_effective_target_vect_multiple_sizes): Use it.
	(check_effective_target_vect64): Likewise.
	(check_effective_target_vect_sizes_32B_16B): Likewise.

Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	2017-11-03 12:16:58.605777011 +0000
+++ gcc/testsuite/lib/target-supports.exp	2017-11-03 16:06:12.625838683 +0000
@@ -6581,46 +6581,38 @@ foreach N {2 3 4 8} {
     }]
 }
 
-# Return 1 if the target supports multiple vector sizes
+# Return the list of vector sizes (in bits) that each target supports.
+# A vector length of "0" indicates variable-length vectors.
 
-proc check_effective_target_vect_multiple_sizes { } {
-    global et_vect_multiple_sizes_saved
-    global et_index
-
-    set et_vect_multiple_sizes_saved($et_index) 0
-    if { [istarget aarch64*-*-*]
-	 || [is-effective-target arm_neon]
-	 || (([istarget i?86-*-*] || [istarget x86_64-*-*])
-	     && ([check_avx_available] && ![check_prefer_avx128])) } {
-	set et_vect_multiple_sizes_saved($et_index) 1
+proc available_vector_sizes { } {
+    set result {}
+    if { [istarget aarch64*-*-*] } {
+	lappend result 128 64
+    } elseif { [istarget arm*-*-*]
+		&& [check_effective_target_arm_neon_ok] } {
+	lappend result 128 64
+    } elseif { (([istarget i?86-*-*] || [istarget x86_64-*-*])
+		 && ([check_avx_available] && ![check_prefer_avx128])) } {
+	lappend result 256 128
+    } elseif { [istarget sparc*-*-*] } {
+	lappend result 64
+    } else {
+	# The traditional default asumption.
+	lappend result 128
     }
+    return $result
+}
+
+# Return 1 if the target supports multiple vector sizes
 
-    verbose "check_effective_target_vect_multiple_sizes:\
-	     returning $et_vect_multiple_sizes_saved($et_index)" 2
-    return $et_vect_multiple_sizes_saved($et_index)
+proc check_effective_target_vect_multiple_sizes { } {
+    return [expr { [llength [available_vector_sizes]] > 1 }]
 }
 
 # Return 1 if the target supports vectors of 64 bits.
 
 proc check_effective_target_vect64 { } {
-    global et_vect64_saved
-    global et_index
-
-    if [info exists et_vect64_saved($et_index)] {
-        verbose "check_effective_target_vect64: using cached result" 2
-    } else {
-	set et_vect64_saved($et_index) 0
-        if { ([is-effective-target arm_neon]
-	      && [check_effective_target_arm_little_endian])
-	     || [istarget aarch64*-*-*]
-             || [istarget sparc*-*-*] } {
-	   set et_vect64_saved($et_index) 1
-        }
-    }
-
-    verbose "check_effective_target_vect64:\
-	     returning $et_vect64_saved($et_index)" 2
-    return $et_vect64_saved($et_index)
+    return [expr { [lsearch -exact [available_vector_sizes] 64] >= 0 }]
 }
 
 # Return 1 if the target supports vector copysignf calls.
@@ -7747,11 +7739,7 @@ proc check_avx_available { } {
 # Return true if 32- and 16-bytes vectors are available.
 
 proc check_effective_target_vect_sizes_32B_16B { } {
-  if { [check_avx_available] && ![check_prefer_avx128] } {
-     return 1;
-  } else {
-    return 0;
-  }
+    return [expr { [available_vector_sizes] == [list 256 128] }]
 }
 
 # Return true if 16- and 8-bytes vectors are available.

  parent reply	other threads:[~2017-11-03 16:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 16:14 [0/10] Vectoriser testsuite tweaks Richard Sandiford
2017-11-03 16:16 ` [1/10] Consistently use asm volatile ("" ::: "memory") in vect tests Richard Sandiford
2017-11-08 19:10   ` Jeff Law
2017-11-03 16:17 ` [2/10] Add VECTOR_BITS to tree-vect.h Richard Sandiford
2017-11-08 19:13   ` Jeff Law
2017-11-03 16:18 ` [4/10] Don't assume vect_multiple_sizes means 2 sizes Richard Sandiford
2017-11-08 19:21   ` Jeff Law
2017-11-03 16:18 ` Richard Sandiford [this message]
2017-11-08 19:13   ` [3/10] Add available_vector_sizes to target-supports.exp Jeff Law
2017-11-17 13:23     ` Christophe Lyon
2017-11-03 16:19 ` [5/10] Add vect_perm3_* target selectors Richard Sandiford
2017-11-08 19:49   ` Jeff Law
2017-11-03 16:20 ` [6/10] Add a vect_element_align_preferred target selector Richard Sandiford
2017-11-08 22:31   ` Jeff Law
2017-11-03 16:21 ` [8/10] Add a vect_variable_length " Richard Sandiford
2017-11-08 22:33   ` Jeff Law
2017-11-03 16:21 ` [7/10] Add a vect_unaligned_possible " Richard Sandiford
2017-11-08 22:32   ` Jeff Law
2017-11-03 16:22 ` [9/10] Add a vect_align_stack_vars " Richard Sandiford
2017-11-08 22:40   ` Jeff Law
2017-11-03 16:23 ` [10/10] Add a vect_masked_store " Richard Sandiford
2017-11-08 22:44   ` Jeff Law

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=874lqbqqta.fsf@linaro.org \
    --to=richard.sandiford@linaro.org \
    --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).