This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: i386 setcc pattern tweek
> On Wed, Oct 17, 2001 at 04:34:39PM +0200, Jan Hubicka wrote:
> > (define_expand "sltgt"
> > ! [(set (match_operand:QI 0 "register_operand" "")
> > (ltgt:SI (reg:CC 17) (const_int 0)))]
> > "TARGET_80387 || TARGET_SSE"
> > "if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")
>
> One, you should make the source and destination modes match,
> even if they aren't really used. Two, you can greatly
> simplify ix86_expand_setcc if it only accepts QImode arguments.
Hmm, I've noticed that in meantime too. Here is updated patch I've just bootstrapped/regtested.
Wed Oct 17 21:21:18 CEST 2001 Jan Hubicka <jh@suse.cz>
* i386.c (ix86_expand_setcc): Always expect target to be QImode.
* i386.md (s* expanders): Destination is QImode.
*** ../../i386.c.new Wed Oct 17 15:51:09 2001
--- i386.c Wed Oct 17 21:17:15 2001
*************** ix86_expand_setcc (code, dest)
*** 7755,7773 ****
&& !TARGET_64BIT)
return 0; /* FAIL */
ret = ix86_expand_compare (code, &second_test, &bypass_test);
PUT_MODE (ret, QImode);
tmp = dest;
tmpreg = dest;
- if (GET_MODE (dest) != QImode)
- {
- if (!cse_not_expected)
- tmp = gen_reg_rtx (QImode);
- else
- tmp = gen_lowpart (QImode, dest);
- tmpreg = tmp;
- }
emit_insn (gen_rtx_SET (VOIDmode, tmp, ret));
if (bypass_test || second_test)
--- 7758,7771 ----
&& !TARGET_64BIT)
return 0; /* FAIL */
+ if (GET_MODE (dest) != QImode)
+ abort ();
+
ret = ix86_expand_compare (code, &second_test, &bypass_test);
PUT_MODE (ret, QImode);
tmp = dest;
tmpreg = dest;
emit_insn (gen_rtx_SET (VOIDmode, tmp, ret));
if (bypass_test || second_test)
*************** ix86_expand_setcc (code, dest)
*** 7790,7806 ****
emit_insn (gen_andqi3 (tmp, tmpreg, tmp2));
else
emit_insn (gen_iorqi3 (tmp, tmpreg, tmp2));
- }
-
- if (GET_MODE (dest) != QImode)
- {
- rtx clob;
-
- tmp = gen_rtx_ZERO_EXTEND (GET_MODE (dest), tmp);
- tmp = gen_rtx_SET (VOIDmode, dest, tmp);
- clob = gen_rtx_CLOBBER (VOIDmode, gen_rtx_REG (CCmode, FLAGS_REG));
- tmp = gen_rtx_PARALLEL (VOIDmode, gen_rtvec (2, tmp, clob));
- emit_insn (tmp);
}
return 1; /* DONE */
--- 7788,7793 ----
*** ../../i386.md.old Wed Oct 17 15:34:15 2001
--- i386.md Wed Oct 17 21:15:47 2001
***************
*** 12417,12526 ****
;; way, which can later delete the movzx if only QImode is needed.
(define_expand "seq"
! [(set (match_operand:SI 0 "register_operand" "")
! (eq:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (EQ, operands[0])) DONE; else FAIL;")
(define_expand "sne"
! [(set (match_operand:SI 0 "register_operand" "")
! (ne:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (NE, operands[0])) DONE; else FAIL;")
(define_expand "sgt"
! [(set (match_operand:SI 0 "register_operand" "")
! (gt:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GT, operands[0])) DONE; else FAIL;")
(define_expand "sgtu"
! [(set (match_operand:SI 0 "register_operand" "")
! (gtu:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GTU, operands[0])) DONE; else FAIL;")
(define_expand "slt"
! [(set (match_operand:SI 0 "register_operand" "")
! (lt:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LT, operands[0])) DONE; else FAIL;")
(define_expand "sltu"
! [(set (match_operand:SI 0 "register_operand" "")
! (ltu:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LTU, operands[0])) DONE; else FAIL;")
(define_expand "sge"
! [(set (match_operand:SI 0 "register_operand" "")
! (ge:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GE, operands[0])) DONE; else FAIL;")
(define_expand "sgeu"
! [(set (match_operand:SI 0 "register_operand" "")
! (geu:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GEU, operands[0])) DONE; else FAIL;")
(define_expand "sle"
! [(set (match_operand:SI 0 "register_operand" "")
! (le:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LE, operands[0])) DONE; else FAIL;")
(define_expand "sleu"
! [(set (match_operand:SI 0 "register_operand" "")
! (leu:SI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LEU, operands[0])) DONE; else FAIL;")
(define_expand "sunordered"
! [(set (match_operand:SI 0 "register_operand" "")
! (unordered:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNORDERED, operands[0])) DONE; else FAIL;")
(define_expand "sordered"
! [(set (match_operand:SI 0 "register_operand" "")
! (ordered:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387"
"if (ix86_expand_setcc (ORDERED, operands[0])) DONE; else FAIL;")
(define_expand "suneq"
! [(set (match_operand:SI 0 "register_operand" "")
! (uneq:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNEQ, operands[0])) DONE; else FAIL;")
(define_expand "sunge"
! [(set (match_operand:SI 0 "register_operand" "")
! (unge:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNGE, operands[0])) DONE; else FAIL;")
(define_expand "sungt"
! [(set (match_operand:SI 0 "register_operand" "")
! (ungt:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNGT, operands[0])) DONE; else FAIL;")
(define_expand "sunle"
! [(set (match_operand:SI 0 "register_operand" "")
! (unle:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNLE, operands[0])) DONE; else FAIL;")
(define_expand "sunlt"
! [(set (match_operand:SI 0 "register_operand" "")
! (unlt:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNLT, operands[0])) DONE; else FAIL;")
(define_expand "sltgt"
! [(set (match_operand:SI 0 "register_operand" "")
! (ltgt:SI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")
--- 12417,12526 ----
;; way, which can later delete the movzx if only QImode is needed.
(define_expand "seq"
! [(set (match_operand:QI 0 "register_operand" "")
! (eq:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (EQ, operands[0])) DONE; else FAIL;")
(define_expand "sne"
! [(set (match_operand:QI 0 "register_operand" "")
! (ne:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (NE, operands[0])) DONE; else FAIL;")
(define_expand "sgt"
! [(set (match_operand:QI 0 "register_operand" "")
! (gt:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GT, operands[0])) DONE; else FAIL;")
(define_expand "sgtu"
! [(set (match_operand:QI 0 "register_operand" "")
! (gtu:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GTU, operands[0])) DONE; else FAIL;")
(define_expand "slt"
! [(set (match_operand:QI 0 "register_operand" "")
! (lt:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LT, operands[0])) DONE; else FAIL;")
(define_expand "sltu"
! [(set (match_operand:QI 0 "register_operand" "")
! (ltu:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LTU, operands[0])) DONE; else FAIL;")
(define_expand "sge"
! [(set (match_operand:QI 0 "register_operand" "")
! (ge:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GE, operands[0])) DONE; else FAIL;")
(define_expand "sgeu"
! [(set (match_operand:QI 0 "register_operand" "")
! (geu:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (GEU, operands[0])) DONE; else FAIL;")
(define_expand "sle"
! [(set (match_operand:QI 0 "register_operand" "")
! (le:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LE, operands[0])) DONE; else FAIL;")
(define_expand "sleu"
! [(set (match_operand:QI 0 "register_operand" "")
! (leu:QI (reg:CC 17) (const_int 0)))]
""
"if (ix86_expand_setcc (LEU, operands[0])) DONE; else FAIL;")
(define_expand "sunordered"
! [(set (match_operand:QI 0 "register_operand" "")
! (unordered:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNORDERED, operands[0])) DONE; else FAIL;")
(define_expand "sordered"
! [(set (match_operand:QI 0 "register_operand" "")
! (ordered:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387"
"if (ix86_expand_setcc (ORDERED, operands[0])) DONE; else FAIL;")
(define_expand "suneq"
! [(set (match_operand:QI 0 "register_operand" "")
! (uneq:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNEQ, operands[0])) DONE; else FAIL;")
(define_expand "sunge"
! [(set (match_operand:QI 0 "register_operand" "")
! (unge:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNGE, operands[0])) DONE; else FAIL;")
(define_expand "sungt"
! [(set (match_operand:QI 0 "register_operand" "")
! (ungt:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNGT, operands[0])) DONE; else FAIL;")
(define_expand "sunle"
! [(set (match_operand:QI 0 "register_operand" "")
! (unle:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNLE, operands[0])) DONE; else FAIL;")
(define_expand "sunlt"
! [(set (match_operand:QI 0 "register_operand" "")
! (unlt:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (UNLT, operands[0])) DONE; else FAIL;")
(define_expand "sltgt"
! [(set (match_operand:QI 0 "register_operand" "")
! (ltgt:QI (reg:CC 17) (const_int 0)))]
"TARGET_80387 || TARGET_SSE"
"if (ix86_expand_setcc (LTGT, operands[0])) DONE; else FAIL;")