Message ID | ZaeiEBnIn3rFpAMb@tucnak |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp797800dye; Wed, 17 Jan 2024 01:47:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEbermQMl6aMdbTxbdGy9JHKcFhOCLHMwpeYfoEP1szBbHA/VTfgzDA4nYdSulUZL3Hdvxv X-Received: by 2002:a05:620a:20de:b0:781:1c3c:da61 with SMTP id f30-20020a05620a20de00b007811c3cda61mr8823756qka.154.1705484867959; Wed, 17 Jan 2024 01:47:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705484867; cv=pass; d=google.com; s=arc-20160816; b=evF1y3yjxzPqiT/qtoo+feDr/Yta9bg8ai3iDd9Rj7zVvBF2iCLWH058fqaJbx0pxf 2XkywqduTebFM59mREjmhDfL2Io3wdjs7U7FCNKdoBrHGcbh5nPSsn95PbOvVh9lYCg3 Wy5Df+u2WNKube1FMe/HKmjfGzzFMKhGEBGjEox8N5oSoaVmDGLhF0Ft+Bsu2AsoQH/s f348FZ9wCGWPrwXP2J4ZqOpEb6uCgJodVwufNwCdBDrgi3flPHykxTtqi7owRwEYLf4D EmZe/clpe8f/V8hwuSYClvWt64q1R4GlkTk/Zw0eRS3JCVHhq0ymt4ru+rZ8yr4xeSbU 81Pw== 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=142FoCsgvz/3bK0wBQGCmW0BqSw2Mq40Ncrk56AiVHY=; fh=FCjeRajqaQYHMkQtfIia8KT5yBac53mYOLLyJhYG/AY=; b=JvQGhJexfFGhlkcc/J3OCwwn6MZF+TtByxuKNbsfO74317aa9mAwXWdfGg8uHtBiMV EKz99Q1fWPOvNoCkktsb6ps1rKkpn+Jow+cSSlKtvcxGGlZV81L/RdRBt1wcbQeDGxUy F8JW5Y7vqlGIe4jEbuUYPxfD6WiGlrR39+jodnuOViBDoNcEa7tq1lL1UggIM9mjBKFm hP7QBL19M5ZqR5AseO4elfpfH95sgxeI9MZ+/xiyt7Bz632DIsP07vjlJfv8x1ndIhMq a5uiz1ROfXpZS19TUpBZCXDqBfWmJM3djud6ZRDI75gdWm3IyTgz7+jfcxKqOgpk1Umd 9yVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="c/7LBK6U"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id u16-20020a05620a023000b0078372b91826si906219qkm.90.2024.01.17.01.47.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 01:47:47 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="c/7LBK6U"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 A5C2D385840A for <ouuuleilei@gmail.com>; Wed, 17 Jan 2024 09:47:47 +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 0E8DA3858D20 for <gcc-patches@gcc.gnu.org>; Wed, 17 Jan 2024 09:47:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0E8DA3858D20 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 0E8DA3858D20 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=1705484826; cv=none; b=Pzff7KBQRK+Oi4Cc2PgCio00qKXbb6qNTA0DBOtMdzRHbbxidW7mp1zonczhzOz0Gs9G0A5ZkQqmHYrmiN/bVc1E4gHitNnWpSBf6pxno69u3/C08j8XxT8q83AikrCHjF1Yzzvik8fIr69OilsfICOi+w5AlbTghkxpFfnxH20= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705484826; c=relaxed/simple; bh=iF7tTBs5pIVv/JYcJFKmNk0jn6etkpR/+XJnhN+e9O8=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=ENzQhZxNCLCJe/fAxdGxSXzdjchCSWthKy+0W795BjczqWdr3SJ/9mFBZ7yLnDk8l13ZCr4aGKxivI9ndUoIP0huWp55yj3tAVWlfbyXUPvXUOoeEo+9/rpMqWm1r0B5Mxh8wxS5jdHkJDFbv5P2+F8FeG0OtMrelGAvmPmDDpE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705484822; 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=142FoCsgvz/3bK0wBQGCmW0BqSw2Mq40Ncrk56AiVHY=; b=c/7LBK6UET7yhBzlfmG2BJ0fOgHz1a6J1b2d15IotAZVGWgxoOZrACuno/fro6/a4ooUiK FjDpMZJHZOXdCRwJlNtMna7+CEFKGAP2UK2xFLyd1fwVqloqzkwD6g/MkA5IkCvi2rmJL/ s7ZdUeEi6yaPbjpsit4Wgd165ahpG9E= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-287-9nf6GJZUOmqDSCGBypxUSg-1; Wed, 17 Jan 2024 04:47:00 -0500 X-MC-Unique: 9nf6GJZUOmqDSCGBypxUSg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 81EED299E749; Wed, 17 Jan 2024 09:47:00 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 467DA51E3; Wed, 17 Jan 2024 09:47:00 +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 40H9kvCm2306864 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 10:46:58 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40H9kvcH2306861; Wed, 17 Jan 2024 10:46:57 +0100 Date: Wed, 17 Jan 2024 10:46:56 +0100 From: Jakub Jelinek <jakub@redhat.com> To: Richard Biener <rguenther@suse.de> Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Fix up VIEW_CONVERT_EXPR handling [PR113408] Message-ID: <ZaeiEBnIn3rFpAMb@tucnak> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 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.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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: 1788330500829727785 X-GMAIL-MSGID: 1788330500829727785 |
Series |
lower-bitint: Fix up VIEW_CONVERT_EXPR handling [PR113408]
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Jakub Jelinek
Jan. 17, 2024, 9:46 a.m. UTC
Hi! Unlike NOP_EXPR/CONVERT_EXPR which are GIMPLE_UNARY_RHS, VIEW_CONVERT_EXPR is GIMPLE_SINGLE_RHS and so gimple_assign_rhs1 contains the operand wrapped in VIEW_CONVERT_EXPR tree. So, to handle it like other casts we need to look through it. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-17 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/113408 * gimple-lower-bitint.cc (bitint_large_huge::handle_stmt): For VIEW_CONVERT_EXPR, pass TREE_OPERAND (rhs1, 0) rather than rhs1 to handle_cast. * gcc.dg/bitint-71.c: New test. Jakub
Comments
On Wed, 17 Jan 2024, Jakub Jelinek wrote: > Hi! > > Unlike NOP_EXPR/CONVERT_EXPR which are GIMPLE_UNARY_RHS, VIEW_CONVERT_EXPR > is GIMPLE_SINGLE_RHS and so gimple_assign_rhs1 contains the operand wrapped > in VIEW_CONVERT_EXPR tree. > > So, to handle it like other casts we need to look through it. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? OK. > 2024-01-17 Jakub Jelinek <jakub@redhat.com> > > PR tree-optimization/113408 > * gimple-lower-bitint.cc (bitint_large_huge::handle_stmt): For > VIEW_CONVERT_EXPR, pass TREE_OPERAND (rhs1, 0) rather than rhs1 > to handle_cast. > > * gcc.dg/bitint-71.c: New test. > > --- gcc/gimple-lower-bitint.cc.jj 2024-01-15 17:34:00.000000000 +0100 > +++ gcc/gimple-lower-bitint.cc 2024-01-16 12:32:56.617721208 +0100 > @@ -1975,9 +1975,12 @@ bitint_large_huge::handle_stmt (gimple * > case INTEGER_CST: > return handle_operand (gimple_assign_rhs1 (stmt), idx); > CASE_CONVERT: > - case VIEW_CONVERT_EXPR: > return handle_cast (TREE_TYPE (gimple_assign_lhs (stmt)), > gimple_assign_rhs1 (stmt), idx); > + case VIEW_CONVERT_EXPR: > + return handle_cast (TREE_TYPE (gimple_assign_lhs (stmt)), > + TREE_OPERAND (gimple_assign_rhs1 (stmt), 0), > + idx); > default: > break; > } > --- gcc/testsuite/gcc.dg/bitint-71.c.jj 2024-01-16 12:38:16.679239526 +0100 > +++ gcc/testsuite/gcc.dg/bitint-71.c 2024-01-16 12:37:24.724967020 +0100 > @@ -0,0 +1,18 @@ > +/* PR tree-optimization/113408 */ > +/* { dg-do compile { target bitint } } */ > +/* { dg-options "-std=c23 -O2" } */ > + > +#if __BITINT_MAXWIDTH__ >= 713 > +struct A { _BitInt(713) b; } g; > +#else > +struct A { _BitInt(49) b; } g; > +#endif > +int f; > + > +void > +foo (void) > +{ > + struct A j = g; > + if (j.b) > + f = 0; > +} > > Jakub > >
--- gcc/gimple-lower-bitint.cc.jj 2024-01-15 17:34:00.000000000 +0100 +++ gcc/gimple-lower-bitint.cc 2024-01-16 12:32:56.617721208 +0100 @@ -1975,9 +1975,12 @@ bitint_large_huge::handle_stmt (gimple * case INTEGER_CST: return handle_operand (gimple_assign_rhs1 (stmt), idx); CASE_CONVERT: - case VIEW_CONVERT_EXPR: return handle_cast (TREE_TYPE (gimple_assign_lhs (stmt)), gimple_assign_rhs1 (stmt), idx); + case VIEW_CONVERT_EXPR: + return handle_cast (TREE_TYPE (gimple_assign_lhs (stmt)), + TREE_OPERAND (gimple_assign_rhs1 (stmt), 0), + idx); default: break; } --- gcc/testsuite/gcc.dg/bitint-71.c.jj 2024-01-16 12:38:16.679239526 +0100 +++ gcc/testsuite/gcc.dg/bitint-71.c 2024-01-16 12:37:24.724967020 +0100 @@ -0,0 +1,18 @@ +/* PR tree-optimization/113408 */ +/* { dg-do compile { target bitint } } */ +/* { dg-options "-std=c23 -O2" } */ + +#if __BITINT_MAXWIDTH__ >= 713 +struct A { _BitInt(713) b; } g; +#else +struct A { _BitInt(49) b; } g; +#endif +int f; + +void +foo (void) +{ + struct A j = g; + if (j.b) + f = 0; +}