diff gcc/brig/brigfrontend/brig-mem-inst-handler.cc @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
line wrap: on
line diff
--- a/gcc/brig/brigfrontend/brig-mem-inst-handler.cc	Fri Oct 27 22:46:09 2017 +0900
+++ b/gcc/brig/brigfrontend/brig-mem-inst-handler.cc	Thu Oct 25 07:37:49 2018 +0900
@@ -1,5 +1,5 @@
 /* brig-mem-inst-handler.cc -- brig memory inst handler
-   Copyright (C) 2016-2017 Free Software Foundation, Inc.
+   Copyright (C) 2016-2018 Free Software Foundation, Inc.
    Contributed by Pekka Jaaskelainen <pekka.jaaskelainen@parmance.com>
    for General Processor Tech.
 
@@ -41,7 +41,11 @@
 
   tree instr_type = gccbrig_tree_type_for_hsa_type (brig_inst->type);
 
-  if (VECTOR_TYPE_P (TREE_TYPE (data)))
+  /* In case of {ld,st}_v{2,4}. Note: since 'register' variables may
+     be any type, even a vector type, we distinguish the registers
+     from operand lists by checking for constructor nodes (which
+     operand lists are represented as).  */
+  if (VECTOR_TYPE_P (TREE_TYPE (data)) && TREE_CODE (data) == CONSTRUCTOR)
     instr_type = TREE_TYPE (data);
 
   tree ptype = build_pointer_type (instr_type);
@@ -59,7 +63,7 @@
     {
       /* Add a temporary variable so there won't be multiple
 	 reads in case of vector unpack.  */
-      mem_ref = add_temp_var ("mem_read", mem_ref);
+      mem_ref = m_parent.m_cf->add_temp_var ("mem_read", mem_ref);
       return build_output_assignment (*brig_inst, data, mem_ref);
     }
   else
@@ -91,8 +95,9 @@
       inputs.push_back (operands[1]);
       inputs.push_back (align_opr);
       tree builtin_call
-	= expand_or_call_builtin (BRIG_OPCODE_ALLOCA, BRIG_TYPE_U32,
-				  uint32_type_node, inputs);
+	= m_parent.m_cf->expand_or_call_builtin (BRIG_OPCODE_ALLOCA,
+						 BRIG_TYPE_U32,
+						 uint32_type_node, inputs);
       build_output_assignment (*brig_inst, operands[0], builtin_call);
       m_parent.m_cf->m_has_allocas = true;
       return base->byteCount;
@@ -151,14 +156,7 @@
 				 address_base, ptr_offset);
 
 	  if (is_store && TREE_TYPE (data) != instr_type)
-	    {
-	      if (int_size_in_bytes (TREE_TYPE (data))
-		    == int_size_in_bytes (instr_type)
-		  && !INTEGRAL_TYPE_P (instr_type))
-		data = build1 (VIEW_CONVERT_EXPR, instr_type, data);
-	      else
-		data = convert (instr_type, data);
-	    }
+	    data = build_resize_convert_view (instr_type, data);
 
 	  build_mem_access (brig_inst, address, data);