This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC PATCH, i386]: Generate jecxz instruction


"Uros Bizjak" <ubizjak@gmail.com> дÈëÏûÏ¢ÐÂÎÅ:5787cf470704050825n16fd0e1enf90c6b9c8473113d@mail.gmail.com...
> Hello!
>
> Thanks to Steven's suggestion in PR target/29793, perhaps by allowing
> some margin (say, 20%) in target displacement calculation, we still
> can generate jexcz instruction.
>
> Attached patch implements generation of jexcz instruction. Although
> patch compiles OK and produces expected result, this (toy) patch is
> not yet suitable for mainline. The patch is just put on display to
> yield some comments ;)
>
> Anyway, the testcase:
>
> void test(int a, int b)
> {
>  if (a+b)
>    abort();
>  else
>    return;
> }
>
> compiles into:
>
> test:
>        pushl   %ebp
>        movl    %esp, %ebp
>        subl    $8, %esp
>        movl    12(%ebp), %ecx
>        addl    8(%ebp), %ecx
>        jecxz   .L4

I guess 'jz .L4' works here too?

>        call    abort
>        .p2align 4,,7
> .L4:
>        leave
>        ret
>
> BTW: Steven, perhaps by allowing the same target displacement margin
> the problematic loop patch [1] can be resurrected?
>
> [1] http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00306.html



-- 
Zuxy 




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]