From patchwork Mon Oct 25 12:00:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Andre Vieira (lists)" X-Patchwork-Id: 1545725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=sUCtIHXo; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HdDJ169Psz9t0k for ; Mon, 25 Oct 2021 23:08:32 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1CF2F3858001 for ; Mon, 25 Oct 2021 12:08:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CF2F3858001 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1635163710; bh=KOwWS//Ze+sL/XeaRvY7SffkEJmmo7zxJ6eY/IlwaQA=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=sUCtIHXoXkPk4fCWEOIM9+hTHpX1Oll2Zyw2D045V4Mc+rsFQsl4LPMrBZ1CKpYhO tSYGzw6kbnhSOxtzwmP33FskD4xEunn405ElToexzToYqJeXkV3wz88yePFkPu49zF UDJsamz7gd/vjzJD7aBxsCG91NPuX/6wcoTPFmE0= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by sourceware.org (Postfix) with ESMTP id D6A3E3858410 for ; Mon, 25 Oct 2021 12:00:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D6A3E3858410 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 80D69D6E; Mon, 25 Oct 2021 05:00:52 -0700 (PDT) Received: from [10.57.23.87] (unknown [10.57.23.87]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F12533F5A1; Mon, 25 Oct 2021 05:00:51 -0700 (PDT) Message-ID: <53802562-2e6b-ea67-0f97-a32126702593@arm.com> Date: Mon, 25 Oct 2021 13:00:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.1 Content-Language: en-US To: "gcc-patches@gcc.gnu.org" Subject: [Aarch64] Fix alignment of neon loads & stores in gimple X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, BODY_8BITS, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "Andre Vieira \(lists\) via Gcc-patches" From: "Andre Vieira (lists)" Reply-To: "Andre Vieira \(lists\)" Cc: Richard Sandiford Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Hi, This fixes the alignment on the memory access type for neon loads & stores in the gimple lowering. Bootstrap ubsan on aarch64 builds again with this change. 2021-10-25  Andre Vieira  gcc/ChangeLog:         * config/aarch64/aarch64-builtins.c (aarch64_general_gimple_fold_builtin): Fix memory access         type alignment. Is this OK for trunk? Kind regards, Andre diff --git a/gcc/config/aarch64/aarch64-builtins.c b/gcc/config/aarch64/aarch64-builtins.c index a815e4cfbccab692ca688ba87c71b06c304abbfb..f5436baf5f8a65c340e05faa491d86a7847c37d3 100644 --- a/gcc/config/aarch64/aarch64-builtins.c +++ b/gcc/config/aarch64/aarch64-builtins.c @@ -2490,12 +2490,16 @@ aarch64_general_gimple_fold_builtin (unsigned int fcode, gcall *stmt, gimple_seq stmts = NULL; tree base = gimple_convert (&stmts, elt_ptr_type, args[0]); + /* Use element type alignment. */ + tree access_type + = build_aligned_type (simd_type.itype, + TYPE_ALIGN (TREE_TYPE (simd_type.itype))); if (stmts) gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); new_stmt = gimple_build_assign (gimple_get_lhs (stmt), fold_build2 (MEM_REF, - simd_type.itype, + access_type, base, zero)); } break; @@ -2512,13 +2516,16 @@ aarch64_general_gimple_fold_builtin (unsigned int fcode, gcall *stmt, gimple_seq stmts = NULL; tree base = gimple_convert (&stmts, elt_ptr_type, args[0]); + /* Use element type alignment. */ + tree access_type + = build_aligned_type (simd_type.itype, + TYPE_ALIGN (TREE_TYPE (simd_type.itype))); if (stmts) gsi_insert_seq_before (gsi, stmts, GSI_SAME_STMT); new_stmt - = gimple_build_assign (fold_build2 (MEM_REF, - simd_type.itype, - base, - zero), args[1]); + = gimple_build_assign (fold_build2 (MEM_REF, access_type, + base, zero), + args[1]); } break;