From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14203 invoked by alias); 9 Aug 2010 07:55:38 -0000 Received: (qmail 14188 invoked by uid 22791); 9 Aug 2010 07:55:36 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from nikam-dmz.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 09 Aug 2010 07:55:30 +0000 Received: from localhost (campfire.ms.mff.cuni.cz [195.113.18.99]) by nikam.ms.mff.cuni.cz (Postfix) with ESMTP id C0FA99AC836; Mon, 9 Aug 2010 09:55:27 +0200 (CEST) Received: by localhost (Postfix, from userid 29025) id ADD53E34F7; Mon, 9 Aug 2010 09:55:27 +0200 (CEST) Date: Mon, 09 Aug 2010 08:44:00 -0000 From: Zdenek Dvorak To: Xinliang David Li Cc: GCC Patches , Richard Guenther , Pat Haugen , "H.J. Lu" Subject: Re: IVOPT improvement patch Message-ID: <20100809075525.GA16026@kam.mff.cuni.cz> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) 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 X-SW-Source: 2010-08/txt/msg00633.txt.bz2 Hi, > Compiler bootstrapped and tested with Lu's patch (with one minor > change to initialize off variable) (x86-64/linux) -- also checked dump > file that offsets are properly computed. in case that no offsets are allowed (or more hypotetically, if only offsets of +1 or -1 are allowed), the code below will set min_offset to -2 and max_offset to +2, thus incorrectly extending the range of allowed offsets. Zdenek > reg1 = gen_raw_REG (address_mode, LAST_VIRTUAL_REGISTER + 1); > > + width = GET_MODE_BITSIZE (address_mode) - 1; > + if (width > (HOST_BITS_PER_WIDE_INT - 1)) > + width = HOST_BITS_PER_WIDE_INT - 1; > addr = gen_rtx_fmt_ee (PLUS, address_mode, reg1, NULL_RTX); > - for (i = start; i <= 1 << 20; i <<= 1) > + > + for (i = width; i; i--) > { > - XEXP (addr, 1) = gen_int_mode (i, address_mode); > - if (!memory_address_addr_space_p (mem_mode, addr, as)) > + off = -((HOST_WIDE_INT) 1 << i); > + XEXP (addr, 1) = gen_int_mode (off, address_mode); > + if (memory_address_addr_space_p (mem_mode, addr, as)) > break; > } > - data->max_offset = i == start ? 0 : i >> 1; > - off = data->max_offset; > + data->min_offset = off; > > - for (i = start; i <= 1 << 20; i <<= 1) > + for (i = width; i; i--) > { > - XEXP (addr, 1) = gen_int_mode (-i, address_mode); > - if (!memory_address_addr_space_p (mem_mode, addr, as)) > + off = ((HOST_WIDE_INT) 1 << i) - 1; > + XEXP (addr, 1) = gen_int_mode (off, address_mode); > + if (memory_address_addr_space_p (mem_mode, addr, as)) > break; > } > - data->min_offset = i == start ? 0 : -(i >> 1); > + data->max_offset = off; > > if (dump_file && (dump_flags & TDF_DETAILS)) > { > fprintf (dump_file, "get_address_cost:\n"); > - fprintf (dump_file, " min offset %s %d\n", > + fprintf (dump_file, " min offset %s " HOST_WIDE_INT_PRINT_DEC "\n", > GET_MODE_NAME (mem_mode), > - (int) data->min_offset); > - fprintf (dump_file, " max offset %s %d\n", > + data->min_offset); > + fprintf (dump_file, " max offset %s " HOST_WIDE_INT_PRINT_DEC "\n", > GET_MODE_NAME (mem_mode), > - (int) data->max_offset); > + data->max_offset); > } > > rat = 1;