From 0dc77a0c4942d3b264f8f8cfc2c509ecc02c3634 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 6 Dec 2021 15:13:49 +0100 Subject: tree-optimization/103581 - fix masked gather on x86 The recent fix to PR103527 exposed an issue with how the various special casing for AVX512 masks in vect_build_gather_load_calls are handled. The following makes that more obvious, fixing the miscompile of 403.gcc. 2021-12-06 Richard Biener PR tree-optimization/103581 * tree-vect-stmts.c (vect_build_gather_load_calls): Properly guard all the AVX512 mask cases. * gcc.dg/vect/pr103581.c: New testcase. --- gcc/tree-vect-stmts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-vect-stmts.c') diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 84c6d97..8c42717 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -2785,7 +2785,7 @@ vect_build_gather_load_calls (vec_info *vinfo, stmt_vec_info stmt_info, ncopies *= 2; - if (mask && masktype == real_masktype) + if (mask && VECTOR_TYPE_P (real_masktype)) { for (int i = 0; i < count; ++i) sel[i] = i | (count / 2); @@ -2882,7 +2882,7 @@ vect_build_gather_load_calls (vec_info *vinfo, stmt_vec_info stmt_info, mask_op = var; } } - if (modifier == NARROW && masktype != real_masktype) + if (modifier == NARROW && !VECTOR_TYPE_P (real_masktype)) { var = vect_get_new_ssa_name (mask_halftype, vect_simple_var); gassign *new_stmt -- cgit v1.1