[cfe-dev] Behavior of -mcpu

David Greene via cfe-dev cfe-dev at lists.llvm.org
Thu Feb 28 11:09:33 PST 2019


Interesting.  I am observing different behavior between -mcpu= and
-march= -mtune= with aarch64-unknown-linux-gnu:

$ clang -Ofast -S -target aarch64-unknown-linux-gnu -mcpu=thunderx2t99 -mllvm -debug-only=loop-data-prefetch ./prefetch.c
Prefetching 3 iterations ahead (loop size: 35) in partial: Loop at depth 1 containing: %for.body<header>
<latch><exiting>                   

$ clang -Ofast -S -target aarch64-unknown-linux-gnu -march=armv8 -mtune=thunderx2t99 -mllvm -debug-only=loop-data-prefetch ./prefetch.c
[nothing]

I expected to see the same behavior.  Is this a bug?  Just to be sure I
tried armv8.1a, armv8.2a and armv8.3a and still got nothing.

                                -David

Craig Topper <craig.topper at gmail.com> writes:

> Which triple are you targeting. Whether or not -mcpu does anything is
> specific to that.
>
> ~Craig
>
> On Thu, Feb 28, 2019 at 10:17 AM David Greene via cfe-dev
> <cfe-dev at lists.llvm.org> wrote:
>
>     When I pass -mcpu=<something> to clang, I get this:
>     
>     clang-9: warning: argument unused during compilation: '
>     -mcpu=<something>' [-Wunused-command-line-argume nt]
>     
>     Worse, I do not get code generated for <something> but rather (I
>     think)
>     for whatever the host architecture is.
>     
>     Is this expected behavior? I know I can use -mtune and -march to
>     control things but I expected -mcpu to behave like it does in gcc,
>     where
>     it implies -mtune and -march. I certainly did not expect it to be
>     completely ignored.
>     
>     Thanks for any help!
>     
>     -David
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at lists.llvm.org
>     https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list