From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by sourceware.org (Postfix) with ESMTPS id CF1713858CDB for ; Fri, 14 Jul 2023 09:44:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF1713858CDB 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-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-51e619bcbf9so2173079a12.3 for ; Fri, 14 Jul 2023 02:44:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689327876; x=1691919876; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=h9sFBoDP9q64de8+2RnxtKC5iNta+cWEtXEv8gSywII=; b=AZNcVBsZpfBU3qqaHuLLHN4aqc/fQm27oWe+VBTND0/m4KOvBX/o5Rd0tnSt689P4K DHzNVNI9bCBwBBTyfOm216twa/7YpP5QbpKpM+Uz9AYKOqdi5IScQLJ0gvZNFGf2iHyT ZKQN+d/cOPv8RhWsN4tA7YsHswYrWD6O3HDDuREIjPZGQQ7Cnr/m160fd3+5LLOTWQJx iNckCObO/LiHCujZlEsvGyHrrZoWhXmRo2+s679atKJlcctw1XVx9UrpbRYo8mU4kfOp 9VIO5YSjzZsj76MBUuL3oRabI1RGkKsPzOBNC9EknSbKLdgDtaBHeXDfbCNn/qW1UyJa Qs8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689327876; x=1691919876; h=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=h9sFBoDP9q64de8+2RnxtKC5iNta+cWEtXEv8gSywII=; b=BrAPuWwTmW3fVqsqLCYffMxGd3kjwp353zW5hWPVz+2wJz/mRlzJARtiFMLPsuAaa1 KjJp7Hl+NLtArtctxnjB4ZpC36h60ADoNtlWAma2kk20Ak/5+soqI2JcLYmNX3vQM+O6 xJNuy85hfzkQ024ZnIkqvOzShoQmFcdYPB4O8AwWFQyg8QPyLZkV/+9r0s1yxu1SVZ4E YXRR+I+c5MeTcLAvrstpVGlCaGj8ZC5Tdjhm5qwyX/nvORmdNZ/LnitpVsUdtjQL3nIC 0vw4q+UkoRtQ8Y3TdKGFEuwspeGAozSwaMS+WVwT5H2QGGN16kat1pffDnEqlN4lx3tg mrxw== X-Gm-Message-State: ABy/qLZhQ9vAXaDujhMuntZrb/vvFugp9S9ZahvBnE9GtSEo5zvUL+Nu 29Rh+QYC181eWJKr5g44i6rRons6hdgaFxE0z9o= X-Google-Smtp-Source: APBJJlF04VKMaSSAZsrf9R5Y4zaXi54ApA+WjKnK1ZrGTGgqAaIfODE/ld5wUOQ4i0IwwPzWTeexuERrjYPnNoOznJo= X-Received: by 2002:aa7:c3d6:0:b0:518:6a99:cac3 with SMTP id l22-20020aa7c3d6000000b005186a99cac3mr4302878edr.31.1689327876267; Fri, 14 Jul 2023 02:44:36 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Uros Bizjak Date: Fri, 14 Jul 2023 11:44:24 +0200 Message-ID: Subject: Re: [PATCH] cprop: Do not set REG_EQUAL note when simplifying paradoxical subreg [PR110206] To: Richard Biener Cc: "gcc-patches@gcc.gnu.org" , Richard Sandiford Content-Type: multipart/mixed; boundary="000000000000f97f8406006f4b32" X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,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: --000000000000f97f8406006f4b32 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jul 14, 2023 at 10:53=E2=80=AFAM Richard Biener = wrote: > > On Fri, 14 Jul 2023, Uros Bizjak wrote: > > > On Fri, Jul 14, 2023 at 10:31?AM Richard Biener wro= te: > > > > > > On Fri, 14 Jul 2023, Uros Bizjak wrote: > > > > > > > cprop1 pass does not consider paradoxical subreg and for (insn 22) = claims > > > > that it equals 8 elements of HImodeby setting REG_EQUAL note: > > > > > > > > (insn 21 19 22 4 (set (reg:V4QI 98) > > > > (mem/u/c:V4QI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0 S= 4 > > > > A32])) "pr110206.c":12:42 1530 {*movv4qi_internal} > > > > (expr_list:REG_EQUAL (const_vector:V4QI [ > > > > (const_int -52 [0xffffffffffffffcc]) repeated x4 > > > > ]) > > > > (nil))) > > > > (insn 22 21 23 4 (set (reg:V8HI 100) > > > > (zero_extend:V8HI (vec_select:V8QI (subreg:V16QI (reg:V4QI = 98) 0) > > > > (parallel [ > > > > (const_int 0 [0]) > > > > (const_int 1 [0x1]) > > > > (const_int 2 [0x2]) > > > > (const_int 3 [0x3]) > > > > (const_int 4 [0x4]) > > > > (const_int 5 [0x5]) > > > > (const_int 6 [0x6]) > > > > (const_int 7 [0x7]) > > > > ])))) "pr110206.c":12:42 7471 {sse4_1_zero_exte= ndv8qiv8hi2} > > > > (expr_list:REG_EQUAL (const_vector:V8HI [ > > > > (const_int 204 [0xcc]) repeated x8 > > > > ]) > > > > (expr_list:REG_DEAD (reg:V4QI 98) > > > > (nil)))) > > > > > > > > We rely on the "undefined" vals to have a specific value (from the = earlier > > > > REG_EQUAL note) but actual code generation doesn't ensure this (it = doesn't > > > > need to). That said, the issue isn't the constant folding per-se b= ut that > > > > we do not actually constant fold but register an equality that does= n't hold. > > > > > > > > PR target/110206 > > > > > > > > gcc/ChangeLog: > > > > > > > > * fwprop.cc (contains_paradoxical_subreg_p): Move to ... > > > > * rtlanal.cc (contains_paradoxical_subreg_p): ... here. > > > > * rtlanal.h (contains_paradoxical_subreg_p): Add prototype. > > > > * cprop.cc (try_replace_reg): Do not set REG_EQUAL note > > > > when the original source contains a paradoxical subreg. > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > * gcc.dg/torture/pr110206.c: New test. > > > > > > > > Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. > > > > > > > > OK for mainline and backports? > > > > > > OK. > > > > > > I think the testcase can also run on other targets if you add > > > dg-additional-options "-w -Wno-psabi", all generic vector ops > > > should be lowered if not supported. > > > > True, but with lowered vector ops, the test would not even come close > > to the problem. The problem is specific to generic vector ops, and can > > be triggered only when paradoxical subregs are used to implement > > (partial) vector modes. This is the case on x86, where partial vectors > > are now heavily used, and even there we need the latest vector ISA > > enabled to trip the condition. > > > > The above is the reason that dg-torture is used, with the hope that > > the runtime failure will trip when testsuite is run with specific > > target options. > > I see. I'm fine with this then though moving to gcc.target/i386 > with appropriate triggering options and a dg-require for runtime > support would also work. You are right. I'll add the attached testcase to gcc.target/i386 instead. Uros. --000000000000f97f8406006f4b32 Content-Type: text/x-csrc; charset="US-ASCII"; name="pr110206.c" Content-Disposition: attachment; filename="pr110206.c" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_lk2e6w5j0 LyogUFIgdGFyZ2V0LzExMDIwNiAqLwovKiB7IGRnLWRvIHJ1biB9ICovCi8qIHsgZGctb3B0aW9u cyAiLU9zIC1tYXZ4NTEyYncgLW1hdng1MTJ2bCIgfSAqLwovKiB7IGRnLXJlcXVpcmUtZWZmZWN0 aXZlLXRhcmdldCBhdng1MTJidyB9ICovCi8qIHsgZGctcmVxdWlyZS1lZmZlY3RpdmUtdGFyZ2V0 IGF2eDUxMnZsIH0gKi8KCiNkZWZpbmUgQVZYNTEyQlcKI2RlZmluZSBBVlg1MTJWTAoKI2luY2x1 ZGUgImF2eDUxMmYtY2hlY2suaC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