Path: utzoo!telly!ddsw1!lll-winken!killer!texbell!bigtex!james From: james@bigtex.cactus.org (James Van Artsdalen) Newsgroups: gnu.gcc.bug Subject: Re: GCC 1.31 produces an illegal instruction on Sun386i Keywords: sun386i, roadrunner, gcc, 1.31 Message-ID: <11363@bigtex.cactus.org> Date: 5 Dec 88 06:19:55 GMT References: <491@mfgfoc.uucp> Reply-To: james@bigtex.cactus.org (James Van Artsdalen) Organization: Institute of Applied Cosmology, Austin TX Lines: 41 In <491@mfgfoc.uucp>, exodus@mfgfoc.uucp (Greg Onufer) wrote: > imull 12(%ebp),%eax,%eax This has come up many times. I think the register constraints are OK, but the C output part is not. Basically, the 386 has a general two operand multiply, or a three operand if the destination is a register and one of the sources is an immediate value and the other either a register or memory. Struggling through the Internals document leads me to suspect that perhaps using "which_alternative" is a better way for this insn to work. This change ought to make gcc use the simpler method of determining which imul form to output instead of trying to figure it out by looking at operand 2. This change isn't really tested yet (lack of good test cases), and I don't understand .md files yet, so reader beware. Please send/post corrections! *** /tmp/,RCSt1a08236 Sun Dec 4 23:41:17 1988 --- i386.md Sun Dec 4 23:31:58 1988 *************** *** 896,903 **** { ! if (rtx_equal_p (operands[0], operands[1]) ! && (GET_CODE (operands[2]) == MEM ! || GET_CODE (operands[2]) == REG)) ! /* Assembler has weird restrictions. */ return AS2 (imul%L,%2,%0); ! return AS3 (imul%L,%2,%1,%0); }") --- 896,901 ---- { ! if (which_alternative == 0) return AS2 (imul%L,%2,%0); ! else ! return AS3 (imul%L,%2,%1,%0); }") -- James R. Van Artsdalen james@bigtex.cactus.org "Live Free or Die" Home: 512-346-2444 Work: 338-8789 9505 Arboretum Blvd Austin TX 78759