From patchwork Mon Dec 8 10:59:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 418668 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 49AEB1400A0 for ; Mon, 8 Dec 2014 22:02:07 +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:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; q=dns; s=default; b=BFgPuC85HWmCDlJVQXkxHidckcJ+jT M5RWfDXsH7SC7CcZ8XPTNUnpVwYxgktQtHPLYgv8ULZHEiddht8LVDcillhnDoJR +ZM3oJhEPDiL+AncauLDKCdGYLlPSrrMFAiAas4oyELOxey2Jo0gu2ufcGwhYx9S vHc7vLOgSYCKM= 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:date :from:to:subject:message-id:references:mime-version:content-type :in-reply-to; s=default; bh=nO6bDTwGgvPHJmuFoO1IPgWQB8I=; b=H2qT kUrz2lE3X4wJwWg/ntt+fCJxjuxdzmz55qIGH5MCh3q+/6sweQLboJaHcY42BfsI yjOHEJVVugrFFLMziCB+rNnCqC6hzye/0vFwwCzaFibF+iGr7b06Rs0Mw3yA7Say wADTIKzkpL0QQGYz8/UtRXL6IeYBz4Qtm8+oduo= Received: (qmail 16485 invoked by alias); 8 Dec 2014 11:01:59 -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 16473 invoked by uid 89); 8 Dec 2014 11:01:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f180.google.com Received: from mail-pd0-f180.google.com (HELO mail-pd0-f180.google.com) (209.85.192.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Mon, 08 Dec 2014 11:01:57 +0000 Received: by mail-pd0-f180.google.com with SMTP id w10so1843269pde.25 for ; Mon, 08 Dec 2014 03:01:56 -0800 (PST) X-Received: by 10.68.197.41 with SMTP id ir9mr58734475pbc.21.1418036515792; Mon, 08 Dec 2014 03:01:55 -0800 (PST) Received: from msticlxl57.ims.intel.com (fmdmzpr04-ext.fm.intel.com. [192.55.55.39]) by mx.google.com with ESMTPSA id ni9sm27470714pdb.36.2014.12.08.03.01.54 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 08 Dec 2014 03:01:55 -0800 (PST) Date: Mon, 8 Dec 2014 13:59:47 +0300 From: Ilya Enkovich To: gcc-patches , rdsandiford@googlemail.com Subject: Re: [PATCH, i386] Fix PR64003 Message-ID: <20141208105947.GA34955@msticlxl57.ims.intel.com> References: <20141205145738.GB53395@msticlxl57.ims.intel.com> <87oarfzt2h.fsf@googlemail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On 08 Dec 11:30, Ilya Enkovich wrote: > 2014-12-07 12:51 GMT+03:00 Richard Sandiford : > > Ilya Enkovich writes: > >> diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md > >> index 88435d6..9019ed8 100644 > >> --- a/gcc/config/i386/i386.md > >> +++ b/gcc/config/i386/i386.md > >> @@ -10958,6 +10958,24 @@ > >> ;; Basic conditional jump instructions. > >> ;; We ignore the overflow flag for signed branch instructions. > >> > >> +(define_insn "*jcc_1_bnd" > >> + [(set (pc) > >> + (if_then_else (match_operator 1 "ix86_comparison_operator" > >> + [(reg FLAGS_REG) (const_int 0)]) > >> + (label_ref (match_operand 0)) > >> + (pc)))] > >> + "TARGET_MPX && ix86_bnd_prefixed_insn_p (insn)" > >> + "bnd %+j%C1\t%l0" > >> + [(set_attr "type" "ibr") > >> + (set_attr "modrm" "0") > >> + (set (attr "length") > >> + (if_then_else (and (ge (minus (match_dup 0) (pc)) > >> + (const_int -126)) > >> + (lt (minus (match_dup 0) (pc)) > >> + (const_int 128))) > >> + (const_int 3) > >> + (const_int 7)))]) > >> + > > > > Sorry, looking at this again, shouldn't the offset be -125 rather > > than -126? The pc in: > > > > (ge (minus (match_dup 0) (pc)) > > (const_int -126)) > > > > is the start of the instruction, so we need to add the length > > of the jump itself to the real minimum range of -128. > > You are right. Similarly upper bound should be changed from 128 to 129. > > Thanks, > Ilya > > > > > Thanks, > > Richard Here is a patch to fix it. Thanks, Ilya --- 2014-12-08 Ilya Enkovich PR target/64003 * config/i386/i386.md (*jcc_1_bnd): Fix short jump range. (*jcc_2_bnd): Likewise. (jump_bnd): Likewise. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 9019ed8..eafba04 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -10970,9 +10970,9 @@ (set_attr "modrm" "0") (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) + (const_int -125)) (lt (minus (match_dup 0) (pc)) - (const_int 128))) + (const_int 129))) (const_int 3) (const_int 7)))]) @@ -11006,9 +11006,9 @@ (set_attr "modrm" "0") (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) + (const_int -125)) (lt (minus (match_dup 0) (pc)) - (const_int 128))) + (const_int 129))) (const_int 3) (const_int 7)))]) @@ -11464,9 +11464,9 @@ [(set_attr "type" "ibr") (set (attr "length") (if_then_else (and (ge (minus (match_dup 0) (pc)) - (const_int -126)) + (const_int -125)) (lt (minus (match_dup 0) (pc)) - (const_int 128))) + (const_int 129))) (const_int 3) (const_int 6))) (set_attr "modrm" "0")])