Message ID | ZboIYMC/12V1YSKi@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1754155dyb; Wed, 31 Jan 2024 00:50:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJyH8NYnN4nFWSW1RWohU7CdRfF4nXsoDnkEBkGvamZR+7pVo45mAJelG+XOfFKFGQ9xmE X-Received: by 2002:a81:7e44:0:b0:5ff:6c4d:fe34 with SMTP id p4-20020a817e44000000b005ff6c4dfe34mr731979ywn.48.1706691043805; Wed, 31 Jan 2024 00:50:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706691043; cv=pass; d=google.com; s=arc-20160816; b=Lhn+nY2OKY43STN4QU+i/GzaRdG88ReuwXyX3Uf5NJbqUcnoFSfUTX+9AzBxeuizTy T9ptgupCsWPzoA3E0WKp64hXg1LGMZPwIPGPxgGvFaKvORCdB83FV0ZaW3wWidrU1Ta1 i46rO8jtXF9Ikr49rTyvScQRgzI0vtv5dElu9IWmC0iY/mrh65ZkadQ5BDEYXovPqA+J LVQoOKCq1yqb50OiuKZrL/wDC4WzS5vIGrBAWpKTJEvxHS/M1MwhWJ5XIxKMypMJZWS/ 7kpUUXPEZDZSQ7ra7nFMc60WnTXunUSu4bAohZGoNyyfIXf2GcUXbe1+lmkmUbPU1J4l gkkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-disposition :mime-version:message-id:subject:cc:to:from:date:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=CGz39W9GgzgCXXpqMpeqZ4aYG8BuIX2ljFA5zyIssHM=; fh=OqgEuJva1eN0lTaXZJxTbXF028HRkNrICY+RuVGPJbM=; b=b8o0iRehJ1dIhAb/6oVTckpLw91dYt9vettPJeX2sU/nmreHr4lK4pilsqB45gWn5o jkWDuaeBCChvC3p5sKafvF2CJLXq/7mQxF74+/0JIIbMK6t7qMNPSmS4G4IV528ayDDe ebYMBDh4YP10MlP7uBZiH9LCD3c9PMgh3grOMPWwx5aJ1/W9OAstR6wqhUxeV2dwbTPn 5gM464FTPSffXkBfH8TdzdtggrZnkJ7rd12tlc8SmdaGi7pgn5/N0u7DPfG04Rd5T1ly HB852mCOnlmMfFU0hzS2EevKTV/ZW5F2aVuhkqSeznHs+Sg2OwRXNiBCqSesAtD++1g4 ICAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ci/UdeXA"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=1; AJvYcCV0kh0S1Kvs1N+sdNzRwG3J+J6gOrfsRwBMJXFlc2eDBPi1XQOBTbUBfUvlFrNUnN2QsYVNXoYJrQZPE50C0kpQb+gLwA== Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q20-20020a05622a04d400b0042a3d046e17si11770980qtx.335.2024.01.31.00.50.43 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:50:43 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="ci/UdeXA"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5D409385801F for <ouuuleilei@gmail.com>; Wed, 31 Jan 2024 08:50:43 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 9615638582A1 for <gcc-patches@gcc.gnu.org>; Wed, 31 Jan 2024 08:44:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9615638582A1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9615638582A1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706690673; cv=none; b=TRFepKgy3jJxaERCIHCbaAqtV/kqt5lay1MDODK6omh7XddaaMmJf2HKbjbW0IQpL61cum4DnBtExWgfudOTh1t8cDKSNx++5JbchUOuWD2cbKifMI2/Fmk4yutAfT8ckEz4risp7SUO59tJB91jFfGVLPtZHyIyNqQz93ohcUY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706690673; c=relaxed/simple; bh=4VfA0Yt3+4IIsRRo1hei2OCtYVgoLU6Nl71T30//FpM=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=wqtMvLvQuwbFpQcbje/O0qUlZ2kNLJx5r76UNgsLvflgxP/FyyYeAGuWOrEmK0iCnCA0F8V+BUe7r8hjL8rQH0jAkrlFhSaDPtqTvYSedYJuZ0h8PMYt2cj5639XDFTfszlhOzYmJqrQOoKmU6v1hzsXK6fGCGy1YFqK9sIlhFI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706690665; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=CGz39W9GgzgCXXpqMpeqZ4aYG8BuIX2ljFA5zyIssHM=; b=ci/UdeXAJi53X3uex07GqgeaZ4xaZGkZ5Hx+yshRyIV5tWTAa9gtGpaYsTIJOW5tHcOWJ8 FxpehTRhq2w7YiIAfzRhu1SZRI/1NHI2oOqbkHdsyYndfhOc3260ZK94U4zq1DG3OCZO2d GzV5A3nfT0ALXk140K61yOT3pLZy2RU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-677-Ae9m3-BUNFu0cFG5koYfSQ-1; Wed, 31 Jan 2024 03:44:22 -0500 X-MC-Unique: Ae9m3-BUNFu0cFG5koYfSQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E8B9794632D; Wed, 31 Jan 2024 08:44:21 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 799311C060AF; Wed, 31 Jan 2024 08:44:21 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.17.1/8.17.1) with ESMTPS id 40V8iIF5267029 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 31 Jan 2024 09:44:18 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40V8iG2U267028; Wed, 31 Jan 2024 09:44:16 +0100 Date: Wed, 31 Jan 2024 09:44:16 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de>, Eric Botcazou <botcazou@adacore.com>, Segher Boessenkool <segher@kernel.crashing.org>, Jeff Law <jeffreyalaw@gmail.com> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] simplify-rtx: Fix up last argument to simplify_gen_unary [PR113656] Message-ID: <ZboIYMC/12V1YSKi@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: Jakub Jelinek <jakub@redhat.com> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789595267891730450 X-GMAIL-MSGID: 1789595267891730450 |
Series |
simplify-rtx: Fix up last argument to simplify_gen_unary [PR113656]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Jan. 31, 2024, 8:44 a.m. UTC
Hi! When simplifying e.g. (float_truncate:SF (float_truncate:DF (reg:XF)) or (float_truncate:SF (float_extend:XF (reg:DF)) etc. into (float_truncate:SF (reg:XF)) or (float_truncate:SF (reg:DF)) we call simplify_gen_unary with incorrect op_mode argument, it should be the argument's mode, but we call it with the outer mode instead. As these are all floating point operations, the argument always has non-VOIDmode and so we can just use that mode (as done in similar simplifications a few lines later), but neither FLOAT_TRUNCATE nor FLOAT_EXTEND are operations that should have the same modes of operand and result. This bug hasn't been a problem for years because normally op_mode is used only if the mode of op is VOIDmode, otherwise it is redundant, but r10-2139 added an assertion in some spots that op_mode is right even in such cases. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-31 Jakub Jelinek <jakub@redhat.com> PR rtl-optimization/113656 * simplify-rtx.cc (simplify_context::simplify_unary_operation_1) <case FLOAT_TRUNCATE>: Fix up last argument to simplify_gen_unary. * gcc.target/i386/pr113656.c: New test. Jakub
Comments
On Wed, 31 Jan 2024, Jakub Jelinek wrote: > Hi! > > When simplifying e.g. (float_truncate:SF (float_truncate:DF (reg:XF)) > or (float_truncate:SF (float_extend:XF (reg:DF)) etc. into > (float_truncate:SF (reg:XF)) or (float_truncate:SF (reg:DF)) we call > simplify_gen_unary with incorrect op_mode argument, it should be > the argument's mode, but we call it with the outer mode instead. > As these are all floating point operations, the argument always > has non-VOIDmode and so we can just use that mode (as done in similar > simplifications a few lines later), but neither FLOAT_TRUNCATE nor > FLOAT_EXTEND are operations that should have the same modes of operand > and result. This bug hasn't been a problem for years because normally > op_mode is used only if the mode of op is VOIDmode, otherwise it is > redundant, but r10-2139 added an assertion in some spots that op_mode > is right even in such cases. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. > 2024-01-31 Jakub Jelinek <jakub@redhat.com> > > PR rtl-optimization/113656 > * simplify-rtx.cc (simplify_context::simplify_unary_operation_1) > <case FLOAT_TRUNCATE>: Fix up last argument to simplify_gen_unary. > > * gcc.target/i386/pr113656.c: New test. > > --- gcc/simplify-rtx.cc.jj 2024-01-03 11:51:32.828713189 +0100 > +++ gcc/simplify-rtx.cc 2024-01-30 19:34:30.516934480 +0100 > @@ -1305,7 +1305,7 @@ simplify_context::simplify_unary_operati > > GET_MODE_UNIT_SIZE (mode) > ? FLOAT_TRUNCATE : FLOAT_EXTEND, > mode, > - XEXP (op, 0), mode); > + XEXP (op, 0), GET_MODE (XEXP (op, 0))); > > /* (float_truncate (float x)) is (float x) */ > if ((GET_CODE (op) == FLOAT || GET_CODE (op) == UNSIGNED_FLOAT) > --- gcc/testsuite/gcc.target/i386/pr113656.c.jj 2024-01-30 19:38:29.029608721 +0100 > +++ gcc/testsuite/gcc.target/i386/pr113656.c 2024-01-30 19:37:10.519703443 +0100 > @@ -0,0 +1,12 @@ > +/* PR rtl-optimization/113656 */ > +/* { dg-do compile } */ > +/* { dg-options "-O3 -frounding-math -funsafe-math-optimizations -mavx512fp16 -mavx512vl" } */ > + > +_Float16 a[8]; > + > +void > +foo () > +{ > + for (int i = 0; i < 8; i++) > + a[i] = i - 8.4; > +} > > Jakub > >
--- gcc/simplify-rtx.cc.jj 2024-01-03 11:51:32.828713189 +0100 +++ gcc/simplify-rtx.cc 2024-01-30 19:34:30.516934480 +0100 @@ -1305,7 +1305,7 @@ simplify_context::simplify_unary_operati > GET_MODE_UNIT_SIZE (mode) ? FLOAT_TRUNCATE : FLOAT_EXTEND, mode, - XEXP (op, 0), mode); + XEXP (op, 0), GET_MODE (XEXP (op, 0))); /* (float_truncate (float x)) is (float x) */ if ((GET_CODE (op) == FLOAT || GET_CODE (op) == UNSIGNED_FLOAT) --- gcc/testsuite/gcc.target/i386/pr113656.c.jj 2024-01-30 19:38:29.029608721 +0100 +++ gcc/testsuite/gcc.target/i386/pr113656.c 2024-01-30 19:37:10.519703443 +0100 @@ -0,0 +1,12 @@ +/* PR rtl-optimization/113656 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -frounding-math -funsafe-math-optimizations -mavx512fp16 -mavx512vl" } */ + +_Float16 a[8]; + +void +foo () +{ + for (int i = 0; i < 8; i++) + a[i] = i - 8.4; +}