LLVM/Clang 16 Adds Support For -mcpu=native & -mtune=native On RISC-V

Written by Michael Larabel in RISC-V on 9 November 2022 at 06:47 AM EST. Add A Comment
RISC-V
For those working on RISC-V software development on bare metal hardware, the in-development LLVM Clang 16 compiler has added support for allowing "-mtune=native" and "-mcpu=native" to work properly on this CPU ISA.

As of this week, LLVM/Clang Git now allows -mcpu=native and -mtune=native to be properly supported and used on RISC-V. Thus if wanting to optimize your compiled program for the RISC-V SoC in use on your system, the convenient "native" option will now work with LLVM 16.0 rather than worrying about picking the right mcpu/mtune values.


The support was merged to mainline via this commit.

This RISC-V mtune/mcpu native supprot goes along with LLVM/Clang 16.0 working on more C2x features, more C++20 and C++2b features, Intel AMX-FP16 support, support for other new Intel instructions from PREFETCHI to AVX-NE-CONVERT and AVX-VNNI-INT8, Raptor Lake and Meteor Lake target support, Arm Neoverse V2 tuning, support for new RISC-V extensions, and much more. LLVM 16 will likely debut around March if their usual release cadence holds.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week