Skip to content

Commit 9687f69

Browse files
committed
Fix float vector comparison
1 parent 2586690 commit 9687f69

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

gcc/jit/jit-playback.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -1331,12 +1331,13 @@ new_comparison (location *loc,
13311331
tree a_type = TREE_TYPE (node_a);
13321332
if (VECTOR_TYPE_P (a_type))
13331333
{
1334+
tree vec_result_type = build_vector_type (integer_type_node, TYPE_VECTOR_SUBPARTS (a_type));
13341335
// TODO: document where this comes from and what it is doing.
1335-
tree zero_vec = build_zero_cst (a_type);
1336-
tree minus_one_vec = build_minus_one_cst (a_type);
1336+
tree zero_vec = build_zero_cst (vec_result_type);
1337+
tree minus_one_vec = build_minus_one_cst (vec_result_type);
13371338
tree cmp_type = truth_type_for (a_type);
13381339
tree cmp = build2 (inner_op, cmp_type, node_a, node_b);
1339-
inner_expr = build3 (VEC_COND_EXPR, a_type, cmp, minus_one_vec, zero_vec);
1340+
inner_expr = build3 (VEC_COND_EXPR, vec_result_type, cmp, minus_one_vec, zero_vec);
13401341
}
13411342
else
13421343
{

gcc/jit/jit-recording.h

+4-2
Original file line numberDiff line numberDiff line change
@@ -1836,9 +1836,11 @@ class comparison : public rvalue
18361836
m_b (b)
18371837
{
18381838
type *a_type = a->get_type ();
1839-
if (a_type->dyn_cast_vector_type () != NULL)
1839+
vector_type *vec_type = a_type->dyn_cast_vector_type ();
1840+
if (vec_type != NULL)
18401841
{
1841-
m_type = a_type;
1842+
m_type = new vector_type (ctxt->get_type (GCC_JIT_TYPE_INT), vec_type->get_num_units ());
1843+
ctxt->record (m_type);
18421844
}
18431845
}
18441846

0 commit comments

Comments
 (0)