This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: egcs-19990907 on i686 generates invalid assembly


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}\";
 	}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]