Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang should support -march=armv7ve for gcc compatibility #30331

Closed Quuxplusone closed 7 years ago

Quuxplusone commented 7 years ago
Bugzilla Link PR31358
Status RESOLVED FIXED
Importance P normal
Reported by Manoj Gupta (manojgupta@google.com)
Reported on 2016-12-12 18:19:27 -0800
Last modified on 2017-02-10 14:43:07 -0800
Version trunk
Hardware PC Linux
CC llozano@chromium.org, llvm-bugs@lists.llvm.org, manojgupta@google.com, yunlian@google.com
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
gcc supports -march=armv7ve option for arm but this is not supported by clang.

Armv7ve description:
armv7ve add supports for ARMv7 virtualization extension, including instructions
such as integer divide instructions.

This makes build scripts  difficult to port to clang from gcc.

Example:

$ cat foo.c
int divide(int b, int c) {
    return b/c;
}

$ gcc  -march=armv7ve  -c foo.c # This works as expected

Compiling with clang fails.

$ clang -march=armv7ve -c foo.cc
clang-4.0: error: the clang compiler does not support '-march=armv7ve'
Quuxplusone commented 7 years ago
A simple patch to add armv7ve support:

--- old/include/llvm/Support/ARMTargetParser.def    2016-12-12 16:09:24.638431474 -
0800
+++ new/include/llvm/Support/ARMTargetParser.def    2016-12-12 16:08:43.930483492 -
0800
@@ -82,6 +82,8 @@
           FK_NONE, ARM::AEK_HWDIV)
 ARM_ARCH("armv7e-m", AK_ARMV7EM, "7E-M", "v7em", ARMBuildAttrs::CPUArch::v7E_M,
           FK_NONE, (ARM::AEK_HWDIV | ARM::AEK_DSP))
+ARM_ARCH("armv7ve", AK_ARMV7VE, "7-A", "v7", ARMBuildAttrs::CPUArch::v7,
+          FK_NEON, (ARM::AEK_DSP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM))
 ARM_ARCH("armv8-a", AK_ARMV8A, "8-A", "v8", ARMBuildAttrs::CPUArch::v8_A,
          FK_CRYPTO_NEON_FP_ARMV8,
          (ARM::AEK_SEC | ARM::AEK_MP | ARM::AEK_VIRT | ARM::AEK_HWDIVARM |
Quuxplusone commented 7 years ago
Done in r294661 + r294662.

llvm change: https://reviews.llvm.org/D29472
clang change: https://reviews.llvm.org/D29773