Boost logo

Boost :

From: Michael van der Westhuizen (r1mikey_at_[hidden])
Date: 2006-07-03 10:39:49


On 7/3/06, Peter Dimov <pdimov_at_[hidden]> wrote:
> Tomas Puverle wrote:
> >>> You may want to reconsider this fix. The assembly code in the
> >>> previous post will work on v8 or v9. The original test is correct.
> >>
> >> Unfortunately, I'm told that the default for g++ is V7 and the code
> >> is being rejected. I don't have access to a Sparc and am unable to
> >> test it myself.
> >
> > For 32bit compilation, consider this:
> >
> > g++ -mcpu=v8 -mtune=ultrasparc3 <file>
> >
> > For 64bit compilation, try this
> >
> > g++ -mcpu=v9 -mtune=ultrasparc3 -m64 <file>
> >
> > I think this should work.
>
> I'm more interested in the source code side; as I understand it, g++ <file>
> will fail if we test __sparc__ and try to use cas. Do you think that
>
> #if defined( __sparc_v8__ ) || defined( __sparc_v9__ )
>
> will work reliably (by which I mean, include the header file when it would
> compile, and not include it when its compilation would fail)?

I've just tested the above guard, and it works.

Before changing to this, I got the following error:
/usr/ccs/bin/as: "/var/tmp//ccHTWOlm.s", line 126: error: cannot use
v8plus instructions in a non-v8plus target binary

After the change, g++ with no machine/cpu arguments produces a binary
which file says is:
shared_ptr_mt_test: ELF 32-bit MSB executable SPARC Version 1,
dynamically linked, not stripped

With machine/cpu flags set to "-m32 -mcpu=ultrasparc -mtune=ultrasparc3":
shared_ptr_mt_test: ELF 32-bit MSB executable SPARC32PLUS Version
1, V8+ Required, UltraSPARC1 Extensions Required, dynamically linked,
not stripped

Timing tests tell me that the correct code is selected :-)

Michael


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk