From patchwork Tue Jan 21 16:25:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 1226660 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-517913-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha1 header.s=default header.b=flkmuqPp; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 482DS15P8cz9s1x for ; Wed, 22 Jan 2020 03:26:08 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=geZ3OzAThJ4F34FDny9mV36kMsVEOyKb3QamSuSdyJtyi1GbIzU7s MAfHVlETMCNAoz2E5dRzNF2AuVKOBj7b8oSDHQ6/f0E1WPyYpY1D/D0Q8t5GJuxb yWYLioBqGU7oatTIRWXMhHyeazEE8U0io45kTOkCI4maEwj8qso3/M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=9Vg57oPPyqTxbgEZ8usmw47EJYA=; b=flkmuqPpfK/Tiz1Gn05r vF6newhlwP68TSTbVL43ySTewcLOvzz80c47D5fUziHkA6v+9eZLzpBBa5+SU5o2 vpgaHqoKuOkS7ZJBm/9rIiKVYty/evJt3KMcAdRZ9azzrjyA0tv0Dsu1cGGKPZzu QmrmLpgloTsJPMwWEa6MPjw= Received: (qmail 41409 invoked by alias); 21 Jan 2020 16:26:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 41395 invoked by uid 89); 21 Jan 2020 16:25:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy= X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.110.172) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Jan 2020 16:25:49 +0000 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 178F730E for ; Tue, 21 Jan 2020 08:25:48 -0800 (PST) Received: from localhost (e121540-lin.manchester.arm.com [10.32.98.126]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B405B3F68E for ; Tue, 21 Jan 2020 08:25:47 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@arm.com Subject: [committed] aarch64: Fix SVE ACLE handling of SImode pointers Date: Tue, 21 Jan 2020 16:25:46 +0000 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 X-IsSubscribed: yes This long-overdue patch promotes SImode pointers to DImode addresses, avoiding various ICEs in the existing tests. Tested on aarch64-linux-gnu and aarch64_be-elf, applied. There are still other ILP32-related ACLE failures to go... Richard 2020-01-21 Richard Sandiford gcc/ * config/aarch64/aarch64-sve-builtins.h (function_expander::convert_to_pmode): Declare. * config/aarch64/aarch64-sve-builtins.cc (function_expander::convert_to_pmode): New function. (function_expander::get_contiguous_base): Use it. (function_expander::prepare_gather_address_operands): Likewise. * config/aarch64/aarch64-sve-builtins-sve2.cc (svwhilerw_svwhilewr_impl::expand): Likewise. --- gcc/config/aarch64/aarch64-sve-builtins-sve2.cc | 2 ++ gcc/config/aarch64/aarch64-sve-builtins.cc | 15 +++++++++++---- gcc/config/aarch64/aarch64-sve-builtins.h | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gcc/config/aarch64/aarch64-sve-builtins.h b/gcc/config/aarch64/aarch64-sve-builtins.h index f307233f777..9513b497368 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.h +++ b/gcc/config/aarch64/aarch64-sve-builtins.h @@ -526,6 +526,7 @@ public: bool overlaps_input_p (rtx); + rtx convert_to_pmode (rtx); rtx get_contiguous_base (machine_mode); rtx get_fallback_value (machine_mode, unsigned int, unsigned int, unsigned int &); diff --git a/gcc/config/aarch64/aarch64-sve-builtins.cc b/gcc/config/aarch64/aarch64-sve-builtins.cc index 587530a61bd..3d1b610cfd6 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins.cc @@ -2602,12 +2602,21 @@ function_expander::overlaps_input_p (rtx x) return false; } +/* Convert ptr_mode value X to Pmode. */ +rtx +function_expander::convert_to_pmode (rtx x) +{ + if (ptr_mode == SImode) + x = simplify_gen_unary (ZERO_EXTEND, DImode, x, SImode); + return x; +} + /* Return the base address for a contiguous load or store function. MEM_MODE is the mode of the addressed memory. */ rtx function_expander::get_contiguous_base (machine_mode mem_mode) { - rtx base = args[1]; + rtx base = convert_to_pmode (args[1]); if (mode_suffix_id == MODE_vnum) { /* Use the size of the memory mode for extending loads and truncating @@ -2814,9 +2823,7 @@ function_expander::prepare_gather_address_operands (unsigned int argno, { /* Scalar base, vector displacement. This is the order that the md pattern wants. */ - if (Pmode == SImode) - args[argno] = simplify_gen_unary (ZERO_EXTEND, DImode, - args[argno], SImode); + args[argno] = convert_to_pmode (args[argno]); vector_type = displacement_vector_type (); if (units == UNITS_elements && !scaled_p) shift_idx = argno + 1; diff --git a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc index fa3b50680ba..53b16511623 100644 --- a/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc +++ b/gcc/config/aarch64/aarch64-sve-builtins-sve2.cc @@ -442,6 +442,8 @@ public: rtx expand (function_expander &e) const OVERRIDE { + for (unsigned int i = 0; i < 2; ++i) + e.args[i] = e.convert_to_pmode (e.args[i]); return e.use_exact_insn (code_for_while (m_unspec, Pmode, e.gp_mode (0))); }