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: 84317 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A7CDF3858C31 for ; Thu, 18 Jan 2024 07:27:06 +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+patchwork=sourceware.org@gcc.gnu.org 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; } }