Patch to avoid non-pairable NEG instructions

Jan Hubicka hubicka@atrey.karlin.mff.cuni.cz
Mon Apr 12 07:39:00 GMT 1999


Hi,
This patch avoids outputing of NEG instructions that are not pariable
on Pentium.
Also the HI mode pattern is extended to avoid prefixes when possible.

Honza

Mon Apr 12 16:10:18 MET DST 1999
	* i386.md (one_cmplsi2): output pairable XOR instead of NEG on Pentium.
	(one_cmplqi2) Likewise.
	(one_cmplhi2) Likewise; avoid outputing of prefixed opcodes.

*** i386.md.old	Mon Apr 12 15:09:18 1999
--- i386.md	Mon Apr 12 16:34:42 1999
*************** byte_xor_operation:
*** 4832,4850 ****
    [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
    ""
!   "not%L0 %0")
  
  (define_insn "one_cmplhi2"
    [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
    ""
!   "not%W0 %0")
  
  (define_insn "one_cmplqi2"
    [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(not:QI (match_operand:QI 1 "nonimmediate_operand" "0")))]
    ""
!   "not%B0 %0")
  
  ;;- arithmetic shift instructions
  
--- 4832,4888 ----
    [(set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(not:SI (match_operand:SI 1 "nonimmediate_operand" "0")))]
    ""
!   "*
!     rtx xops[2];
!     if (TARGET_PENTIUM && !optimize_size && REG_P (operands[0]))
!       {
! 	xops[0] = operands[0];
! 	xops[1] = GEN_INT (0xffffffff);
! 	output_asm_insn(AS2 (xor%L0,%1,%0), xops);
! 	RET;
!       }
!     return AS1 (not%L0,%0);")
  
  (define_insn "one_cmplhi2"
    [(set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(not:HI (match_operand:HI 1 "nonimmediate_operand" "0")))]
    ""
!   "*
!     rtx xops[2];
!     if (TARGET_PENTIUM && !optimize_size && REG_P (operands[0]))
!       {
! 	xops[0] = operands[0];
! 	xops[1] = GEN_INT (0xffff);
! 	if (i386_cc_probably_useless_p (insn))
! 	 {
! 	    CC_STATUS_INIT;
! 	    output_asm_insn(AS2 (xor%L0,%1,%0), xops);
! 	  }
! 	else
! 	  output_asm_insn(AS2 (xor%W0,%1,%0), xops);
! 	RET;
!       }
!     if (REG_P (operands[0]) && i386_cc_probably_useless_p (insn))
!       {
! 	CC_STATUS_INIT;
! 	return AS1 (not%L0,%0);
!       }
!     return AS1 (not%W0,%0);")
  
  (define_insn "one_cmplqi2"
    [(set (match_operand:QI 0 "nonimmediate_operand" "=qm")
  	(not:QI (match_operand:QI 1 "nonimmediate_operand" "0")))]
    ""
!   "*
!     rtx xops[2];
!     if (TARGET_PENTIUM && !optimize_size && REG_P (operands[0]))
!       {
! 	xops[0] = operands[1];
! 	xops[1] = GEN_INT (0xff);
! 	output_asm_insn(AS2 (xor%B0,%1,%0), xops);
! 	RET;
!       }
!     return AS1 (not%B0,%0);")
  
  ;;- arithmetic shift instructions
  


More information about the Gcc-patches mailing list