i386 integer comparison patch - part1

John Wehle john@feith.com
Tue Jun 2 22:11:00 GMT 1998


I decided to break up the original patch into separate
parts and to not bother trying to change the cmp pattern
constraints until I'll had a chance to look at it closer
and hopefully receive more information from Jeff.

ChangeLog:

Wed Jun  3 00:56:38 EDT 1998  John Wehle  (john@feith.com)

	* i386.md (cmpsi_1, cmphi_1, cmpqi_1): Remove code
	which set CC_REVERSED since reload should ensure that
	the operands are already the correct type.

Note:

  1) The Intel manual indicates that memory is valid as either
     operand and reload should prevent CONSTANT_P (operands[0])
     from ever being true, so I'm not sure what was intended by
     this code.

Enjoy!

-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/config/i386/i386.md.ORIGINAL	Thu May 28 01:08:21 1998
--- gcc/config/i386/i386.md	Tue Jun  2 22:41:29 1998
***************
*** 328,342 ****
  	(compare (match_operand:SI 0 "nonimmediate_operand" "mr,r")
  		 (match_operand:SI 1 "general_operand" "ri,mr")))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
!   "*
! {
!   if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
!     {
!       cc_status.flags |= CC_REVERSED;
!       return AS2 (cmp%L0,%0,%1);
!     }
!   return AS2 (cmp%L0,%1,%0);
! }")
  
  (define_expand "cmpsi"
    [(set (cc0)
--- 328,334 ----
  	(compare (match_operand:SI 0 "nonimmediate_operand" "mr,r")
  		 (match_operand:SI 1 "general_operand" "ri,mr")))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
!   "* return AS2 (cmp%L0,%1,%0);")
  
  (define_expand "cmpsi"
    [(set (cc0)
***************
*** 359,373 ****
  	(compare (match_operand:HI 0 "nonimmediate_operand" "mr,r")
  		 (match_operand:HI 1 "general_operand" "ri,mr")))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
!   "*
! {
!   if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
!     {
!       cc_status.flags |= CC_REVERSED;
!       return AS2 (cmp%W0,%0,%1);
!     }
!   return AS2 (cmp%W0,%1,%0);
! }")
  
  (define_expand "cmphi"
    [(set (cc0)
--- 351,357 ----
  	(compare (match_operand:HI 0 "nonimmediate_operand" "mr,r")
  		 (match_operand:HI 1 "general_operand" "ri,mr")))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
!   "* return AS2 (cmp%W0,%1,%0);")
  
  (define_expand "cmphi"
    [(set (cc0)
***************
*** 390,404 ****
  	(compare (match_operand:QI 0 "nonimmediate_operand" "q,mq")
  		 (match_operand:QI 1 "general_operand" "qm,nq")))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
!   "*
! {
!   if (CONSTANT_P (operands[0]) || GET_CODE (operands[1]) == MEM)
!     {
!       cc_status.flags |= CC_REVERSED;
!       return AS2 (cmp%B0,%0,%1);
!     }
!   return AS2 (cmp%B0,%1,%0);
! }")
  
  (define_expand "cmpqi"
    [(set (cc0)
--- 374,380 ----
  	(compare (match_operand:QI 0 "nonimmediate_operand" "q,mq")
  		 (match_operand:QI 1 "general_operand" "qm,nq")))]
    "GET_CODE (operands[0]) != MEM || GET_CODE (operands[1]) != MEM"
!   "* return AS2 (cmp%B0,%1,%0);")
  
  (define_expand "cmpqi"
    [(set (cc0)
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------




More information about the Gcc-patches mailing list