[gnu.gcc.bug] GCC improvements for i386

augustss@cs.chalmers.se (Lennart Augustsson) (11/27/88)

The following is a context diff for i386.md and it will give sligthly better
code than the original md file.  I have used it with gcc 1.31 and successfully
bootstrapped the compiler.

	-- Lennart Augustsson

*** i386.md.old	Thu Nov 24 17:54:52 1988
--- i386.md	Thu Oct 27 00:53:29 1988
***************
*** 66,71
    ""
    "*
  {
    operands[1] = const0_rtx;
    return AS2 (cmp%L,%1,%0);
  }")

--- 66,73 -----
    ""
    "*
  {
+   if (REG_P(operands[0]))
+ 	return AS2 (test%L,%0,%0);
    operands[1] = const0_rtx;
    return AS2 (cmp%L,%1,%0);
  }")
***************
*** 76,81
    ""
    "*
  {
    operands[1] = const0_rtx;
    return AS2 (cmp%W,%1,%0);
  }")

--- 78,85 -----
    ""
    "*
  {
+   if (REG_P(operands[0]))
+ 	return AS2 (test%W,%0,%0);
    operands[1] = const0_rtx;
    return AS2 (cmp%W,%1,%0);
  }")
***************
*** 86,91
    ""
    "*
  {
    operands[1] = const0_rtx;
    return AS2 (cmp%B,%1,%0);
  }")

--- 90,97 -----
    ""
    "*
  {
+   if (REG_P(operands[0]))
+ 	return AS2 (test%B,%0,%0);
    operands[1] = const0_rtx;
    return AS2 (cmp%B,%1,%0);
  }")
***************
*** 441,462
  ;; because it is often shorter to use these when both apply.
  
  ; ??? Why is this pattern desirable?
! (define_insn ""
!   [(set (match_operand:SI 0 "push_operand" "=<")
! 	(plus:SI (match_operand:SI 1 "general_operand" "%r")
! 		 (match_operand:SI 2 "general_operand" "ri")))]
!   ""
!   "*
! {
!   rtx xops[4];
!   xops[0] = operands[0];
!   xops[1] = operands[1];
!   xops[2] = operands[2];
!   xops[3] = gen_rtx (MEM, SImode, stack_pointer_rtx);
!   output_asm_insn (\"push%z1 %1\", xops);
!   output_asm_insn (AS2 (add%z3,%2,%3), xops);
!   RET;
! }")
  
  (define_insn ""
    [(set (match_operand:SI 0 "general_operand" "=g")

--- 447,469 -----
  ;; because it is often shorter to use these when both apply.
  
  ; ??? Why is this pattern desirable?
! ; This pattern only slows things down!
! ;(define_insn ""
! ;  [(set (match_operand:SI 0 "push_operand" "=<")
! ;	(plus:SI (match_operand:SI 1 "general_operand" "%r")
! ;		 (match_operand:SI 2 "general_operand" "ri")))]
! ;  ""
! ;  "*
! ;{
! ;  rtx xops[4];
! ;  xops[0] = operands[0];
! ;  xops[1] = operands[1];
! ;  xops[2] = operands[2];
! ;  xops[3] = gen_rtx (MEM, SImode, stack_pointer_rtx);
! ;  output_asm_insn (\"push%z1 %1\", xops);
! ;  output_asm_insn (AS2 (add%z3,%2,%3), xops);
! ;  RET;
! ;}")
  
  (define_insn ""
    [(set (match_operand:SI 0 "general_operand" "=g")