Are there cpu instructions specific to the X1000 as opposed to the AmigaOne at the user application layer?
What is a typical way to compile a c program that makes use of X1000's cpu specific code? How is it that the various libraries available at OS4Depot work on all the various cpus?
I can speculate, but would rather start down a less random path with my w(a|o)ndering.
Years ago I would specify 68000 / 010 / 020 / 030 (never got as far as 040 and 060) + FPU. For really old it was ancient seemingly one of a kind computers from the 1970s. Things got murkier when I later quit doing assembly and did c, depending on "IDE setups" which always happened to be on some flavor of Intel machine that was also the target. I got to where I didn't concern myself with the concept of cross compiling on those machines. (They seem to be backwardly compatible without much thought.... except hardware features being totally dropped.)
I will be easily satisfied with a reference to a discussion elsewhere that is specific to the general OS4 situation in this regard.
optimized X1000 executables
optimized X1000 executables
George Wyche
Re: optimized X1000 executables
I believe that the X1000's CPU supports AltiVec, and that would be your best bet for getting significant speed-ups. AlitVec also has the benefit of being supported by Eyetech AmigaOnes' (with a suitable CPU).
- tonyw
- AmigaOS Core Developer
- Posts: 1483
- Joined: Wed Mar 09, 2011 1:36 pm
- Location: Sydney, Australia
Re: optimized X1000 executables
The usual way is to call IExpansion->GetMachineInfoTags();. This will tell you what sort of CPU the machine has, so you can branch to specific code at critical times.
For example:
IExpansion->GetMachineInfoTags(
GMIT_Machine, &machineType,
TAG_DONE);
Then switch on the returned value:
switch (machineType)
{
case MACHINETYPE_BLIZZARDPPC:
(etc)
}
Some machines (eg MACHINETYPE_AMIGAONE) will need more detail about Altivec CPUs, etc. You can use IExec->GetCPUInfoTags for that:
IExec->GetCPUInfoTags(
GCIT_Family, &cpuFamily,
GCIT_Model, &cpuType,
TAG_DONE);
See the autodocs/exec.doc and expansion.doc for details.
For example:
IExpansion->GetMachineInfoTags(
GMIT_Machine, &machineType,
TAG_DONE);
Then switch on the returned value:
switch (machineType)
{
case MACHINETYPE_BLIZZARDPPC:
(etc)
}
Some machines (eg MACHINETYPE_AMIGAONE) will need more detail about Altivec CPUs, etc. You can use IExec->GetCPUInfoTags for that:
IExec->GetCPUInfoTags(
GCIT_Family, &cpuFamily,
GCIT_Model, &cpuType,
TAG_DONE);
See the autodocs/exec.doc and expansion.doc for details.
cheers
tony
tony
Re: optimized X1000 executables
@tonyw
I guess this means that all of the libraries to date lack "special" support for X1000 cpus.
Library revision over time might add that support.
Thanks.
I guess this means that all of the libraries to date lack "special" support for X1000 cpus.
Library revision over time might add that support.
Thanks.
George Wyche
Re: optimized X1000 executables
@ggw
IMHO, it does not make sense to optimise for a particular CPU in a particular machine (e.g. G4 in an original AmigaOne), because in general you will gain *very* little from it, but you will end-up with an executable(s) that almost no-one can use. IMHO it only makes sense to optimise for a particular CPU (or better, a CPU *feature*, e.g. AltiVec) when you will gain a significant speed advantage (e.g. 1/3 or more).
It always annoyed me when there were executables compiled for '000, '020, '030, '040 & '060, because I suspect that most of them performed (virtually) no different than any other, so they just wasted disk space & caused confusion. I especially suspect that the '020, '030 & '040 versions were virtually identical, such that you could get rid of the '030 & '040 versions without any problem. (The '000 is needed for compatibility with the oldest machines, while the '020 added cache support (rather important to not kill performance), and the '060 lost some instructions (and significantly differed in other aspects) thus making it somewhat incompatible anyway.)
The X1000's CPU already runs generic PPC executables very fast, so I don't really see the need for creating a special executable (except for AltiVec).
IMHO, it does not make sense to optimise for a particular CPU in a particular machine (e.g. G4 in an original AmigaOne), because in general you will gain *very* little from it, but you will end-up with an executable(s) that almost no-one can use. IMHO it only makes sense to optimise for a particular CPU (or better, a CPU *feature*, e.g. AltiVec) when you will gain a significant speed advantage (e.g. 1/3 or more).
It always annoyed me when there were executables compiled for '000, '020, '030, '040 & '060, because I suspect that most of them performed (virtually) no different than any other, so they just wasted disk space & caused confusion. I especially suspect that the '020, '030 & '040 versions were virtually identical, such that you could get rid of the '030 & '040 versions without any problem. (The '000 is needed for compatibility with the oldest machines, while the '020 added cache support (rather important to not kill performance), and the '060 lost some instructions (and significantly differed in other aspects) thus making it somewhat incompatible anyway.)
The X1000's CPU already runs generic PPC executables very fast, so I don't really see the need for creating a special executable (except for AltiVec).
Re: optimized X1000 executables
Oh come on ChrisH
It's part of Amiga history to try and tweak that extra cycle
In the later years when I used to compile I'd use -m68020-60 eliminating cpu specific renditions (probably not as optimised as there pure incarnations though)
Does anyone know the exact switches one uses in the gcc command line for AmigaOS4.x gcc or are they listed in an AmigaOS4.x supplement?
It's part of Amiga history to try and tweak that extra cycle

In the later years when I used to compile I'd use -m68020-60 eliminating cpu specific renditions (probably not as optimised as there pure incarnations though)
Does anyone know the exact switches one uses in the gcc command line for AmigaOS4.x gcc or are they listed in an AmigaOS4.x supplement?
~Yes I am a Kiwi, No, I did not appear as an extra in 'Lord of the Rings'~
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x
1x AmigaOne X5000 2.0GHz 2gM RadeonR9280X AOS4.x
3x AmigaOne X1000 1.8GHz 2gM RadeonHD7970 AOS4.x