Arch-independent double-word clz expansion and a few other tweaks for bitscanning

Zack Weinberg zack@codesourcery.com
Sat Aug 11 17:56:00 GMT 2007


Rask Ingemann Lambertsen wrote:
> On Fri, Aug 10, 2007 at 11:45:33PM -0700, Zack Weinberg wrote:
>> ==================================================================
>> --- config/i386/i386.md	(revision 127388)
>> +++ config/i386/i386.md	(local)
>> @@ -14583,98 +14583,16 @@ (define_insn "leave_rex64"
> ...
>> +(define_insn "ctzsi2"
>> +  [(set (match_operand:SI 0 "register_operand" "=r")
>> +	(ctz:SI (match_operand:SI 1 "nonimmediate_operand" "rm")))
>> +   (set (reg:CCZ FLAGS_REG)
>> +        (compare:CCZ (match_dup 1) (const_int 0)))]
> 
>    Usually this sort of insn has the (set (reg:CCx FLAGS_REG) ...) part
> first because that's how combine wants it. Likewise with the other ones you
> added.

I'm happy to change it around, but empirically, it doesn't seem to make 
any difference: initial RTL generation produces

(insn 7 6 8 test.c:2 (parallel [
             (set (reg:CCZ 17 flags)
                 (compare:CCZ (reg/v:DI 59 [ x ])
                     (const_int 0 [0x0])))
             (set (reg:DI 61)
                 (ctz:DI (reg/v:DI 59 [ x ])))
         ]) -1 (nil))

despite that I wrote it the other way around in the insn pattern.

zw



More information about the Gcc-patches mailing list