From 2219f0c2990ec05322bf063ce23385b42583a311 Mon Sep 17 00:00:00 2001 From: Oleg Endo Date: Wed, 24 Dec 2014 21:55:59 +0000 Subject: [PATCH] re PR target/51244 ([SH] Inefficient conditional branch and code around T bit) gcc/ PR target/51244 * config/sh/sh.md (*mov_t_msb_neg): Convert split into insn_and_split. From-SVN: r219062 --- gcc/ChangeLog | 5 +++++ gcc/config/sh/sh.md | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d2870d6b21d..2d21dfe3c5a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-12-24 Oleg Endo + + PR target/51244 + * config/sh/sh.md (*mov_t_msb_neg): Convert split into insn_and_split. + 2014-12-24 Uros Bizjak * gengtype.h (xasprintf): Remove declaration. diff --git a/gcc/config/sh/sh.md b/gcc/config/sh/sh.md index 7b68aa1b912..225cc3618a5 100644 --- a/gcc/config/sh/sh.md +++ b/gcc/config/sh/sh.md @@ -11601,8 +11601,8 @@ label: (set (match_dup 0) (xor:SI (match_dup 0) (const_int 1)))]) ;; Use negc to store the T bit in a MSB of a reg in the following way: -;; T = 1: 0x80000000 -> reg -;; T = 0: 0x7FFFFFFF -> reg +;; T = 0: 0x80000000 -> reg +;; T = 1: 0x7FFFFFFF -> reg ;; This works because 0 - 0x80000000 = 0x80000000. ;; ;; This insn must not match again after it has been split into the constant @@ -11635,27 +11635,27 @@ label: "negc %1,%0" [(set_attr "type" "arith")]) -;; These are essentially the same as above, but with the inverted T bit. -;; Combine recognizes the split patterns, but does not take them sometimes -;; if the T_REG clobber is specified. Instead it tries to split out the -;; T bit negation. Since these splits are supposed to be taken only by -;; combine, it will see the T_REG clobber of the *mov_t_msb_neg insn, so this -;; should be fine. -(define_split +(define_insn_and_split "*mov_t_msb_neg" [(set (match_operand:SI 0 "arith_reg_dest") (plus:SI (match_operand 1 "negt_reg_operand") - (const_int 2147483647)))] ;; 0x7fffffff - "TARGET_SH1 && can_create_pseudo_p ()" + (const_int 2147483647))) ;; 0x7fffffff + (clobber (reg:SI T_REG))] + "TARGET_SH1" + "#" + "&& can_create_pseudo_p ()" [(parallel [(set (match_dup 0) (minus:SI (const_int -2147483648) (reg:SI T_REG))) (clobber (reg:SI T_REG))])]) -(define_split +(define_insn_and_split "*mov_t_msb_neg" [(set (match_operand:SI 0 "arith_reg_dest") (if_then_else:SI (match_operand 1 "t_reg_operand") (const_int 2147483647) ;; 0x7fffffff - (const_int -2147483648)))] ;; 0x80000000 - "TARGET_SH1 && can_create_pseudo_p ()" + (const_int -2147483648))) ;; 0x80000000 + (clobber (reg:SI T_REG))] + "TARGET_SH1" + "#" + "&& can_create_pseudo_p ()" [(parallel [(set (match_dup 0) (minus:SI (const_int -2147483648) (reg:SI T_REG))) (clobber (reg:SI T_REG))])]) -- 2.30.2