public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pb at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/10982] [arm] poor optimisation of "if (var & const)"
Date: Sun, 09 May 2004 17:11:00 -0000	[thread overview]
Message-ID: <20040509171131.2570.qmail@sourceware.org> (raw)
In-Reply-To: <20030526135310.10982.pb@gcc.gnu.org>


------- Additional Comments From pb at gcc dot gnu dot org  2004-05-09 17:11 -------
For that particular testcase, adding a pattern like the one below seems to allow
combine to do the right thing.  However, changing the "return 1" to "return 2"
prevents this from matching.  Something a bit more sophisticated might be needed.

--

(define_insn_and_split "*zero_extract_compare0_shifted"
  [(set (match_operand:SI 0 "s_register_operand" "=r")
	(ne:SI (zero_extract:SI (match_operand:SI 1 "s_register_operand" "r")
		        	   (match_operand:SI 2 "const_int_operand" "n")
			      	   (const_int 0))
	            	  (const_int 0)))
   (clobber (reg:CC CC_REGNUM))]
  "TARGET_ARM"
  "#"
  ""
  [(parallel [(set (reg:CC_NOOV CC_REGNUM)
		   (compare:CC_NOOV (ashift:SI (match_dup 1)
			                       (match_dup 2))
			            (const_int 0)))
	      (set (match_dup 0)
		   (ashift:SI (match_dup 1) (match_dup 2)))])
   (set (match_dup 0)
        (if_then_else (eq:SI (reg:CC_NOOV CC_REGNUM) (const_int 0))
	              (match_dup 0)
		      (const_int 1)))]
  ""
)

;; Match the second half of *zero_extract_compare0_shifted
(define_insn "*movsi_conditional"
  [(set (match_operand:SI 0 "s_register_operand" "=r")
        (if_then_else (eq:SI (reg:CC_NOOV CC_REGNUM) (const_int 0))
	              (match_dup 0)
		      (match_operand:SI 1 "const_int_operand" "n")))]
  "TARGET_ARM"
  "movne\\t%0, %1"
  [(set_attr "conds" "use")]
)


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|unknown                     |3.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10982


  parent reply	other threads:[~2004-05-09 17:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-26 13:58 [Bug optimization/10982] New: " pb@gcc.gnu.org
2003-06-22  3:29 ` [Bug optimization/10982] " pinskia at physics dot uc dot edu
2004-05-09 17:11 ` pb at gcc dot gnu dot org [this message]
2004-05-17 11:27 ` [Bug target/10982] " rearnsha at gcc dot gnu dot org
2004-05-17 11:32 ` cvs-commit at gcc dot gnu dot org
2004-05-17 11:38 ` rearnsha at gcc dot gnu dot org
2004-05-17 11:40 ` rearnsha at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040509171131.2570.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).