This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
i386 test tweeks
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, rth at cygnus dot com
- Date: Fri, 10 May 2002 22:40:22 +0200
- Subject: i386 test tweeks
Hi,
the attached patch adds code to convert testl imm, reg to testb imm, reg where
possible. For some purpose it makes 20% difference on the testcase I got as 2.95
regression.
Fri May 10 22:39:39 CEST 2002 Jan Hubicka <jh@suse.cz>
* i386.md (testl to testb splitters): New.
(testl to and peep2): Fix conditional.
*** i386.md.old Fri May 10 18:48:52 2002
--- i386.md Fri May 10 20:19:04 2002
***************
*** 8339,8344 ****
--- 8578,8629 ----
operands[3] = gen_rtx_AND (mode, operands[0], gen_int_mode (mask, mode));
})
+ ;; Convert HImode/SImode test instructions with immediate to QImode ones.
+ ;; i386 does not allow to encode test with 8bit sign extended immediate, so
+ ;; this is relatively important trick.
+ ;; Do the converison only post-reload to avoid limiting of the register class
+ ;; to QI regs.
+ (define_split
+ [(set (reg 17)
+ (compare
+ (and (match_operand 0 "register_operand" "")
+ (match_operand 1 "const_int_operand" ""))
+ (const_int 0)))]
+ "(!TARGET_PROMOTE_QImode || optimize_size)
+ && reload_completed
+ && QI_REG_P (operands[0])
+ && ((ix86_match_ccmode (insn, CCZmode) && !(INTVAL (operands[1]) & ~(255 << 8)))
+ || (ix86_match_ccmode (insn, CCNOmode) && !(INTVAL (operands[1]) & ~(127 << 8))))
+ && GET_MODE (operands[0]) != QImode"
+ [(set (reg:CCNO 17)
+ (compare:CCNO
+ (and:SI (zero_extract:SI (match_dup 0) (const_int 8) (const_int 8))
+ (match_dup 1))
+ (const_int 0)))]
+ "operands[0] = gen_lowpart (SImode, operands[0]);
+ operands[1] = gen_int_mode (INTVAL (operands[1]) >> 8, QImode);")
+
+ (define_split
+ [(set (reg 17)
+ (compare
+ (and (match_operand 0 "nonimmediate_operand" "")
+ (match_operand 1 "const_int_operand" ""))
+ (const_int 0)))]
+ "(!TARGET_PROMOTE_QImode || optimize_size)
+ && reload_completed
+ && (!REG_P (operands[0]) || ANY_QI_REG_P (operands[0]))
+ && ((ix86_match_ccmode (insn, CCZmode) && !(INTVAL (operands[1]) & ~255))
+ || (ix86_match_ccmode (insn, CCNOmode) && !(INTVAL (operands[1]) & ~127)))
+ && GET_MODE (operands[0]) != QImode"
+ [(set (reg:CCNO 17)
+ (compare:CCNO
+ (and:QI (match_dup 0)
+ (match_dup 1))
+ (const_int 0)))]
+ "operands[0] = gen_lowpart (QImode, operands[0]);
+ operands[1] = gen_lowpart (QImode, operands[1]);")
+
+
;; %%% This used to optimize known byte-wide and operations to memory,
;; and sometimes to QImode registers. If this is considered useful,
;; it should be done with splitters.
***************
*** 17191,17197 ****
(const_int 0)))]
"ix86_match_ccmode (insn, CCNOmode)
&& (true_regnum (operands[0]) != 0
! || CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K'))
&& find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
[(parallel
[(set (reg:CCNO 17)
--- 17476,17483 ----
(const_int 0)))]
"ix86_match_ccmode (insn, CCNOmode)
&& (true_regnum (operands[0]) != 0
! || (GET_CODE (operands[1]) == CONST_INT
! && CONST_OK_FOR_LETTER_P (INTVAL (operands[1]), 'K')))
&& find_regno_note (insn, REG_DEAD, true_regnum (operands[0]))"
[(parallel
[(set (reg:CCNO 17)