🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #132

Patch to support [u]divsi3 on 386

#132
From: Michael Burg
Date: Thu, 29 Jun 1989 23:54
29 lines
1400 bytes
(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.
Technical Details
Message-ID: <590@everex.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!orion.cf.uci.edu!uci-ics!zardoz!everex!mb

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!usc!orion.cf.uci.edu!uci-ics!zardoz!everex!mb
From: mb@everex.UUCP (Michael Burg)
Newsgroups: gnu.gcc.bug
Subject: Patch to support [u]divsi3 on 386
Keywords: 386, gcc-1.35
Message-ID: <590@everex.UUCP>
Date: 29 Jun 89 23:54:16 GMT
Organization: Everex Systems Inc., Los Alamitos, CA
Lines: 29