mb@everex.UUCP (Michael Burg) (06/30/89)
(Is there is a newer version with support for divsi3 udivsi for the 386 than gcc 1.35?) For some reason gcc-1.35 doesn't support udivsi3 and divsi3. Here's a short patch to be include anywhere in config/i386.md. (This greatly improves integer division by using the idiv and div instructions instead of calling __divsi3 in gnulib.c) ***** Cut Here ************************************************************ (define_insn "divsi3" [(set (match_operand:SI 0 "general_operand" "=&a") (div:SI (match_operand:SI 1 "general_operand" "0") (match_operand:SI 2 "general_operand" "rm"))) (clobber (reg:SI 1))] "" "cltd\;idiv%L0 %2") (define_insn "udivsi3" [(set (match_operand:SI 0 "general_operand" "=&a") (udiv:SI (match_operand:SI 1 "general_operand" "0") (match_operand:SI 2 "general_operand" "rm"))) (clobber (reg:SI 1))] "" "cltd\;div%L0 %2") **** End of Patch ********************************************************* Hope this helps performance some.
james@bigtex.cactus.org (James Van Artsdalen) (07/14/89)
In <590@everex.UUCP>, mb@everex.UUCP (Michael Burg) wrote:
(define_insn "udivsi3"
[(set (match_operand:SI 0 "general_operand" "=&a")
(udiv:SI (match_operand:SI 1 "general_operand" "0")
(match_operand:SI 2 "general_operand" "rm")))
(clobber (reg:SI 1))]
""
>>> "cltd\;div%L0 %2")
Oops: I don't think you want to sign extend the operands to an
unsigned division. Might do something like "xor%L0 %%edx,%%edx\;div%L0 %2"
instead.
--
James R. Van Artsdalen james@bigtex.cactus.org "Live Free or Die"
Dell Computer Co 9505 Arboretum Blvd Austin TX 78759 512-338-8789