From patchwork Tue Oct 13 18:58:26 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 529894 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 2F18714016A for ; Wed, 14 Oct 2015 05:58:37 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=rP/2OLr7; 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 :mime-version:date:message-id:subject:from:to:content-type; q= dns; s=default; b=vsdsmwCXN6jsxi87tHZx2xUxh2G2tWGnhqBfuWIA9eh+Cd 0TWDeeSqQn7q53W6WVXZdChs/Xwe4oKLHJKpSG5COWHe0d4IdbbJeOlzPtUaeBoD tW5Ucc+o3vDiuXWGS949Hsomn6RChDI4RvX30C65OtgULaNX3SYqwFHinsgjQ= 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 :mime-version:date:message-id:subject:from:to:content-type; s= default; bh=58gZWVevM2qaC+vxhDJtxFZCHYE=; b=rP/2OLr77k1WkBnkGo/d UbG7Qh3TnxymedWxP9OdTVO5q7rdpRnvg22HZ/LXxhALW9hQ11jwkg2bxDpuDTbo SdPn9x3ssYYfMwMIU8JoyHu46XM2XCXMtkp00C/BCUGAa0mvJTvIiOKk0TrOPaEo 5G9D4R/sX7n6xnJH6ZqtY7Q= Received: (qmail 48289 invoked by alias); 13 Oct 2015 18:58:30 -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 48273 invoked by uid 89); 13 Oct 2015 18:58:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-vk0-f42.google.com Received: from mail-vk0-f42.google.com (HELO mail-vk0-f42.google.com) (209.85.213.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 13 Oct 2015 18:58:29 +0000 Received: by vkat63 with SMTP id t63so16319258vka.1 for ; Tue, 13 Oct 2015 11:58:26 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.31.147.129 with SMTP id v123mr22727869vkd.23.1444762706759; Tue, 13 Oct 2015 11:58:26 -0700 (PDT) Received: by 10.103.40.68 with HTTP; Tue, 13 Oct 2015 11:58:26 -0700 (PDT) Date: Tue, 13 Oct 2015 20:58:26 +0200 Message-ID: Subject: [PATCH, i386]: Use CEIL where applicable. From: Uros Bizjak To: "gcc-patches@gcc.gnu.org" No functional changes. 2015-10-13 Uros Bizjak * config/i386/i386.c (classify_argument): Use CEIL where applicable. (ix86_function_arg_advance): Ditto. (ix86_function_arg): Ditto. (ix86_gimplify_va_arg): Ditto. (ix86_class_max_nregs): Ditto. (inline_memory_move_cost): Ditto. (ix86_set_reg_reg_cost): Ditto. * config/i386/i386.h (HARD_REGNO_NREGS): Ditto. Bootstrapped and regression tested on x86_64-linux-gnu {-m32}, committed to mainline SVN. Uros. Index: config/i386/i386.c =================================================================== --- config/i386/i386.c (revision 228770) +++ config/i386/i386.c (working copy) @@ -7925,8 +7925,7 @@ classify_argument (machine_mode mode, const_tree t { HOST_WIDE_INT bytes = (mode == BLKmode) ? int_size_in_bytes (type) : (int) GET_MODE_SIZE (mode); - int words - = (bytes + (bit_offset % 64) / 8 + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + int words = CEIL (bytes + (bit_offset % 64) / 8, UNITS_PER_WORD); /* Variable sized entities are always passed/returned in memory. */ if (bytes < 0) @@ -8791,7 +8790,7 @@ ix86_function_arg_advance (cumulative_args_t cum_v bytes = int_size_in_bytes (type); else bytes = GET_MODE_SIZE (mode); - words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + words = CEIL (bytes, UNITS_PER_WORD); if (type) mode = type_natural_mode (type, NULL, false); @@ -9124,7 +9123,7 @@ ix86_function_arg (cumulative_args_t cum_v, machin bytes = int_size_in_bytes (type); else bytes = GET_MODE_SIZE (mode); - words = (bytes + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + words = CEIL (bytes, UNITS_PER_WORD); /* To simplify the code below, represent vector types with a vector mode even if MMX/SSE are not active. */ @@ -10271,7 +10270,7 @@ ix86_gimplify_va_arg (tree valist, tree type, gimp if (indirect_p) type = build_pointer_type (type); size = int_size_in_bytes (type); - rsize = (size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + rsize = CEIL (size, UNITS_PER_WORD); nat_mode = type_natural_mode (type, NULL, false); switch (nat_mode) @@ -42971,7 +42970,7 @@ ix86_class_max_nregs (reg_class_t rclass, machine_ else if (mode == XCmode) return (TARGET_64BIT ? 4 : 6); else - return ((GET_MODE_SIZE (mode) + UNITS_PER_WORD - 1) / UNITS_PER_WORD); + return CEIL (GET_MODE_SIZE (mode), UNITS_PER_WORD); } else { @@ -43130,8 +43129,7 @@ inline_memory_move_cost (machine_mode mode, enum r cost = ix86_cost->int_load[2]; else cost = ix86_cost->int_store[2]; - return (cost * (((int) GET_MODE_SIZE (mode) - + UNITS_PER_WORD - 1) / UNITS_PER_WORD)); + return cost * CEIL ((int) GET_MODE_SIZE (mode), UNITS_PER_WORD); } } @@ -43417,7 +43415,7 @@ ix86_set_reg_reg_cost (machine_mode mode) /* Return the cost of moving between two registers of mode MODE, assuming that the move will be in pieces of at most UNITS bytes. */ - return COSTS_N_INSNS ((GET_MODE_SIZE (mode) + units - 1) / units); + return COSTS_N_INSNS (CEIL (GET_MODE_SIZE (mode), units)); } /* Compute a (partial) cost for rtx X. Return true if the complete Index: config/i386/i386.h =================================================================== --- config/i386/i386.h (revision 228770) +++ config/i386/i386.h (working copy) @@ -1084,9 +1084,9 @@ extern const char *host_detect_local_cpu (int argc ? (COMPLEX_MODE_P (MODE) ? 2 : 1) \ : ((MODE) == XFmode \ ? (TARGET_64BIT ? 2 : 3) \ - : (MODE) == XCmode \ - ? (TARGET_64BIT ? 4 : 6) \ - : ((GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) / UNITS_PER_WORD))) + : ((MODE) == XCmode \ + ? (TARGET_64BIT ? 4 : 6) \ + : CEIL (GET_MODE_SIZE (MODE), UNITS_PER_WORD)))) #define HARD_REGNO_NREGS_HAS_PADDING(REGNO, MODE) \ ((TARGET_128BIT_LONG_DOUBLE && !TARGET_64BIT) \