Even more x86 generation tweeks

Jan Hubicka jh@suse.cz
Tue Jun 11 13:02:00 GMT 2002


Snowballing...
I've noticed that we emit short shift opcodes only for pentium and ppro
for some purpose, when it is profitable for everything except 486.
I've changed the condtions to match the style used by rest of MD file.

Tue Jun 11 23:12:55 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* i386.md (shift patterns): Use (TARGET_SHIFT1 || optimize_size) to
	decide whether emit the short opcode.
	* i386.h (x86_shift1): Declare.
	(TARGET_SHIFT1): New macro.
	* i386.c (x86_shift1): New global variable.
*** i386.md.old3	Tue Jun 11 22:50:42 2002
--- i386.md	Tue Jun 11 22:58:41 2002
***************
*** 10355,10361 ****
  	return "sal{q}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{q}\t%0";
        else
  	return "sal{q}\t{%2, %0|%0, %2}";
--- 10355,10361 ----
  	return "sal{q}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{q}\t%0";
        else
  	return "sal{q}\t{%2, %0|%0, %2}";
***************
*** 10412,10418 ****
  	return "sal{q}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{q}\t%0";
        else
  	return "sal{q}\t{%2, %0|%0, %2}";
--- 10412,10418 ----
  	return "sal{q}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{q}\t%0";
        else
  	return "sal{q}\t{%2, %0|%0, %2}";
***************
*** 10560,10566 ****
  	return "sal{l}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{l}\t%0";
        else
  	return "sal{l}\t{%2, %0|%0, %2}";
--- 10560,10566 ----
  	return "sal{l}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{l}\t%0";
        else
  	return "sal{l}\t{%2, %0|%0, %2}";
***************
*** 10621,10627 ****
  	return "sal{l}\t{%b2, %k0|%k0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{l}\t%k0";
        else
  	return "sal{l}\t{%2, %k0|%k0, %2}";
--- 10621,10627 ----
  	return "sal{l}\t{%b2, %k0|%k0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{l}\t%k0";
        else
  	return "sal{l}\t{%2, %k0|%k0, %2}";
***************
*** 10678,10684 ****
  	return "sal{l}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{l}\t%0";
        else
  	return "sal{l}\t{%2, %0|%0, %2}";
--- 10678,10684 ----
  	return "sal{l}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{l}\t%0";
        else
  	return "sal{l}\t{%2, %0|%0, %2}";
***************
*** 10717,10723 ****
  	return "sal{l}\t{%b2, %k0|%k0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{l}\t%k0";
        else
  	return "sal{l}\t{%2, %k0|%k0, %2}";
--- 10717,10723 ----
  	return "sal{l}\t{%b2, %k0|%k0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{l}\t%k0";
        else
  	return "sal{l}\t{%2, %k0|%k0, %2}";
***************
*** 10762,10768 ****
  	return "sal{w}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{w}\t%0";
        else
  	return "sal{w}\t{%2, %0|%0, %2}";
--- 10762,10768 ----
  	return "sal{w}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{w}\t%0";
        else
  	return "sal{w}\t{%2, %0|%0, %2}";
***************
*** 10800,10806 ****
  	return "sal{w}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{w}\t%0";
        else
  	return "sal{w}\t{%2, %0|%0, %2}";
--- 10800,10806 ----
  	return "sal{w}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{w}\t%0";
        else
  	return "sal{w}\t{%2, %0|%0, %2}";
***************
*** 10842,10848 ****
  	return "sal{w}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{w}\t%0";
        else
  	return "sal{w}\t{%2, %0|%0, %2}";
--- 10842,10848 ----
  	return "sal{w}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{w}\t%0";
        else
  	return "sal{w}\t{%2, %0|%0, %2}";
***************
*** 10898,10904 ****
  	}
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	{
  	  if (get_attr_mode (insn) == MODE_SI)
  	    return "sal{l}\t%0";
--- 10898,10904 ----
  	}
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	{
  	  if (get_attr_mode (insn) == MODE_SI)
  	    return "sal{l}\t%0";
***************
*** 10954,10960 ****
  	}
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	{
  	  if (get_attr_mode (insn) == MODE_SI)
  	    return "sal{l}\t%0";
--- 10954,10960 ----
  	}
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	{
  	  if (get_attr_mode (insn) == MODE_SI)
  	    return "sal{l}\t%0";
***************
*** 11006,11012 ****
  	return "sal{b}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_PENTIUM || TARGET_PENTIUMPRO))
  	return "sal{b}\t%0";
        else
  	return "sal{b}\t{%2, %0|%0, %2}";
--- 11006,11012 ----
  	return "sal{b}\t{%b2, %0|%0, %b2}";
        else if (GET_CODE (operands[2]) == CONST_INT
  	       && INTVAL (operands[2]) == 1
! 	       && (TARGET_SHIFT1 || optimize_size))
  	return "sal{b}\t%0";
        else
  	return "sal{b}\t{%2, %0|%0, %2}";
***************
*** 11062,11068 ****
  		     (match_operand:QI 2 "const_int_1_operand" "")))
     (clobber (reg:CC 17))]
    "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)"
    "sar{q}\t%0"
    [(set_attr "type" "ishift")
     (set (attr "length") 
--- 11062,11068 ----
  		     (match_operand:QI 2 "const_int_1_operand" "")))
     (clobber (reg:CC 17))]
    "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)
