From patchwork Thu Jan 18 07:26:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 189018 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp177170dyb; Wed, 17 Jan 2024 23:27:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGelC+neqdwRddr/v0eGoeuqpsDcSpBR4WF7+x8AQ4FWOmkbaTCoL6D/hE4n+26ravAK3ca X-Received: by 2002:a05:622a:15c1:b0:42a:673:8aeb with SMTP id d1-20020a05622a15c100b0042a06738aebmr854899qty.15.1705562843257; Wed, 17 Jan 2024 23:27:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705562843; cv=pass; d=google.com; s=arc-20160816; b=yOxePHRj1v2dHAGoSeL99HDj6LwCrgvjMDrU3kq/ofFrJd78Nekp6oWDtniRM218XV Cmg1tMIF5QJ/1ZifsXvaHuFivTG1FUG4h0m4JbtyAq56i7VgoctVZ8+t7gARO3HaDuMT ohCQJOTVXgidXjmFsPEN+ynP8vPr7ATKYbk5huSCUyhTS2RoGMUIvMM7u8LhGCcc/0Tc PiFgmGW5GKEpf9pnI5Z09qNYa5JnQT/Dg99soariUiBnca/ACpj9mymkbf+3I4cpZRHc J4Ll48/zk6zN/bn4TwEbaQToP8mqBtqchVtUw86KB3CU3+SPaXRI1Ybuny1NTXXO0dHS o2bQ== 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=EXKqZu6R3JQkcr4vcMQ6egUN7RpPfAYfDVd1OCoUrUs=; fh=FCjeRajqaQYHMkQtfIia8KT5yBac53mYOLLyJhYG/AY=; b=cJDpAJRO2PYQOI6CzjNPvZnaDxCIOOr2E/wUkzCm3TiDcijBL5fHpb6Eg4oz42d+FB 1e2BUCNM6pDjI+EsIJFDDqU9EBwbbFnqIdLIl1UjnKBsxnJcLTUwNooAAy+HJ/nh4mM9 S9wNCIW7xHollWUc1byBbN3e3Y5PAqIt17rh7Ju8Ee/rfBdV4WtJVVd1dpWCRqOw4UPZ 1MbL+/IPZe+iBUvUKwapeBQRwZTTri7kPkd21V+Yw5tZ/citD4QM+f8v+hSe/oTVDakT XNV30qdwtGmvORy5JzBx+zYdGUKNyUOgnr1XUuf6NjRcE9OEuQ8MWmInWrfhym0qImJ/ +d0A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FgikMhEi; 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 g17-20020ac85d51000000b00429b94a7090si13243235qtx.596.2024.01.17.23.27.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 23:27:23 -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=FgikMhEi; 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 EC1593858C54 for ; Thu, 18 Jan 2024 07:27:22 +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 635713858420 for ; Thu, 18 Jan 2024 07:26:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 635713858420 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 635713858420 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=1705562792; cv=none; b=Vt+VGw5Mutvw8d7nRZJra41S7LcIaejKMSF6T+AwqS9id5GEwubbIyXb9/Qkcuv2z8gLnULsFtQupVRoJFfH3MC59eDWwv79BQbTfboFS2DE48EujWmJWHCP33gm+y2QGxeT24UCenBG4hKuvA/NUsEAYUupU/BnyWJbyNszO40= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1705562792; c=relaxed/simple; bh=HAleANtZXPDmu00zLVdMRjfU8K6G4v8QaFLHUDyXwog=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=wW6twREnWPLK57Or+aYAJ8cNMdCBGL7IXAvaRy3NuTTczUsfV1yEC/g2MIowUJarJAwKElvTaex1pogW+cMID1tGbwt5z5zhKrM3HbeQ9vRhAzuMXfTuxgxO1jqQlcdba1c/Mn9NYJ5lo4ngQbNILupDnkV8vsmtlv4C+b3krMk= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1705562791; 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=EXKqZu6R3JQkcr4vcMQ6egUN7RpPfAYfDVd1OCoUrUs=; b=FgikMhEiWwUz20WGLVWsmKnhuXnJpayy2/U02e5crvPJVG7Kz2AUKpAZuM7ucz2fbX/C4R UJpKQq5r5LJnN7ZAJusPC086Swh/TzyRGho/2Aedd4qQ9ZLYPLeMy9g46on7tQ/ecgbJKy owHjeH+NPrKKy9tfCWQn6Wm2PPHQGjA= 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-173-dOD5cIgHMiavkhm3WUVCDA-1; Thu, 18 Jan 2024 02:26:27 -0500 X-MC-Unique: dOD5cIgHMiavkhm3WUVCDA-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 467EA80007C; Thu, 18 Jan 2024 07:26:27 +0000 (UTC) Received: from tucnak.zalov.cz (unknown [10.39.192.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0B81A1120E; Thu, 18 Jan 2024 07:26:26 +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 40I7QOeA226772 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Thu, 18 Jan 2024 08:26:24 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.17.1/8.17.1/Submit) id 40I7QNUt226771; Thu, 18 Jan 2024 08:26:23 +0100 Date: Thu, 18 Jan 2024 08:26:23 +0100 From: Jakub Jelinek To: Richard Biener Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] lower-bitint: Force some arrays corresponding to large/huge _BitInt SSA_NAMEs to BLKmode Message-ID: 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-Disposition: inline X-Spam-Status: No, score=-4.3 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Jakub Jelinek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788412263984811188 X-GMAIL-MSGID: 1788412263984811188 Hi! On aarch64 the backend decides to use non-BLKmode for some arrays like unsigned long[4] - OImode in that case, but the corresponding BITINT_TYPEs have BLKmode (like structures containing that many limb elements). This both isn't a good idea (we really want such underlying vars to live in memory and access them there, rather than live in registers and access their parts in there) and causes ICEs during expansion (VIEW_CONVERT_EXPR from such OImode array to BLKmode BITINT_TYPE), so the following patch makes sure such arrays reflect the BLKmode of BITINT_TYPEs it is accessed with (if any). Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2024-01-18 Jakub Jelinek * gimple-lower-bitint.cc (gimple_lower_bitint): When creating array VAR_DECL for BITINT_TYPE SSA_NAMEs which have BLKmode, force DECL_MODE of those vars to be BLKmode as well. Jakub --- gcc/gimple-lower-bitint.cc.jj 2024-01-17 14:43:33.498961304 +0100 +++ gcc/gimple-lower-bitint.cc 2024-01-17 14:50:50.252889131 +0100 @@ -6348,7 +6348,15 @@ gimple_lower_bitint (void) tree s = ssa_name (i); int p = var_to_partition (large_huge.m_map, s); if (large_huge.m_vars[p] != NULL_TREE) - continue; + { + /* If BITINT_TYPE is BLKmode, make sure the underlying + variable is BLKmode as well. */ + if (TYPE_MODE (TREE_TYPE (s)) == BLKmode + && VAR_P (large_huge.m_vars[p]) + && DECL_MODE (large_huge.m_vars[p]) != BLKmode) + DECL_MODE (large_huge.m_vars[p]) = BLKmode; + continue; + } if (atype == NULL_TREE || !tree_int_cst_equal (TYPE_SIZE (atype), TYPE_SIZE (TREE_TYPE (s)))) @@ -6359,6 +6367,11 @@ gimple_lower_bitint (void) } large_huge.m_vars[p] = create_tmp_var (atype, "bitint"); mark_addressable (large_huge.m_vars[p]); + /* If BITINT_TYPE is BLKmode, make sure the underlying + variable is BLKmode as well. */ + if (TYPE_MODE (TREE_TYPE (s)) == BLKmode + && DECL_MODE (large_huge.m_vars[p]) != BLKmode) + DECL_MODE (large_huge.m_vars[p]) = BLKmode; } }