<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
Hi David,
<div class=""><br class="">
</div>
<div class="">I thought that mtune just wasn’t supported for any target in clang, but I may be wrong.</div>
<div class="">FWIW, the following thread discusses what would be needed to implement support for mtune: <a href="http://lists.llvm.org/pipermail/llvm-dev/2017-October/118344.html" class="">http://lists.llvm.org/pipermail/llvm-dev/2017-October/118344.html</a></div>
<div class="">AFAIK, so far nobody has worked on implementing that proposal.</div>
<div class=""><br class="">
</div>
<div class="">Thanks,</div>
<div class=""><br class="">
</div>
<div class="">Kristof<br class="">
<div><br class="">
<blockquote type="cite" class="">
<div class="">On 28 Feb 2019, at 21:42, David Greene via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div class="">Stefan Teleman <<a href="mailto:stefan.teleman@gmail.com" class="">stefan.teleman@gmail.com</a>> writes:<br class="">
<br class="">
<blockquote type="cite" class="">On Thu, Feb 28, 2019 at 2:09 PM David Greene via cfe-dev<br class="">
<<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a>> wrote:<br class="">
<blockquote type="cite" class=""><br class="">
Interesting.  I am observing different behavior between -mcpu= and<br class="">
-march= -mtune= with aarch64-unknown-linux-gnu:<br class="">
</blockquote>
<br class="">
We never supported -mtune=thunderx2t99.<br class="">
<br class="">
-mcpu=thunderx2t99<br class="">
-march=armv8.1-a+lse<br class="">
</blockquote>
<br class="">
This is problematic for users.  If clang interprets command-line flags<br class="">
differently based on subtarget, how are users to know what to pass to<br class="">
clang to get, say, the best performance, or best code size, or whatever?<br class="">
<br class="">
Users don't expect to have to set up their build systems to pass<br class="">
different -mcpu/-march/-mtune flags based on what they are targeting.<br class="">
They want to do something like this and be done with it:<br class="">
<br class="">
TARGET=$(call get_triple)<br class="">
ARCH=$(call get_arch)<br class="">
TUNE=$(call get_tune)<br class="">
<br class="">
CFLAGS += --target ${TARGET} -march=${ARCH) -mtune=${TUNE}<br class="">
<br class="">
They could, but probably won't be happy to, do:<br class="">
<br class="">
ifeq (TARGET,aarch64-unknown-linux-gnu)<br class="">
 ifeq (TUNE,thunderx2t99)<br class="">
   # -mtune unsupported<br class="">
   CFLAGS += -mcpu=${TUNE}<br class="">
 else ifeq (TUNE,anothertarget)<br class="">
   # -mcpu unsupported<br class="">
   CFLAGS += -march=${ARCH} -mtune=${TUNE}<br class="">
 else ifeq (TUNE,thirdtarget)<br class="">
   CFLAGS += -mtune=${TUNE}<br class="">
 endif<br class="">
else ifeq(TARGET,x86_64-unknown-linux-gnu)<br class="">
 ifeq (TUNE,skylake-avx512)<br class="">
   # -mtune unsupported<br class="">
   CFLAGS += -mcpu=${TUNE}<br class="">
 else ifeq (TUNE,broadwell)<br class="">
   # -mcpu unsupported<br class="">
   CFLAGS += -march=${ARCH} -mtune=${TUNE}<br class="">
 endif<br class="">
else ifeq(TARGET,third-target-triple)<br class="">
 # -mcpu and -mtune unsupported<br class="">
 CFLAGS += -march=${ARCH}<br class="">
endif<br class="">
<br class="">
It's hard enough for users to support building for multiple subtargets<br class="">
without having to deal with basic compiler behavior differences per<br class="">
subtarget.<br class="">
<br class="">
Perhaps there is some capability of clang I'm not understanding.  What's<br class="">
the expected/canonical way to tune compilation for a subtarget?<br class="">
<br class="">
                        -David<br class="">
_______________________________________________<br class="">
cfe-dev mailing list<br class="">
<a href="mailto:cfe-dev@lists.llvm.org" class="">cfe-dev@lists.llvm.org</a><br class="">
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev<br class="">
</div>
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>