aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Jambor <mjambor@suse.cz>2016-02-26 18:48:19 +0100
committerMartin Jambor <jamborm@gcc.gnu.org>2016-02-26 18:48:19 +0100
commit27d39ae1cca01885262fa267879f341c473110e3 (patch)
treeb4408134f40bc68c60e841c12eb3ec75918f91a3 /gcc
parentde0fef0dd466bc329456b36cccfa6b06768da639 (diff)
downloadgcc-27d39ae1cca01885262fa267879f341c473110e3.zip
gcc-27d39ae1cca01885262fa267879f341c473110e3.tar.gz
gcc-27d39ae1cca01885262fa267879f341c473110e3.tar.bz2
[hsa/69568] Fix ld instruction type for packed data
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/hsa-brig.c2
-rw-r--r--gcc/hsa-gen.c6
-rw-r--r--gcc/hsa.c8
-rw-r--r--gcc/hsa.h1
5 files changed, 24 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6af840d..6550115 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,15 @@
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
* hsa-gen.c (gen_hsa_phi_from_gimple_phi): Use proper hsa type for
pointers.
diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c
index cfbac58..61cfd8b 100644
--- a/gcc/hsa-brig.c
+++ b/gcc/hsa-brig.c
@@ -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))
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 5c7744b..d7d39f0 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -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
{
diff --git a/gcc/hsa.c b/gcc/hsa.c
index 9537e29..09bfd28 100644
--- 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
diff --git a/gcc/hsa.h b/gcc/hsa.h
index 275a954..3a13fbd 100644
--- 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);