prasannatsmkumar wrote:
> Oh Okay. With less optimisation (optimisation turned off) the code
> could have run.
In this particular case, likely to be yes IMHO.
> Is that safe to assume?
In the general case, of course not: if you ask the compiler to target
some determinate processor and features, you can expect the generated
code to potentially take into account all the opportunities allowed by
the targeted processor, and you cannot expect the generated code to run
on any inferior processor. Even turning optimizations off.
> If the CPU architecture is
> specified I guess the compiler would have taken the appropriate option
This is the general idea, yes; if it does not, it's called a bug ;-)
> (as it knows the cpu does not have SSE2).
Basically it works this way, yes: you need to specify the target
processor (here should have been `-march=pentium3`), the compiler
deduces the set of features available on target (here, deduces that SSE2
are lacking) and generates code appropriately.
Note there is also a nice option, `-march=native`, which "guesses" the
correct best fit for the current machine.
Antoine