This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: egcs-19990907 on i686 generates invalid assembly
- To: Horst von Brand <vonbrand at inf dot utfsm dot cl>
- Subject: Re: egcs-19990907 on i686 generates invalid assembly
- From: Bernd Schmidt <bernds at cygnus dot co dot uk>
- Date: Thu, 9 Sep 1999 14:47:06 +0100 (BST)
- cc: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
On Thu, 9 Sep 1999, Horst von Brand wrote:
> /*
> * egcs-19990907 -O2 -fomit-frame-pointer -march=i686
> *
> * A "salb $4, %esi" instruction is generated, which is clearly invalid
> * (%esi isn't a byte register). The original case (out of linux-2.3.16)
> * gave a "salb $4, %edi"
> *
> * binutils-2.9.5.0.11, linux
> *
> * egcs-19990830 doesn't do this.
> */
>
> int f()
> {
> unsigned char hrs, min;
>
> min = ((min / 10) << 4) + min % 10;
> hrs = ((hrs / 10) << 4) + hrs % 10;
>
> return hrs + min;
> }
This patch should fix it (the first change is unrelated, and is only done
for consistency).
Bernd
* i386.md (ashlqi3): For NON_QI_REG_P regs, use sall. Fix some
operand size modifiers.
Index: config/i386/i386.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/i386.md,v
retrieving revision 1.82
diff -u -p -r1.82 i386.md
--- i386.md 1999/09/04 00:24:08 1.82
+++ i386.md 1999/09/09 13:42:57
@@ -5288,14 +5288,14 @@
if (REG_P (operands[2]))
{
if (NON_QI_REG_P (operands[1]))
- return \"sal{l}\\t{%k2, %0|%0, %k2}\";
+ return \"sal{l}\\t{%b2, %k0|%k0, %b2}\";
else
return \"sal{b}\\t{%b2, %0|%0, %b2}\";
}
else
{
if (NON_QI_REG_P (operands[1]))
- return \"sal{b}\\t{%2, %k0|%k0, %2}\";
+ return \"sal{l}\\t{%2, %k0|%k0, %2}\";
else
return \"sal{b}\\t{%2, %0|%0, %2}\";
}