i386.c (test splitter): Narrow tests vs paradoxical subregs.

* i386.c (test splitter): Narrow tests vs paradoxical subregs.
        (jcc splitters): Add two splitters to simplify compound compares
        that simplify_comparison can't handle.

From-SVN: r46178
This commit is contained in:
Richard Henderson 2001-10-10 23:56:22 -07:00
parent 7f16eed442
commit 592188a538
2 changed files with 77 additions and 15 deletions

View File

@ -2,6 +2,10 @@
* combine.c (try_combine): Handle a SEQUENCE of one insn.
* i386.c (test splitter): Narrow tests vs paradoxical subregs.
(jcc splitters): Add two splitters to simplify compound compares
that simplify_comparison can't handle.
2001-10-10 Richard Henderson <rth@redhat.com>
* langhooks.c: Include langhooks.h.

View File

@ -8125,7 +8125,7 @@
HOST_WIDE_INT len = INTVAL (operands[1]);
HOST_WIDE_INT pos = INTVAL (operands[2]);
HOST_WIDE_INT mask;
enum machine_mode mode;
enum machine_mode mode, submode;
mode = GET_MODE (operands[0]);
if (GET_CODE (operands[0]) == MEM)
@ -8138,6 +8138,15 @@
operands[0] = adjust_address (operands[0], mode, 0);
}
}
else if (GET_CODE (operands[0]) == SUBREG
&& (submode = GET_MODE (SUBREG_REG (operands[0])),
GET_MODE_BITSIZE (mode) > GET_MODE_BITSIZE (submode))
&& pos + len <= GET_MODE_BITSIZE (submode))
{
/* Narrow a paradoxical subreg to prevent partial register stalls. */
mode = submode;
operands[0] = SUBREG_REG (operands[0]);
}
else if (mode == HImode && pos + len <= 8)
{
/* Small HImode tests can be converted to QImode. */
@ -12745,6 +12754,55 @@
(const_int 0)
(const_int 1)))])
;; In general it is not safe to assume too much about CCmode registers,
;; so simplify-rtx stops when it sees a second one. Under certain
;; conditions this is safe on x86, so help combine not create
;;
;; seta %al
;; testb %al, %al
;; je Lfoo
(define_split
[(set (pc)
(if_then_else (ne (match_operator 0 "ix86_comparison_operator"
[(reg 17) (const_int 0)])
(const_int 0))
(label_ref (match_operand 1 "" ""))
(pc)))]
""
[(set (pc)
(if_then_else (match_dup 0)
(label_ref (match_dup 1))
(pc)))]
{
PUT_MODE (operands[0], VOIDmode);
})
(define_split
[(set (pc)
(if_then_else (eq (match_operator 0 "ix86_comparison_operator"
[(reg 17) (const_int 0)])
(const_int 0))
(label_ref (match_operand 1 "" ""))
(pc)))]
""
[(set (pc)
(if_then_else (match_dup 0)
(label_ref (match_dup 1))
(pc)))]
{
rtx new_op0 = copy_rtx (operands[0]);
operands[0] = new_op0;
PUT_MODE (new_op0, VOIDmode);
PUT_CODE (new_op0, REVERSE_CONDITION (GET_CODE (new_op0),
GET_MODE (XEXP (new_op0, 0))));
/* Make sure that (a) the CCmode we have for the flags is strong
enough for the reversed compare or (b) we have a valid FP compare. */
if (! ix86_comparison_operator (new_op0, VOIDmode))
FAIL;
})
;; Define combination compare-and-branch fp compare instructions to use
;; during early optimization. Splitting the operation apart early makes
;; for bad code when we want to reverse the operation.