]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[hsa/69568] Fix ld instruction type for packed data
authorMartin Jambor <mjambor@suse.cz>
Fri, 26 Feb 2016 17:48:19 +0000 (18:48 +0100)
committerMartin Jambor <jamborm@gcc.gnu.org>
Fri, 26 Feb 2016 17:48:19 +0000 (18:48 +0100)
2016-02-26  Martin Jambor  <mjambor@suse.cz>

PR hsa/69568
* hsa.h (hsa_type_packed_p): Declare.
* hsa.c (hsa_type_packed_p): New function.
* hsa-gen.c (mem_type_for_type): Use unsigned type for packed
loads.
(gen_hsa_insns_for_store): Use hsa_type_packed_p.
* hsa-brig.c (emit_basic_insn): Likewise.

From-SVN: r233751

gcc/ChangeLog
gcc/hsa-brig.c
gcc/hsa-gen.c
gcc/hsa.c
gcc/hsa.h

index 6af840d4d3561ee0400001a38723a979434472dd..6550115c9fdb89532127ae95a3ee91d811b90a3d 100644 (file)
@@ -1,3 +1,13 @@
+2016-02-26  Martin Jambor  <mjambor@suse.cz>
+
+       PR hsa/69568
+       * hsa.h (hsa_type_packed_p): Declare.
+       * hsa.c (hsa_type_packed_p): New function.
+       * hsa-gen.c (mem_type_for_type): Use unsigned type for packed
+       loads.
+       (gen_hsa_insns_for_store): Use hsa_type_packed_p.
+       * hsa-brig.c (emit_basic_insn): Likewise.
+
 2016-02-26  Martin Jambor  <mjambor@suse.cz>
 
        pr hsa/69674
index cfbac581a30b3d1f6632f99bd49455250ce26029..61cfd8b8c2383d93bd8e316bd3b7c465df3ab149 100644 (file)
@@ -1803,7 +1803,7 @@ emit_basic_insn (hsa_insn_basic *insn)
   repr.base.type = lendian16 (type);
   repr.base.operands = lendian32 (emit_insn_operands (insn));
 
-  if ((type & BRIG_TYPE_PACK_MASK) != BRIG_TYPE_PACK_NONE)
+  if (hsa_type_packed_p (type))
     {
       if (hsa_type_float_p (type)
          && !hsa_opcode_floating_bit_insn_p (insn->m_opcode))
index 5c7744bc0746d7714b5dce9b41e73a28d08cfeb0..d7d39f09c1eff55bae71c64f4674e30cb72815a9 100644 (file)
@@ -754,11 +754,13 @@ mem_type_for_type (BrigType16_t type)
      unsigned type?).  */
   if ((type & BRIG_TYPE_PACK_MASK) == BRIG_TYPE_PACK_128)
     return BRIG_TYPE_B128;
-  else if (hsa_btype_p (type))
+  else if (hsa_btype_p (type) || hsa_type_packed_p (type))
     {
       unsigned bitsize = hsa_type_bit_size (type);
       if (bitsize < 128)
        return hsa_uint_for_bitsize (bitsize);
+      else
+       return hsa_bittype_for_bitsize (bitsize);
     }
   return type;
 }
@@ -2648,7 +2650,7 @@ gen_hsa_insns_for_store (tree lhs, hsa_op_base *src, hsa_bb *hbb)
      we can modify the above in place.  */
   if (hsa_op_immed *imm = dyn_cast <hsa_op_immed *> (src))
     {
-      if ((imm->m_type & BRIG_TYPE_PACK_MASK) == BRIG_TYPE_PACK_NONE)
+      if (!hsa_type_packed_p (imm->m_type))
        imm->m_type = mem->m_type;
       else
        {
index 9537e295cb52935d9f792e10a19eb52059dae4fc..09bfd28b4378866f9af64d6efd1ed107657ce132 100644 (file)
--- a/gcc/hsa.c
+++ b/gcc/hsa.c
@@ -480,6 +480,14 @@ hsa_unsigned_type_for_type (BrigType16_t t)
   return hsa_uint_for_bitsize (hsa_type_bit_size (t));
 }
 
+/* Return true if TYPE is a packed HSA type.  */
+
+bool
+hsa_type_packed_p (BrigType16_t type)
+{
+  return (type & BRIG_TYPE_PACK_MASK) != BRIG_TYPE_PACK_NONE;
+}
+
 /* Return true if and only if TYPE is a floating point number type.  */
 
 bool
index 275a954f88dee5bd373070dc3ecf1bbe8603b207..3a13fbd147a636ac1019e67805710631cf7f9ab1 100644 (file)
--- a/gcc/hsa.h
+++ b/gcc/hsa.h
@@ -1338,6 +1338,7 @@ BrigType16_t hsa_uint_for_bitsize (unsigned bitsize);
 BrigType16_t hsa_float_for_bitsize (unsigned bitsize);
 BrigType16_t hsa_bittype_for_type (BrigType16_t t);
 BrigType16_t hsa_unsigned_type_for_type (BrigType16_t t);
+bool hsa_type_packed_p (BrigType16_t type);
 bool hsa_type_float_p (BrigType16_t type);
 bool hsa_type_integer_p (BrigType16_t type);
 bool hsa_btype_p (BrigType16_t type);