This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, i386] Fix PR64003
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: Ilya Enkovich <enkovich dot gnu at gmail dot com>, gcc-patches <gcc-patches at gcc dot gnu dot org>, rdsandiford at googlemail dot com
- Date: Mon, 8 Dec 2014 11:30:15 +0300
- Subject: Re: [PATCH, i386] Fix PR64003
- Authentication-results: sourceware.org; auth=none
- References: <20141205145738 dot GB53395 at msticlxl57 dot ims dot intel dot com> <87oarfzt2h dot fsf at googlemail dot com>
2014-12-07 12:51 GMT+03:00 Richard Sandiford <rdsandiford@googlemail.com>:
> Ilya Enkovich <enkovich.gnu@gmail.com> 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