This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Mined out of comp.std.c...
- From: Peter Barada <pbarada at mail dot wm dot sps dot mot dot com>
- To: me at rupey dot net
- Cc: nathan at cs dot bris dot ac dot uk, rth at redhat dot com, tim at hollebeek dot com, zack at codesourcery dot com, gcc at gcc dot gnu dot org, jh at suse dot cz
- Date: Thu, 25 Apr 2002 13:59:25 -0400
- Subject: Re: Mined out of comp.std.c...
- References: <616BE6A276E3714788D2AC35C40CD18D5EC369@whale.softwire.co.uk>
>> OK, last thought on the matter before I go slit my wrists in
>> shame.
>
>Except that didn't work. I think I'll give up and go home - I can't seem
>to manage to redeem myself.
>
>Problem is I put 'setnc' as a quick hack and didn't notice it broke my
>non-overflow testcase. What I really needed was 'set carry xor overflow'
>but there's no primitive for that and I can't construct something out of
>set[n]o and sbb or adc.
Go grab superopt-2.5.tar.gz from the gnu tree, config it for intel
and run it to search for a sequence that evaluates 'maxs':
[pbarada: ~/src/superopt-2.5] > ./superopt -fmaxs -max-cost 5
Searching for { r = (signed_word) v0 > (signed_word) v1 ? v0 : v1; }
Superoptimizing at cost 1 2 3 4 5 failure.
Which indicates that the superoptimizer can not find a 5 instruction
sequence to do this. Obviously if you crank up max-costs a bit and
let it run over the weekend it *might* find a sequence worth
investigating. If your max function is *unsigned*, superopt finds a
batch of matches quite quickly:
[pbarada: ~/src/superopt-2.5] > ./superopt -fmaxu -max-cost 5
Searching for { r = (unsigned_word) v0 > (unsigned_word) v1 ? v0 : v1; }
Superoptimizing at cost 1 2 3 4 5
1: r1:=sub_co(r1,r0)
r0:=add_co(r0,r1)
r2:=sub_cio(r2,r2)
r2:=and_rc(r2,r1)
r0:=sub_co(r0,r2)
2: r1:=sub_co(r1,r0)
r0:=add_co(r0,r1)
r2:=sub_cio(r2,r2)
r1:=and_rc(r1,r2)
r0:=sub_co(r0,r1)
...
Have Fun!
--
Peter Barada Peter.Barada@motorola.com
Wizard 781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola) 781-270-0193 (fax)