From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32465 invoked by alias); 13 Oct 2015 10:30:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 32451 invoked by uid 89); 13 Oct 2015 10:30:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-vk0-f49.google.com Received: from mail-vk0-f49.google.com (HELO mail-vk0-f49.google.com) (209.85.213.49) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 13 Oct 2015 10:30:57 +0000 Received: by vkat63 with SMTP id t63so7405213vka.1 for ; Tue, 13 Oct 2015 03:30:55 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.31.146.133 with SMTP id u127mr21468260vkd.42.1444732255521; Tue, 13 Oct 2015 03:30:55 -0700 (PDT) Received: by 10.103.40.68 with HTTP; Tue, 13 Oct 2015 03:30:55 -0700 (PDT) In-Reply-To: <2133098.QDH4UeQdFs@polaris> References: <2133098.QDH4UeQdFs@polaris> Date: Tue, 13 Oct 2015 10:30:00 -0000 Message-ID: Subject: Re: [PATCH, sparc]: Use ROUND_UP and ROUND_DOWN macros From: Uros Bizjak To: Eric Botcazou Cc: "gcc-patches@gcc.gnu.org" Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-10/txt/msg01207.txt.bz2 On Tue, Oct 13, 2015 at 12:10 PM, Eric Botcazou wrote: >> Two functional changes I'd like to point out: >> >> /* ALIGN FRAMES on double word boundaries */ >> -#define SPARC_STACK_ALIGN(LOC) \ >> - (TARGET_ARCH64 ? (((LOC)+15) & ~15) : (((LOC)+7) & ~7)) >> +#define SPARC_STACK_ALIGN(LOC) ROUND_UP ((LOC), UNITS_PER_WORD * 2) >> >> The one above uses UNITS_PER_WORD in stack alignment calculation > > OK. > >> /* Always preserve double-word alignment. */ >> - offset = (offset + 8) & -8; >> + offset = ROUND_UP (offset, 8); >> >> The one above looks like off-by-one bug, but this needs a confirmation. > > No, it's correct, it's a bump of 8 followed by a ROUND_DOWN (the offset may or > may not have been bumped by 4 already in the code just above). In this case, I think it is better to write this part as: --cut here-- offset += 8; /* Always preserve double-word alignment. */ offset = ROUND_DOWN (offset, 8); --cut here-- WDYT? Uros.