Skip to content

Commit

Permalink
Fix float vector comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
antoyo committed Jun 24, 2022
1 parent 2586690 commit 9687f69
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions gcc/jit/jit-playback.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1331,12 +1331,13 @@ new_comparison (location *loc,
tree a_type = TREE_TYPE (node_a);
if (VECTOR_TYPE_P (a_type))
{
tree vec_result_type = build_vector_type (integer_type_node, TYPE_VECTOR_SUBPARTS (a_type));
// TODO: document where this comes from and what it is doing.
tree zero_vec = build_zero_cst (a_type);
tree minus_one_vec = build_minus_one_cst (a_type);
tree zero_vec = build_zero_cst (vec_result_type);
tree minus_one_vec = build_minus_one_cst (vec_result_type);
tree cmp_type = truth_type_for (a_type);
tree cmp = build2 (inner_op, cmp_type, node_a, node_b);
inner_expr = build3 (VEC_COND_EXPR, a_type, cmp, minus_one_vec, zero_vec);
inner_expr = build3 (VEC_COND_EXPR, vec_result_type, cmp, minus_one_vec, zero_vec);
}
else
{
Expand Down
6 changes: 4 additions & 2 deletions gcc/jit/jit-recording.h
Original file line number Diff line number Diff line change
Expand Up @@ -1836,9 +1836,11 @@ class comparison : public rvalue
m_b (b)
{
type *a_type = a->get_type ();
if (a_type->dyn_cast_vector_type () != NULL)
vector_type *vec_type = a_type->dyn_cast_vector_type ();
if (vec_type != NULL)
{
m_type = a_type;
m_type = new vector_type (ctxt->get_type (GCC_JIT_TYPE_INT), vec_type->get_num_units ());
ctxt->record (m_type);
}
}

Expand Down

0 comments on commit 9687f69

Please sign in to comment.