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: [PATCH]: Expand isinf() as x87 asm


On 1/31/07, Uros Bizjak <ubizjak@gmail.com> wrote:
Hello!

This patch expands isinf() into inline x87 asm.

Following testcase:
--cut here--
int test(double a)
{
        return isinf(a + 2.0);
}
--cut here--

compiles to (gcc -O2 -fomit-frame-pointer):
test:
        flds    .LC0
        faddl   4(%esp)
        fxam
        fnstsw  %ax
        fstp    %st(0)
        andb    $69, %ah
        cmpb    $5, %ah
        sete    %al
        movzbl  %al, %eax
        ret

Patch was regression tested on i686-pc-linux-gnu for all default languages.

OK for SVN? (Patch needs middle-end approval.)

The middle-end parts are ok - can you open a PR for the missed-optimization with SSE math?

Thanks,
Richard.

2007-01-31 Uros Bizjak <ubizjak@gmail.com>

        * optabs.h (enum optab_index): Add new OTI_isinf.
        (isinf_optab): Define corresponding macro.
        * optabs.c (init_optabs): Initialize isinf_optab.
        * genopinit.c (optabs): Implement isinf_optab using isinf?f2
        patterns.
        * builtins.c (mathfn_built_in): Handle BUILT_IN_ISINF{,F,L}.
        (expand_builtin_interclass_mathfn): Expand BUILT_IN_ISINF{,F,L}
        using isinf_optab.
        (expand_builtin): Expand BUILT_IN_ISINF{,F,L} using
        expand_builtin_interclass_mathfn.
        * reg_stack.c (subst_stack_regs_pat): Handle UNSPEC_FXAM.
        * config/i386/i386.md (UNSPEC_FXAM): New constant.
        (fxam<mode>2_i387): New insn pattern.
        (isinf<mode>2) New expander to implement isinf, isinff and isinfl
        built-in functions as x87 inline asm.


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