[Xorg-driver-geode] proposal: always build with -march=geode

Writer, Tim Tim.Writer at amd.com
Mon Jul 5 09:55:37 PDT 2010


On Fri, Jul 02 2010, Martin-Éric Racine <q-funk at iki.fi> wrote:

> On Wed, Jun 30, 2010 at 6:45 PM, Writer, Tim <Tim.Writer at amd.com> wrote:
>> This (building with `-march=geode') seems reasonable to me.
>
> http://cgit.freedesktop.org/gstreamer/common/tree/m4/as-compiler-flag.m4
>
> This seems to be a good example of how to check for the validity of
> "geode" as an -march and -mtune option.

The approach seems reasonable but I disagree with the name
`AS_COMPILER_FLAGS'. The `AS_' prefix appears to be reserved for M4sh:

    http://www.gnu.org/software/autoconf/manual/html_node/Programming-in-M4sh.html#Programming-in-M4sh

If this macro were pushed upstream into Autoconf it would probably be
called `AC_COMPILER_FLAGS' or similar. If we're going to incorporate it
into the Geode source, I'd suggest a Geode specific prefix.

> I'm just wondering what would be our correct response in case "geode"
> is not available? Would perhaps "-march=pentium-mmx -m3dnow" be
> suitable and usable on older GCC versions or should me simply not
> attempt to set any optimization if "geode" is not a supported option?

I would vote for the latter, i.e. try to tune for Geode but fall back to
conservative defaults. Assuming the Geode driver Makefiles are
"correct", users should always be able to override at build time with:

    make CFLAGS="-march='pentium-mmx -m3dnow'"

>> Regarding i686 optimizations that are incompatible with the Geode
>> instruction set, I'm working on this issue with AMD's GCC team.
>
> Glad to hear it.  Please keep us posted.

I will.

>> I also support the cross-compiling initiative, if only to allow
>> developers to take advantage of more capable and performant development
>> machines that many developers have.
>
> http://wiki.debian.org/DebianAMD64Faq
>
> This seems to suggest that some tools exist to make an x86_64 switch
> personality to 32-bit, but I'm not sure whether this information is
> too Debian-specific or not.  Comments?

Lots of stuff is Debian specific but I would guess that this:

| Q. Cross-compiling a 32-bit (i386) Linux binary on 64-bit Machine (amd64)
|
| Short answer, depending of the tool you use, you can use one of:
|
| linux32 make
| linux32 dpkg-buildpackage
| linux32 git-buildpackage

should work for cross compiling for Geode on most x86_64
distributions. The `linux32' utility exists on an RHEL5.3 system I have
and SLED appears to have it too:

    http://www.novell.com/products/linuxpackages/enterpriseserver/x86-64/linux32.html

Note that this only changes the personality for the purposes of
compilation -- sufficient for our needs, I think -- but it's not a
solution to the more general problem of running 32-bit applications on
64-bit systems. I only mention that because my first thought on seeing a
command called `linux32' was how can this possibly work?

A reasonable approach would be to add something like this to configure:

    case `uname -m` in
      (i?86)
                # Do nothing
                ;;
      (x86_64)
                if `type -p linux32 >/dev/null`; then
                    # Arrange to compile and link with `linux32 $CC ...'
                else
                    # Fail noisily
                fi
                ;;
      (*)
                # Fail nosily
                ;;
    esac

Having said that, it might just be easier to document for users that
they should just build with:

    linux32 configure ...
    linux32 make ...

etc.

Tim



More information about the Xorg-driver-geode mailing list