[PATCH]: Expand isinf() as x87 asm
Uros Bizjak
ubizjak@gmail.com
Wed Jan 31 09:52:00 GMT 2007
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.)
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.
testsuite/ChangeLog:
2007-01-31 Uros Bizjak <ubizjak@gmail.com>
* gcc.dg/builtins-64.c: New test.
BTW: I'm almost sure that Richard G. or Jan hardly wait to implement
this expansion also for SSE ;)
Uros.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: i386-isinf.diff
Type: application/octet-stream
Size: 4980 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070131/ca86234d/attachment.obj>
More information about the Gcc-patches
mailing list