From patchwork Tue Mar 1 00:22:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 590256 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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 F2E3C140BA6 for ; Tue, 1 Mar 2016 11:22:49 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=OWtemN1z; dkim-atps=neutral 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:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=um1VyKZggE0M4JEXu8++aVelbw/qvEy7v/X79MKSL6OC6vD5EEMxu MFGUsyDOrzi1pkpoB2TaIQFuzJzIjHKDLxbPl4wNyAZcDGlTXp+4dFkKZZZjt0bO l2d8u9Nxc2bz1jp7p0+dX84Bb7jfqoeIpJI4JNy4HrQ1ximJgTwtiU= 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:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; s=default; bh=Wnse1TbuxM5fyMgFo4tYsboEQpw=; b=OWtemN1zM9kHh73u9ZT8Tuc19Af9 76lS9SzWkjLpz569yEb2YAxEgXNczWd3doMCWynPOd9xU06GnBZs6EvoSMbfIkfr GrRC6PiipADO39TFRsC7cNPUhOGhcK1ylUtypfVYtpuVCYg+pQIBjR2D4VKp0YY1 7PBXDLD4MkEzLtk= Received: (qmail 18151 invoked by alias); 1 Mar 2016 00:22:41 -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 18142 invoked by uid 89); 1 Mar 2016 00:22:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.9 required=5.0 tests=AWL, BAYES_50, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=cum, sk:aggrega, sk:AGGREGA, Hx-languages-length:2671 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 01 Mar 2016 00:22:39 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 25645812F5; Tue, 1 Mar 2016 01:22:36 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZPMHTnyQQUO3; Tue, 1 Mar 2016 01:22:36 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id EBB47812F4; Tue, 1 Mar 2016 01:22:35 +0100 (CET) From: Eric Botcazou To: Uros Bizjak Cc: gcc-patches@gcc.gnu.org Subject: Re: [SPARC] Fix PR target/69706 Date: Tue, 01 Mar 2016 01:22:35 +0100 Message-ID: <1798610.LvR26iygsb@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-35-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 > +/* Number of words (partially) occupied for a given size in units. */ > +#define NWORDS_UP(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) > > -#define ROUND_ADVANCE(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / > UNITS_PER_WORD) > > You can use CEIL macro from system.h here. Good idea, thanks, applied on the mainline. PR target/69706 * config/sparc/sparc.c (NWORDS_UP): Rename to... (CEIL_NWORDS): ...this. Use CEIL macro. (compute_fp_layout): Adjust to above renaming. (function_arg_union_value): Likewise. (sparc_arg_partial_bytes): Likewise. (sparc_function_arg_advance): Likewise. Index: config/sparc/sparc.c =================================================================== --- config/sparc/sparc.c (revision 233808) +++ config/sparc/sparc.c (working copy) @@ -6086,7 +6086,7 @@ conventions. */ /* Maximum number of fp regs for args. */ #define SPARC_FP_ARG_MAX 16 /* Number of words (partially) occupied for a given size in units. */ -#define NWORDS_UP(SIZE) (((SIZE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD) +#define CEIL_NWORDS(SIZE) CEIL((SIZE), UNITS_PER_WORD) /* Handle the INIT_CUMULATIVE_ARGS macro. Initialize a variable CUM of type CUMULATIVE_ARGS @@ -6429,7 +6429,7 @@ compute_fp_layout (const_tree field, HOS else nregs = 1; - nslots = NWORDS_UP (nregs * GET_MODE_SIZE (mode)); + nslots = CEIL_NWORDS (nregs * GET_MODE_SIZE (mode)); if (nslots > SPARC_FP_ARG_MAX - this_slotno) { @@ -6661,7 +6661,7 @@ static rtx function_arg_union_value (int size, machine_mode mode, int slotno, int regno) { - int nwords = NWORDS_UP (size), i; + int nwords = CEIL_NWORDS (size), i; rtx regs; /* See comment in previous function for empty structures. */ @@ -6893,8 +6893,8 @@ sparc_arg_partial_bytes (cumulative_args if (TARGET_ARCH32) { if ((slotno + (mode == BLKmode - ? NWORDS_UP (int_size_in_bytes (type)) - : NWORDS_UP (GET_MODE_SIZE (mode)))) + ? CEIL_NWORDS (int_size_in_bytes (type)) + : CEIL_NWORDS (GET_MODE_SIZE (mode)))) > SPARC_INT_ARG_MAX) return (SPARC_INT_ARG_MAX - slotno) * UNITS_PER_WORD; } @@ -7004,8 +7004,8 @@ sparc_function_arg_advance (cumulative_a if (TARGET_ARCH32) cum->words += (mode == BLKmode - ? NWORDS_UP (int_size_in_bytes (type)) - : NWORDS_UP (GET_MODE_SIZE (mode))); + ? CEIL_NWORDS (int_size_in_bytes (type)) + : CEIL_NWORDS (GET_MODE_SIZE (mode))); else { if (type && AGGREGATE_TYPE_P (type)) @@ -7021,8 +7021,8 @@ sparc_function_arg_advance (cumulative_a } else cum->words += (mode == BLKmode - ? NWORDS_UP (int_size_in_bytes (type)) - : NWORDS_UP (GET_MODE_SIZE (mode))); + ? CEIL_NWORDS (int_size_in_bytes (type)) + : CEIL_NWORDS (GET_MODE_SIZE (mode))); } }