!    && (TARGET_SHIFT1 || optimize_size)"
    "sar{q}\t%0"
    [(set_attr "type" "ishift")
     (set (attr "length") 
***************
*** 11094,11100 ****
     (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
  	(ashiftrt:DI (match_dup 1) (match_dup 2)))]
    "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)
     && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
    "sar{q}\t%0"
    [(set_attr "type" "ishift")
--- 11094,11100 ----
     (set (match_operand:DI 0 "nonimmediate_operand" "=rm")
  	(ashiftrt:DI (match_dup 1) (match_dup 2)))]
    "TARGET_64BIT && ix86_match_ccmode (insn, CCGOCmode)
!    && (TARGET_SHIFT1 || optimize_size)
     && ix86_binary_operator_ok (ASHIFTRT, DImode, operands)"
    "sar{q}\t%0"
    [(set_attr "type" "ishift")
***************
*** 11251,11257 ****
  		     (match_operand:QI 2 "const_int_1_operand" "")))
     (clobber (reg:CC 17))]
    "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)"
    "sar{l}\t%0"
    [(set_attr "type" "ishift")
     (set (attr "length") 
--- 11251,11257 ----
  		     (match_operand:QI 2 "const_int_1_operand" "")))
     (clobber (reg:CC 17))]
    "ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
!    && (TARGET_SHIFT1 || optimize_size)"
    "sar{l}\t%0"
    [(set_attr "type" "ishift")
     (set (attr "length") 
***************
*** 11265,11271 ****
  				     (match_operand:QI 2 "const_int_1_operand" ""))))
     (clobber (reg:CC 17))]
    "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)"
    "sar{l}\t%k0"
    [(set_attr "type" "ishift")
     (set_attr "length" "2")])
--- 11265,11271 ----
  				     (match_operand:QI 2 "const_int_1_operand" ""))))
     (clobber (reg:CC 17))]
    "TARGET_64BIT && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)
!    && (TARGET_SHIFT1 || optimize_size)"
    "sar{l}\t%k0"
    [(set_attr "type" "ishift")
     (set_attr "length" "2")])
***************
*** 11306,11312 ****
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(ashiftrt:SI (match_dup 1) (match_dup 2)))]
    "ix86_match_ccmode (insn, CCGOCmode)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)
     && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
    "sar{l}\t%0"
    [(set_attr "type" "ishift")
--- 11306,11312 ----
     (set (match_operand:SI 0 "nonimmediate_operand" "=rm")
  	(ashiftrt:SI (match_dup 1) (match_dup 2)))]
    "ix86_match_ccmode (insn, CCGOCmode)
!    && (TARGET_SHIFT1 || optimize_size)
     && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
    "sar{l}\t%0"
    [(set_attr "type" "ishift")
***************
*** 11324,11330 ****
     (set (match_operand:DI 0 "register_operand" "=r")
  	(zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
    "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)
     && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
    "sar{l}\t%k0"
    [(set_attr "type" "ishift")
--- 11324,11330 ----
     (set (match_operand:DI 0 "register_operand" "=r")
  	(zero_extend:DI (ashiftrt:SI (match_dup 1) (match_dup 2))))]
    "TARGET_64BIT && ix86_match_ccmode (insn, CCmode)
!    && (TARGET_SHIFT1 || optimize_size)
     && ix86_binary_operator_ok (ASHIFTRT, SImode, operands)"
    "sar{l}\t%k0"
    [(set_attr "type" "ishift")
***************
*** 11375,11381 ****
  		     (match_operand:QI 2 "const_int_1_operand" "")))
     (clobber (reg:CC 17))]
    "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)"
    "sar{w}\t%0"
    [(set_attr "type" "ishift")
     (set (attr "length") 
--- 11375,11381 ----
  		     (match_operand:QI 2 "const_int_1_operand" "")))
     (clobber (reg:CC 17))]
    "ix86_binary_operator_ok (ASHIFTRT, HImode, operands)
!    && (TARGET_SHIFT1 || optimize_size)"
    "sar{w}\t%0"
    [(set_attr "type" "ishift")
     (set (attr "length") 
***************
*** 11407,11413 ****
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(ashiftrt:HI (match_dup 1) (match_dup 2)))]
    "ix86_match_ccmode (insn, CCGOCmode)
!    && (TARGET_PENTIUM || TARGET_PENTIUMPRO)
     && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
    "sar{w}\t%0"
    [(set_attr "type" "ishift")
--- 11407,11413 ----
     (set (match_operand:HI 0 "nonimmediate_operand" "=rm")
  	(ashiftrt:HI (match_dup 1) (match_dup 2)))]
    "ix86_match_ccmode (insn, CCGOCmode)
!    && (TARGET_SHIFT1 || optimize_size)
     && ix86_binary_operator_ok (ASHIFTRT, HImode, operands)"
    "sar{w}\t%0"
    [(set_attr "type" "ishift")
***************
*** 11447,11453 ****
  		     (match_operand:QI 2 "const_int_1_operand" "



More information about the Gcc-patches mailing list