From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 4AEF23856972 for ; Thu, 6 Jul 2023 06:08:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4AEF23856972 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2b6f9edac8dso3419801fa.3 for ; Wed, 05 Jul 2023 23:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688623716; x=1691215716; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=+A3cTt9gRrGRQ8MMdRfM4asWngdO07BPQrV/1nZWwmk=; b=p1W/ILS1NiT4cDAetNkv9hEfqHcX09NK0Us4L8SK1wkQq2PRpJGf7rd7Dtn32ywxTT 5QIZ0TLD2aQCYWxbY1QokT6kBR0XTkTAvQLlb5TWiQ+5CUcQceYHkds5TvlMCJfUfuW8 GzL4jlOPQOnFFqXfs7WUSv/reyA0aLSFf9ua+xp8tw/UlEvPihnNdAH4zFFv5Fc6kOaY ZY0yF+qvvh4csAoYJCy13vZFQ5UnbSviLZbisqLmMSxT3CjLzVUe9hpvjeuhWlqCuXg1 aXTo8bKs0Lm7Kqrl1UrvQYziaO6lbBuMuH5L1ek4Yx77B4xTMEm9rz4oydRISJkK+cwn AhdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688623716; x=1691215716; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+A3cTt9gRrGRQ8MMdRfM4asWngdO07BPQrV/1nZWwmk=; b=LO+Maa78/+uPTwBsL+aYmtepiCXLEt4bdurmX6wSXI8IdVsbWu5v0sCo3PuxTURXlz X9IHKjGjDxdtjKxFjOdlU79PoIkgNgJyQf4MQFMEwTYqBm5m8QUKt1CuUJ512x8YWRVh HLbYhTCMR1xOpuYNc2iQIyJZLKBhCjFYEuAq2EjDhhdwRTbM1nPUn2sjNODYmQJfNjOD rFSul0emSG5kQpBI2yx+gIVFSw4dPsBYV2lui1T2zthZgAmXQoBnHcKfbpJbIXg2UgOk o195YiDVHaqoSplo6a+o1VQfMg4wRzNggUpCGB7bsTEfNt/VDwG8Cg0jJNlvdszyOxVy 3yDQ== X-Gm-Message-State: ABy/qLal3mxzFOizXNHiYZoHPGGv+EMclfadGvcKBM2GxoFCtPj/q9n9 Re+3RMgKe9RWGYHCmOg/bqR6H3ksRjbeGJLW6myXNMXb X-Google-Smtp-Source: APBJJlEf6t9TLqhz61Lkar5LC0NjOn7p5f5HYYxzH1P2kMbg8w9AxjKBdEpmOVInV4x8V48IxVZZXM3uRcSnKWurEn4= X-Received: by 2002:a2e:854d:0:b0:2b6:ef2b:da5e with SMTP id u13-20020a2e854d000000b002b6ef2bda5emr521567ljj.49.1688623715700; Wed, 05 Jul 2023 23:08:35 -0700 (PDT) MIME-Version: 1.0 References: <20230705170136.581584-1-apinski@marvell.com> In-Reply-To: <20230705170136.581584-1-apinski@marvell.com> From: Richard Biener Date: Thu, 6 Jul 2023 08:08:23 +0200 Message-ID: Subject: Re: [PATCH] Fix PR 110554: vec lowering introduces scalar signed-boolean:32 comparisons To: Andrew Pinski Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Wed, Jul 5, 2023 at 7:02=E2=80=AFPM Andrew Pinski via Gcc-patches wrote: > > So the problem is vector generic decided to do comparisons in signed-bool= ean:32 > types but the rest of the middle-end was not ready for that. Since we are= building > the comparison which will feed into a cond_expr here, using boolean_type_= node is > better and also correct. The rest of the compiler thinks the ranges for > comparison is always [0,1] too. > > Note this code does not currently lowers bigger vector sizes into smaller > vector sizes so using boolean_type_node here is better. > > OK? bootstrapped and tested on x86_64-linux-gnu with no regressions. OK. > gcc/ChangeLog: > > PR middle-end/110554 > * tree-vect-generic.cc (expand_vector_condition): For comparisons= , > just build using boolean_type_node instead of the cond_type. > For non-comparisons/non-scalar-bitmask, build a ` !=3D 0` gimple > that will feed into the COND_EXPR. > --- > gcc/tree-vect-generic.cc | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc > index df04a0db68d..a7e6cb87a5e 100644 > --- a/gcc/tree-vect-generic.cc > +++ b/gcc/tree-vect-generic.cc > @@ -1121,7 +1121,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi,= bitmap dce_ssa_names) > comp_width, comp_index); > tree aa2 =3D tree_vec_extract (gsi, comp_inner_type, a2, > comp_width, comp_index); > - aa =3D gimplify_build2 (gsi, code, cond_type, aa1, aa2); > + aa =3D gimplify_build2 (gsi, code, boolean_type_node, aa1, aa2)= ; > } > else if (a_is_scalar_bitmask) > { > @@ -1132,7 +1132,11 @@ expand_vector_condition (gimple_stmt_iterator *gsi= , bitmap dce_ssa_names) > build_zero_cst (TREE_TYPE (a))); > } > else > - aa =3D tree_vec_extract (gsi, cond_type, a, comp_width, comp_inde= x); > + { > + result =3D tree_vec_extract (gsi, cond_type, a, comp_width, com= p_index); > + aa =3D gimplify_build2 (gsi, NE_EXPR, boolean_type_node, result= , > + build_zero_cst (cond_type)); > + } > result =3D gimplify_build3 (gsi, COND_EXPR, inner_type, aa, bb, cc= ); > if (!CONSTANT_CLASS_P (result)) > constant_p =3D false; > -- > 2.31.1 >