public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "kazu at cs dot umass dot edu" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug optimization/14504] Missed Bit Twiddling Optimization
Date: Thu, 11 Mar 2004 22:29:00 -0000	[thread overview]
Message-ID: <20040311222946.25549.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040309171658.14504.stl@caltech.edu>


------- Additional Comments From kazu at cs dot umass dot edu  2004-03-11 22:29 -------
Err, i386 is a two-address machine with only a few registers,
so cmove doesn't work as well in this case.

typedef _Bool bool;

unsigned long
cond_mask (bool flag, unsigned long mask, unsigned long target)
{
  unsigned long l = target | mask;
  unsigned long r = target & ~mask;
  return flag ? l : r;
#if 0
	pushl	%ebx
	movl	%eax, %ebx ; %bl = flag
	movl	%ecx, %eax
	orl	%edx, %eax ; %eax = target | mask
	notl	%edx       ; ~mask
	andl	%ecx, %edx ; %edx = target & ~mask
	testb	%bl, %bl
	popl	%ebx
	cmove	%edx, %eax
#endif
}


-- 


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


      parent reply	other threads:[~2004-03-11 22:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-09 17:17 [Bug optimization/14504] New: " stl at caltech dot edu
2004-03-09 17:35 ` [Bug optimization/14504] " pinskia at gcc dot gnu dot org
2004-03-09 18:01 ` [Bug optimization/14504] New: " Falk Hueffner
2004-03-11  0:09 ` [Bug optimization/14504] " kazu at cs dot umass dot edu
2004-03-11 21:33 ` stl at caltech dot edu
2004-03-11 21:35 ` kazu at cs dot umass dot edu
2004-03-11 21:41 ` stl at caltech dot edu
2004-03-11 22:10 ` falk at debian dot org
2004-03-11 22:21 ` stl at caltech dot edu
2004-03-11 22:29 ` kazu at cs dot umass dot edu [this message]

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=20040311222946.25549.qmail@sources.redhat.com \
    --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).