Suprateeka R Hegde via llvm-dev
2016-Aug-29 13:17 UTC
[llvm-dev] Inconsistency in -march option between llc and clang
Hi On AArch64 (ARM 64-Bit Platform), I see there is an inconsistency in the values accepted by -march option between clang and llc. --- $ llc -march=aarch64 -mattr=help 2>&1 | grep error $ #No Error $ llc -march=armv8a -mattr=help 2>&1 | grep error llc: error: invalid target 'armv8a'. $ clang -march=armv8a -E - < /dev/null 2>&1 | grep error $ #No Error $ clang -march=aarch64 -E - < /dev/null 2>&1 | grep error clang-4.0: error: the clang compiler does not support '-march=aarch64' --- llc accepts aarch64 (rejects armv8a) while clang accepts armv8a (rejects aarch64). Shall I file this as bug (and assign it to myself)? Or am I missing something obvious? Thanks a lot -- Supra
Tim Northover via llvm-dev
2016-Aug-29 15:05 UTC
[llvm-dev] Inconsistency in -march option between llc and clang
On 29 August 2016 at 06:17, Suprateeka R Hegde via llvm-dev <llvm-dev at lists.llvm.org> wrote:> On AArch64 (ARM 64-Bit Platform), I see there is an inconsistency in the > values accepted by -march option between clang and llc.This is because Clang has a triple which provides the primary context for interpreting -march. armv8a is a valid -march in both AArch32 and AArch64 modes. llc, on the other hand, uses -march as an abbreviated way to choose the primary triple. It accepts a more limited set of options (arm, thumb, arm64 or aarch64). It's not supposed to be a user-facing tool though, so as long as there's a way to get the configuration you want giving it a sophisticated interface isn't a priority (and arguably not even desirable). For llc, you probably want to use things like "-mattr=+v8.1a" to specify architecture revisions (v8a is the default, since it's the first 64-bit ARM version). And use either a full triple like "-mtriple=aarch64-linux-gnu", or "-march=aarch64" if you don't care what OS gets targeted (be careful there: tests vary subtly between iOS and Linux and can break depending on the host machine if you're not careful). Cheers. Tim.
Suprateeka R Hegde via llvm-dev
2016-Aug-29 16:20 UTC
[llvm-dev] Inconsistency in -march option between llc and clang
I am OK with this explanation -- not to polish the user-interface of llc as it is not supposed to be a user-facing tool. But this needs to be documented well. Package developers need to very well understand this, Today I see that llc is used quite a lot of places specially in system software development. For instance, POCL (Portable OpenCL) uses clang and llc both. But tries to use the same value for -march and fails. -- Supra On 29-Aug-2016 08:35 PM, Tim Northover wrote:> On 29 August 2016 at 06:17, Suprateeka R Hegde via llvm-dev > <llvm-dev at lists.llvm.org> wrote: >> On AArch64 (ARM 64-Bit Platform), I see there is an inconsistency in the >> values accepted by -march option between clang and llc. > > This is because Clang has a triple which provides the primary context > for interpreting -march. armv8a is a valid -march in both AArch32 and > AArch64 modes. > > llc, on the other hand, uses -march as an abbreviated way to choose > the primary triple. It accepts a more limited set of options (arm, > thumb, arm64 or aarch64). It's not supposed to be a user-facing tool > though, so as long as there's a way to get the configuration you want > giving it a sophisticated interface isn't a priority (and arguably not > even desirable). > > For llc, you probably want to use things like "-mattr=+v8.1a" to > specify architecture revisions (v8a is the default, since it's the > first 64-bit ARM version). And use either a full triple like > "-mtriple=aarch64-linux-gnu", or "-march=aarch64" if you don't care > what OS gets targeted (be careful there: tests vary subtly between iOS > and Linux and can break depending on the host machine if you're not > careful). > > Cheers. > > Tim. >
Seemingly Similar Threads
- LLVM issuse:AArch64 TargetParser
- LLVM issuse:AArch64 TargetParser
- Reducing code size of Position Independent Executables (PIE) by shrinking the size of dynamic relocations section
- LLVM issuse:AArch64 TargetParser
- [RFC] Making -mcpu=generic the default for ARM armv7a and arm8a rather than -mcpu=cortex-a8 or -mcpu=cortex-a53