help-rcs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug optimization/14504] Missed Bit Twiddling Optimization


From: kazu at cs dot umass dot edu
Subject: [Bug optimization/14504] Missed Bit Twiddling Optimization
Date: 11 Mar 2004 22:29:46 -0000

------- 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]