[PATCH] middle-end/123175 - fix vec_perm_indices construction in selftests
Richard Biener <[email protected]> Thu, 6 Aug 2026 14:13:55 +0200 (CEST)
| Newsgroups | gmane.comp.gcc.patches |
|---|---|
| Message-ID | <[email protected]> |
The two mixed VLA / non-VLA tests happen to mix up the number of
element argument to vec_perm_indices construction.
Built/tested on x86_64-unknown-linux-gnu, pushed.
Richard.
PR middle-end/123175
* fold-const.cc (test_vnx4si_v4si): Fixup vec_perm_indices
construction.
(test_v4si_vnx4si): Likewise.
---
gcc/fold-const.cc | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 64d0e7208ce..c15a6b7804d 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -16997,7 +16997,7 @@ test_vnx4si_v4si (machine_mode vnx4si_mode, machine_mode v4si_mode)
poly_uint64 mask_elems[] = { 0, 4, 1, 5 };
builder_push_elems (builder, mask_elems);
- vec_perm_indices sel (builder, 2, res_len);
+ vec_perm_indices sel (builder, 2, 4);
tree res = fold_vec_perm_cst (res_type, arg0, arg1, sel);
tree expected_res[] = { ARG0(0), ARG1(0), ARG0(1), ARG1(1) };
@@ -17021,7 +17021,7 @@ test_vnx4si_v4si (machine_mode vnx4si_mode, machine_mode v4si_mode)
poly_uint64 mask_elems[] = { 0, 8, 4, 12 };
builder_push_elems (builder, mask_elems);
- vec_perm_indices sel (builder, 2, res_len);
+ vec_perm_indices sel (builder, 2, 4);
tree res = fold_vec_perm_cst (res_type, arg0, arg1, sel);
tree expected_res[] = { ARG0(0), ARG0(0), ARG1(0), ARG1(0) };
@@ -17053,7 +17053,8 @@ test_v4si_vnx4si (machine_mode v4si_mode, machine_mode vnx4si_mode)
poly_uint64 mask_elems[] = {0, 1, 2, 3};
builder_push_elems (builder, mask_elems);
- vec_perm_indices sel (builder, 2, res_len);
+ vec_perm_indices sel (builder, 2,
+ TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)));
tree res = fold_vec_perm_cst (res_type, arg0, arg1, sel);
tree expected_res[] = { ARG0(0), ARG0(1), ARG0(2), ARG0(3) };
@@ -17078,7 +17079,8 @@ test_v4si_vnx4si (machine_mode v4si_mode, machine_mode vnx4si_mode)
poly_uint64 mask_elems[] = {0, 2, 4, 6};
builder_push_elems (builder, mask_elems);
- vec_perm_indices sel (builder, 2, res_len);
+ vec_perm_indices sel (builder, 2,
+ TYPE_VECTOR_SUBPARTS (TREE_TYPE (arg0)));
const char *reason;
tree res = fold_vec_perm_cst (res_type, arg0, arg1, sel, &reason);
--
2.51.0