From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by sourceware.org (Postfix) with ESMTPS id DD7F23858CDB for ; Mon, 5 Feb 2024 08:17:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DD7F23858CDB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DD7F23858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::233 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707121035; cv=none; b=X8dvpAXUEgTXjWskiRaRxp3cafeX72nojAPiAz1iJ4aESKhp6o5Wb7IfmQLLVLKSWgsKFD/Rdl0XKi0mTZHTCX9gnen5DVmgrTd2KlRB9gII5lKdb5OBvK5RxSQ22UCCF6FVIfIWFN3d271gXqMUfN+tHYUpIRMkXUtEvKuIoOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707121035; c=relaxed/simple; bh=ULtziQ+nAXcsVCCCbtEZKJn98AHtTT1zvffdPPpAAXQ=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=hlr5ou9X7+vMn7mSXxVTAV4iNKvKzP3ym23K/jarNoc4UTQ/FJNHyZpk21nKT8559VT/QabHS7iQFgy3aj2f8S7M10+G5EdAprrZxa6BSYjreyGwz9t9cFgZBQv9fUkEiD889RhH+nrgGg9LNWVoWux54lC/J+3yNjHMHNbuRlI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2cf5917f049so47056031fa.2 for ; Mon, 05 Feb 2024 00:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707121029; x=1707725829; darn=gcc.gnu.org; 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=pKQ0lZiqN+s3SV0A1Qg95AsvoSD/15GiI5lSWr6xo0Q=; b=cvEELTCvAZZv5EyG+5X+ej731jjOVnonAFpdYW4lSzsQ4KPLU14Ody4Nn4VMSFejIH AeqZaLuPU8UarE1y/5uugfsu8+U7BiaRvXTXDTMEoUj22rfKm9NomPBJ+5BhwMa6ISuf Mx2yPjv2LEN0KUdiTPeCRi0vQ554g4E2yVI+ACpFyBL7H3Rpkn8cycwnzRTZZvgoavBv rcwi08K95279V9dCZoZoSpPhWH3FvqLqo2cMaRZfl9Iv6dHbcfQ9vRA+nScVTl0T4XTW uUXTEO0wKDuH8CKOR4o9/wdB4i/eJQBw4Qty3dWIKf9IqFjG3x00pa/tfzyL+Eejp465 /RnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707121029; x=1707725829; 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=pKQ0lZiqN+s3SV0A1Qg95AsvoSD/15GiI5lSWr6xo0Q=; b=cKto8HFFEm9ae7tKo1xvfW0NWUFjaRvveERci/Zw+HDvq+7SnxdkV+pYKDt/CTBkOv nzBEqsZ561Ei2xXZFCQ03acVcheyN4zC1Xz3+IgrrlRCnoAvdHeWuiBFmA01LYwIv6CR R6Ylqj4SFvWDZvqNrMV153SNl544Gy3bewDBOkLwcX6xZD20+rO8I+rlxxowRRRxETcU U+G+/hjdFvRlDR45OILjXSdUdort5/CXO9RUizcOKnMFPHablGr1Rn+0lgFFtWoIPsYo oIdRQvAHLQoFp/VGQrUyc/a9YobX6mgxgiH39Bw6ti0yyAjs9AJZdIBTDYn3LlOZ5Fe5 LJrg== X-Gm-Message-State: AOJu0YwZMGqehePG7iPU2awDA9q2CsxlHYu6BgROwAK0C53iBhlN1yFw eOR5/F9PVdGzCqrfnhwQL4EjoBE/FxQzH7VbkR6W2FGPxijv+TeDGOaMDhxIsNOKiMZeEAkBAdb MEbsbmH4dZCz7mciNpEcwUl58oK0dSnYYZ+Q= X-Google-Smtp-Source: AGHT+IHOUzTu/oBXE5kgMzxKjyPVOW6nrSaJEFaBBWT2q8VXX2xiBeWlqb0xbI39IyHEM3eIoGSdsAcixlnUTOmSTr0= X-Received: by 2002:a2e:a544:0:b0:2d0:85eb:935f with SMTP id e4-20020a2ea544000000b002d085eb935fmr7154441ljn.49.1707121028921; Mon, 05 Feb 2024 00:17:08 -0800 (PST) MIME-Version: 1.0 References: <00b701da57c9$b7444a80$25ccdf80$@nextmovesoftware.com> In-Reply-To: From: Uros Bizjak Date: Mon, 5 Feb 2024 09:16:57 +0100 Message-ID: Subject: Re: [x86_64 PATCH] PR target/113690: Fix-up MULT REG_EQUAL notes in STV. To: Roger Sayle Cc: gcc-patches@gcc.gnu.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 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: On Mon, Feb 5, 2024 at 9:06=E2=80=AFAM Uros Bizjak wrot= e: > > On Mon, Feb 5, 2024 at 1:24=E2=80=AFAM Roger Sayle wrote: > > > > > > This patch fixes PR target/113690, an ICE-on-valid regression on x86_64 > > that exhibits with a specific combination of command line options. The > > cause is that x86's scalar-to-vector pass converts a chain of instructi= ons > > from TImode to V1TImode, but fails to appropriately update the attached > > REG_EQUAL note. Given that multiplication isn't supported in V1TImode, > > the REG_NOTE handling code wasn't expecting to see a MULT. Easily solv= ed > > with additional handling for other binary operators that may potentiall= y > > (in future) have an immediate constant as the second operand that needs > > handling. For convenience, this code (re)factors the logic to convert > > a TImode constant into a V1TImode constant vector into a subroutine and > > reuses it. > > > > For the record, STV is actually doing something useful in this strange > > testcase, GCC with -O2 -fno-dce -fno-forward-propagate > > -fno-split-wide-types > > -funroll-loops generates: > > > > foo: movl $v, %eax > > pxor %xmm0, %xmm0 > > movaps %xmm0, 48(%rax) > > movaps %xmm0, (%rax) > > movaps %xmm0, 16(%rax) > > movaps %xmm0, 32(%rax) > > ret > > > > With the addition of -mno-stv (to disable the patched code) it gives: > > > > foo: movl $v, %eax > > movq $0, 48(%rax) > > movq $0, 56(%rax) > > movq $0, (%rax) > > movq $0, 8(%rax) > > movq $0, 16(%rax) > > movq $0, 24(%rax) > > movq $0, 32(%rax) > > movq $0, 40(%rax) > > ret > > > > > > This patch has been tested on x86_64-pc-linux-gnu with make bootstrap > > and make -k check, both with and without --target_board=3Dunix{-m32} > > with no new failures. Ok for mainline? > > > > > > 2024-02-05 Roger Sayle > > > > gcc/ChangeLog > > PR target/113690 > > * config/i386/i386-features.cc (timode_convert_cst): New helper > > function to convert a TImode CONST_SCALAR_INT_P to a V1TImode > > CONST_VECTOR. > > (timode_scalar_chain::convert_op): Use timode_convert_cst. > > (timode_scalar_chain::convert_insn): If a REG_EQUAL note contai= ns > > a binary operator where the second operand is an immediate inte= ger > > constant, convert it to V1TImode using timode_convert_cst. > > Use timode_convert_cst. > > > > gcc/testsuite/ChangeLog > > PR target/113690 > > * gcc.target/i386/pr113690.c: New test case. > > OK. OTOH, how about we follow the approach from general_scalar_chain::convert_insn and just kill the note? Uros.