public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* ptx preliminary address space fixes [3/4]
@ 2014-09-11 10:13 Bernd Schmidt
  2014-09-11 11:39 ` Richard Biener
  0 siblings, 1 reply; 8+ messages in thread
From: Bernd Schmidt @ 2014-09-11 10:13 UTC (permalink / raw)
  To: GCC Patches

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

The vectorizer can also replace a memory reference without ensuring it 
uses the correct address space.

Bootstrapped and tested together with the other patches on x86_64-linux. 
  Ok?


Bernd

[-- Attachment #2: ptx-as3.diff --]
[-- Type: text/x-patch, Size: 2244 bytes --]

commit e85dbde1aa3396b5e202aa736f96b232a6e11e86
Author: Bernd Schmidt <bernds@codesourcery.com>
Date:   Wed Sep 10 16:33:40 2014 +0200

    	* tree-vect-stmts.c (vectorizable_store, vectorizable_load): Apply
    	address spaces to the type of the MEM_REF as needed.

diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 26eb2d4..5fca144 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5026,6 +5026,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
       && TREE_CODE (scalar_dest) != MEM_REF)
     return false;
 
+  tree dest_type = TREE_TYPE (scalar_dest);
+  addr_space_t as = TYPE_ADDR_SPACE (dest_type);
+
   gcc_assert (gimple_assign_single_p (stmt));
   op = gimple_assign_rhs1 (stmt);
   if (!vect_is_simple_use (op, stmt, loop_vinfo, bb_vinfo, &def_stmt,
@@ -5038,6 +5041,11 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
     }
 
   elem_type = TREE_TYPE (vectype);
+  if (!ADDR_SPACE_GENERIC_P (as))
+    {
+      elem_type = apply_as_to_type (elem_type, as);
+      vectype = apply_as_to_type (vectype, as);
+    }
   vec_mode = TYPE_MODE (vectype);
 
   /* FORNOW. In some cases can vectorize even if data-type not supported
@@ -5379,7 +5387,7 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
 		   vect_permute_store_chain().  */
 		vec_oprnd = result_chain[i];
 
-	      data_ref = build2 (MEM_REF, TREE_TYPE (vec_oprnd), dataref_ptr,
+	      data_ref = build2 (MEM_REF, vectype, dataref_ptr,
 				 dataref_offset
 				 ? dataref_offset
 				 : build_int_cst (reference_alias_ptr_type
@@ -5692,8 +5700,17 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
   if (!STMT_VINFO_DATA_REF (stmt_info))
     return false;
 
+  tree rhs = gimple_assign_rhs1 (stmt);
+  tree rhstype = TREE_TYPE (rhs);
+  addr_space_t as = TYPE_ADDR_SPACE (rhstype);
+
   elem_type = TREE_TYPE (vectype);
   mode = TYPE_MODE (vectype);
+  if (!ADDR_SPACE_GENERIC_P (as))
+    {
+      elem_type = apply_as_to_type (elem_type, as);
+      vectype = apply_as_to_type (vectype, as);
+    }
 
   /* FORNOW. In some cases can vectorize even if data-type not supported
     (e.g. - data copies).  */

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

end of thread, other threads:[~2014-09-12 12:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-11 10:13 ptx preliminary address space fixes [3/4] Bernd Schmidt
2014-09-11 11:39 ` Richard Biener
2014-09-12 11:10   ` Bernd Schmidt
2014-09-12 11:45     ` Richard Biener
2014-09-12 11:53       ` Bernd Schmidt
2014-09-12 12:29         ` Richard Biener
2014-09-12 12:15       ` Bernd Schmidt
2014-09-12 12:35         ` Richard Biener

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