* [hsa] Fix wrong conversion ode and verification fallout
@ 2015-01-08 10:54 Martin Jambor
0 siblings, 0 replies; only message in thread
From: Martin Jambor @ 2015-01-08 10:54 UTC (permalink / raw)
To: GCC Patches
Hi,
the following patch fixes three different minor problems. It makes us
produce the rounding flag required by HSAIL specification when
converting an integer to a floating point type, not ICE on an
invariant in a return gimple statement and relax verification so that
it is OK with HSA SSA names originating from default-def gimple SSA
names which are not parameters not having a definition.
Committed to the branch. Thanks,
Martin
2015-01-08 Martin Liska <mliska@suse.cz>
Martin Jambor <mjambor@suse.cz>
* hsa-brig.c (emit_cvt_insn): Add near rounding for integer to
float conversion instruction.
* hsa-gen.c (hsa_op_reg::verify): Accept registers corresponding to
default definition SSA_NAMEs.
(gen_hsa_insns_for_return): Use the correct hsa operand creation
function.
diff --git a/gcc/hsa-brig.c b/gcc/hsa-brig.c
index 45972b6..0de9aab 100644
--- a/gcc/hsa-brig.c
+++ b/gcc/hsa-brig.c
@@ -1264,8 +1264,10 @@ emit_cvt_insn (hsa_insn_basic *insn)
/* float to smaller float requires a rounding setting (we default
to 'near'. */
- if (float_type_p (insn->type) && float_type_p (srctype)
- && (insn->type & BRIG_TYPE_BASE_MASK) < (srctype & BRIG_TYPE_BASE_MASK))
+ if (float_type_p (insn->type)
+ && (!float_type_p (srctype)
+ || ((insn->type & BRIG_TYPE_BASE_MASK)
+ < (srctype & BRIG_TYPE_BASE_MASK))))
repr.modifier = BRIG_ROUND_FLOAT_NEAR_EVEN;
else
repr.modifier = 0;
diff --git a/gcc/hsa-gen.c b/gcc/hsa-gen.c
index 273af15..58247d3 100644
--- a/gcc/hsa-gen.c
+++ b/gcc/hsa-gen.c
@@ -585,7 +585,15 @@ hsa_alloc_immed_op (tree tree_val)
void
hsa_op_reg::verify ()
{
- gcc_checking_assert (def_insn);
+ /* Verify that each HSA register has a definition assigned.
+ Exceptions are VAR_DECL and PARM_DECL that are a default
+ definition. */
+ gcc_checking_assert (def_insn
+ || (gimple_ssa != NULL
+ && (!SSA_NAME_VAR (gimple_ssa)
+ || (TREE_CODE (SSA_NAME_VAR (gimple_ssa))
+ != PARM_DECL))
+ && SSA_NAME_IS_DEFAULT_DEF (gimple_ssa)));
}
/* Allocate, clear and return a hsa_op_reg. */
@@ -1785,7 +1793,8 @@ gen_hsa_insns_for_return (gimple stmt, hsa_bb *hbb,
{
/* Store of return value. */
hsa_insn_mem *mem = hsa_alloc_mem_insn ();
- hsa_op_reg *src = hsa_reg_for_gimple_ssa (retval, ssa_map);
+ hsa_op_base *src = hsa_reg_or_immed_for_gimple_op (retval, hbb, ssa_map,
+ mem);
hsa_op_address *addr = hsa_alloc_addr_op (hsa_cfun.output_arg, NULL, 0);
mem->opcode = BRIG_OPCODE_ST;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-01-08 10:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-08 10:54 [hsa] Fix wrong conversion ode and verification fallout Martin Jambor
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).