[libc-commits] [PATCH] D100646: [libc] Add a set of elementary operations
Andre Vieira via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Apr 28 09:13:43 PDT 2021
avieira added inline comments.
================
Comment at: libc/test/src/string/memory_utils/CMakeLists.txt:14
+ COMPILE_OPTIONS
+ -march=native
)
----------------
sivachandra wrote:
> gchatelet wrote:
> > avieira wrote:
> > > AArch64 doesn't support -march=native, we use -mcpu=native instead, so it would be good to specify the correct option per target.
> > Thx I wasn't aware of this. I found this article, it's helpful and confusing at the same time :-D
> > https://community.arm.com/developer/tools-software/tools/b/tools-software-ides-blog/posts/compiler-flags-across-architectures-march-mtune-and-mcpu
> >
> > @sivachandra should we define a new CMake macro or do you think this should be part of `add_libc_unittest`?
> > The aim is to use whatever is available on the host machine when performing the tests.
> > @sivachandra should we define a new CMake macro or do you think this should be part of `add_libc_unittest`?
> > The aim is to use whatever is available on the host machine when performing the tests.
>
> I suppose you are asking about adding `-march=native` and `-mcpu=native`? If yes, then I think we should add a top-level var like `LLVM_LIBC_COMMON_COMPILE_OPTIONS` which get set to the appropriate value based on the target machine. And then, both `add_entrypoint_object` and `add_libc_unittest` should use it.
@gchatelet I didn't quite understand why only use -march/-mcpu during the tests and not for the benchmarking for instance. @sivachandra approach sounds better to me.
As for the options, I think the simple (but maybe somewhat naive) explanation is '-march': determines what features are available, '-mtune': sets the micro-architecture tuning strategy and '-mcpu' set's both for the micro-architecture you pass it. When you pass native it tries to autodetect the micro-architecture.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100646/new/
https://reviews.llvm.org/D100646
More information about the libc-commits
mailing list