This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC PATCH, i386]: Generate jecxz instruction
- From: "Zuxy Meng" <zuxy dot meng at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 8 May 2007 11:43:10 +0800
- Subject: Re: [RFC PATCH, i386]: Generate jecxz instruction
- References: <5787cf470704050825n16fd0e1enf90c6b9c8473113d@mail.gmail.com>
"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