From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by sourceware.org (Postfix) with ESMTPS id E5ED53858C54 for ; Mon, 5 Feb 2024 08:06:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E5ED53858C54 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 E5ED53858C54 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::531 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707120396; cv=none; b=t43KoONz9raWCMeDdAJBiv3zTuFLRPjLNa8WcRoe9VOqZlRWKKioqaVToAwkzPq8rDRwI29VO4XwHzS4uGSAt+W9s1NyyDgslzoDX5CER3zneZfYoB9Kw3K6gJQtKxrTJKZlu+SBqCzZykdNITIsP6BgQNPB/aNjECcyTUSwi28= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707120396; c=relaxed/simple; bh=hFzzG/5qbMd3Ond/0imfAlAIP/hZ+NwfFVIAAeGuidY=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=FQvocq3Xbz4GFqJtvnGUPX7/L1XebDc+lr03B4MlDs8Llf5dCleR1+IHxFNDLSTfEatYt9Ih1JD/HMYDhmL+KLSrvV9PVszPolDf8KnUbP8Q+DFj0JciCR3hsgQoSlUsrYe9f8F8SqV0UWAEKKp+pOU9WBbmGskmewvmS/zom44= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x531.google.com with SMTP id 4fb4d7f45d1cf-55c2cf644f3so4911745a12.1 for ; Mon, 05 Feb 2024 00:06:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707120393; x=1707725193; 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=ycsW+EkL8jCezxJh/hDboCnv8Bx9Jzr7elpPfzscYv8=; b=ngoMY28nrlwGWh3A7Sca750uL6aS1HOwj4KO8EcH7pwL5lPUz1HP8UB8M/5VjDaOst IiPUxWfmats7SoyXplpktMOwZI83jIbQKih01hL3KEmRbZZ3mTIQQ6jt11lSFrqbk3pU ziikc3T6u++C/o4yUUDqH4tLgIWI0BskVD28WR7zV2oOpZSofcdkIRKwx4pM6t5Gd68R D2e30DgI5PhAMg6OTugrfahpFNXptHPzRymXH4C5Wx6N0nstnJ0hNUrNR7T3eQjGQolZ 4bbXxth4D+n4TyuhHvL/qtBurxF57zpXdxpCA3roKjBJbksXCnODfabUAyO3Tfr8XmC9 jrEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707120393; x=1707725193; 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=ycsW+EkL8jCezxJh/hDboCnv8Bx9Jzr7elpPfzscYv8=; b=M+beAa3fk0lJKqLcQ28UlEW3Dm7fY1xt2/AAlSh+LyUeNh0a2TOFoTq7Sxw/dvn1mf EHV/lboAYRLOt7piom5oWchFQywQrBDAkEC2E/b/8R6YaUdq0cevKIC9cOs2LQTe9tDe 9Wyab1D+swTOCl+1oFKVPTk/YTqhnbLCdayvnj5iZWI7hp5lcOY6NlBr+pjdtBCKgR7Y QU10SjnVtlSfaJxH5KvcOKoxZr7dHS02XFeCBYAfqv+xsVjCOFS67BgAEYY6pQTAXCXN z3LZrHC+0xXYAX9tL7psTucT4STma81dfIdsV6VujYZgrwMhK/ksOAMNlNMuYACrN3Db hq4g== X-Gm-Message-State: AOJu0YwOWXW16wW4sJ/E2adqbR/eoprJOyrPRk6EacnrM5/bY0xGD3BQ 4Ombsw6Y51a7INCFtlokrDGVh99bkzh8E6YnQl+YGrf//mmHg+ZLS3JjBWkTfheM1rAMHMPddsC EfshioYp4PPss9QNTsnfC+MVNwmXDQkyOQrw= X-Google-Smtp-Source: AGHT+IG/2XDz14b39J4J47IRz+Pa+i2XHYE8gb8N9DDyHokfgys/4Gjp37KCYyFCLwELC0/1b2u9xsLddhOfYOB7n7Y= X-Received: by 2002:a05:6402:1b0d:b0:560:8010:b680 with SMTP id by13-20020a0564021b0d00b005608010b680mr505424edb.36.1707120393210; Mon, 05 Feb 2024 00:06:33 -0800 (PST) MIME-Version: 1.0 References: <00b701da57c9$b7444a80$25ccdf80$@nextmovesoftware.com> In-Reply-To: <00b701da57c9$b7444a80$25ccdf80$@nextmovesoftware.com> From: Uros Bizjak Date: Mon, 5 Feb 2024 09:06:21 +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.3 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 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 instruction= s > 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 solved > with additional handling for other binary operators that may potentially > (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 contains > a binary operator where the second operand is an immediate intege= r > 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. Thanks, Uros. > > > Thanks in advance, > Roger > -- >