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]

i386 FP conditional move signed integer comparison patch rev 2


[ This is the same patch as before except for handling the fact that
  an earlier patch to i386.md didn't apply correctly.                ]

This patch adds support for using signed integer comparisons with
FP conditional moves.  The support is implemented at the RTL level
which allows the compiler an opportunity to optimize the resulting
code.

ChangeLog:

Tue Jun 16 16:21:01 EDT 1998  John Wehle  (john@feith.com)

	* i386.md (movsfcc, movdfcc, movxfcc): Use emit_store_flag
	to support LT, LE, GE, and GT signed integer comparisons.
	(movsfcc+1, movsfcc+2, movdfcc+1, movdfcc+2,
	movxfcc+1, movxfcc+2): Pattern doesn't match if the comparison
	is LT, LE, GE, or GT.
	(movdicc): Remove code resulting from an earlier patch which
	didn't apply correctly.

Enjoy!

-- John Wehle
------------------8<------------------------8<------------------------
*** gcc/config/i386/i386.md.ORIGINAL	Thu Jun 11 19:33:35 1998
--- gcc/config/i386/i386.md	Tue Jun 16 12:35:42 1998
***************
*** 7368,7379 ****
    "TARGET_CMOVE"
    "
  {
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
!   operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
  }")
  
  (define_insn ""
--- 7368,7403 ----
    "TARGET_CMOVE"
    "
  {
+   rtx temp;
+ 
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
!   /* The floating point conditional move instructions don't directly
!      support conditions resulting from a signed integer comparison. */
! 
!   switch (GET_CODE (operands[1]))
!     {
!     case LT:
!     case LE:
!     case GE:
!     case GT:
!       temp = emit_store_flag (gen_reg_rtx (QImode),
! 		GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1,
! 		VOIDmode, 0, 0);
! 
!       if ( !temp )
!         FAIL;
! 
!       operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx);
!       break;
! 
!     default:
!       operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
+       break;
+     }
  }")
  
  (define_insn ""
***************
*** 7383,7389 ****
  		(match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")])
  	      (match_operand:SF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:SF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE"
    "#")
  
  (define_insn ""
--- 7407,7415 ----
  		(match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")])
  	      (match_operand:SF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:SF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE
!     && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE
!     && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT"
    "#")
  
  (define_insn ""
***************
*** 7393,7399 ****
  		 (match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")])
  	      (match_operand:SF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:SF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT"
    "#")
  
  (define_split
--- 7419,7427 ----
  		 (match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")])
  	      (match_operand:SF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:SF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT
!     && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE
!     && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT"
    "#")
  
  (define_split
***************
*** 7442,7452 ****
    "TARGET_CMOVE"
    "
  {
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
!   /* The floating point conditional move instructions don't support
!      signed integer comparisons. */
  
    switch (GET_CODE (operands[1]))
      {
--- 7470,7482 ----
    "TARGET_CMOVE"
    "
  {
+   rtx temp;
+ 
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
!   /* The floating point conditional move instructions don't directly
!      support conditions resulting from a signed integer comparison. */
  
    switch (GET_CODE (operands[1]))
      {
***************
*** 7454,7470 ****
      case LE:
      case GE:
      case GT:
!       FAIL;
!     /* NOTREACHED */
!       break;
  
!     default:
        break;
-     }
  
!   operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
  }")
  
  (define_insn ""
--- 7484,7505 ----
      case LE:
      case GE:
      case GT:
!       temp = emit_store_flag (gen_reg_rtx (QImode),
! 		GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1,
! 		VOIDmode, 0, 0);
  
!       if ( !temp )
!         FAIL;
! 
!       operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx);
        break;
  
!     default:
!       operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
+       break;
+     }
  }")
  
  (define_insn ""
***************
*** 7474,7480 ****
  		(match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")])
  	      (match_operand:DF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:DF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE"
    "#")
  
  (define_insn ""
--- 7509,7517 ----
  		(match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")])
  	      (match_operand:DF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:DF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE
!     && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE
!     && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT"
    "#")
  
  (define_insn ""
***************
*** 7484,7490 ****
  		(match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")])
  	      (match_operand:DF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:DF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT"
    "#")
  
  (define_split
--- 7521,7529 ----
  		(match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")])
  	      (match_operand:DF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:DF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT
!     && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE
!     && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT"
    "#")
  
  (define_split
***************
*** 7533,7543 ****
    "TARGET_CMOVE"
    "
  {
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
!   /* The floating point conditional move instructions don't support
!      signed integer comparisons. */
  
    switch (GET_CODE (operands[1]))
      {
--- 7572,7584 ----
    "TARGET_CMOVE"
    "
  {
+   rtx temp;
+ 
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
!   /* The floating point conditional move instructions don't directly
!      support conditions resulting from a signed integer comparison. */
  
    switch (GET_CODE (operands[1]))
      {
***************
*** 7545,7561 ****
      case LE:
      case GE:
      case GT:
!       FAIL;
!     /* NOTREACHED */
!       break;
  
!     default:
        break;
-     }
  
!   operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
  }")
  
  (define_insn ""
--- 7586,7607 ----
      case LE:
      case GE:
      case GT:
!       temp = emit_store_flag (gen_reg_rtx (QImode),
! 		GET_CODE (operands[1]), i386_compare_op0, i386_compare_op1,
! 		VOIDmode, 0, 0);
  
!       if ( !temp )
!         FAIL;
! 
!       operands[1] = gen_rtx_fmt_ee (NE, QImode, temp, const0_rtx);
        break;
  
!     default:
!       operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
+       break;
+     }
  }")
  
  (define_insn ""
***************
*** 7565,7571 ****
  		(match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")])
  	      (match_operand:XF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:XF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE"
    "#")
  
  (define_insn ""
--- 7611,7619 ----
  		(match_operand:QI 3 "general_operand" "qmn,qn,qmn,qn,qmn,qn")])
  	      (match_operand:XF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:XF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE
!     && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE
!     && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT"
    "#")
  
  (define_insn ""
***************
*** 7575,7581 ****
  		(match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")])
  	      (match_operand:XF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:XF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT"
    "#")
  
  (define_split
--- 7623,7631 ----
  		(match_operand 3 "general_operand" "rmi,ri,rmi,ri,rmi,ri")])
  	      (match_operand:XF 4 "register_operand" "f,f,0,0,f,f")
  	      (match_operand:XF 5 "register_operand" "0,0,f,f,f,f")))]
!   "TARGET_CMOVE && GET_MODE_CLASS (GET_MODE (operands[2])) == MODE_INT
!     && GET_CODE (operands[1]) != LT && GET_CODE (operands[1]) != LE
!     && GET_CODE (operands[1]) != GE && GET_CODE (operands[1]) != GT"
    "#")
  
  (define_split
***************
*** 7627,7649 ****
    if (GET_MODE_CLASS (GET_MODE (i386_compare_op0)) != MODE_INT)
      FAIL;
  
-   /* The floating point conditional move instructions don't support
-      signed integer comparisons. */
- 
-   switch (GET_CODE (operands[1]))
-     {
-     case LT:
-     case LE:
-     case GE:
-     case GT:
-       FAIL;
-     /* NOTREACHED */
-       break;
- 
-     default:
-       break;
-     }
- 
    operands[1] = gen_rtx_fmt_ee (GET_CODE (operands[1]),
  			GET_MODE (i386_compare_op0),
  			i386_compare_op0, i386_compare_op1);
--- 7677,7682 ----
-------------------------------------------------------------------------
|   Feith Systems  |   Voice: 1-215-646-8000  |  Email: john@feith.com  |
|    John Wehle    |     Fax: 1-215-540-5495  |                         |
-------------------------------------------------------------------------



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