[PATCH]: finish .cpu support for ARM

Joerg Sonnenberger joerg at britannica.bec.de
Wed Dec 3 12:42:32 PST 2014


On Wed, Dec 03, 2014 at 07:18:31PM +0000, Renato Golin wrote:
> The new behaviour is that functions that do not have .cpu directives
> in it will start having it. Consider the case where I'm compiling to
> ARMv4, but have inline asm on one function that has ".cpu cortex-a15"
> to enable hardware divide, because "you know" that only in that case
> that function will be executed.

I don't think that's anything new and one of the hundred cases of
Undefined Behavior with inline assembly that doesn't fully restore the
state. Don't do that. It's not the job of the compiler to tell you that
your code is broken.

> This means that, by adding a new cpu-specific function to your
> library, you lose the ability to detect miscompilations in the
> *entire* library.

This is wrong. Only if you (a) use inline assembler and (b) don't make
it self contained.

Joerg



More information about the llvm-commits mailing list