[llvm-bugs] [Bug 30792] New: [AArch64] -mgeneral-regs-only inconsistent with gcc

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Oct 25 15:28:41 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=30792

            Bug ID: 30792
           Summary: [AArch64] -mgeneral-regs-only inconsistent with gcc
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: pirama at google.com
                CC: arnaud.degrandmaison at arm.com, kristof.beyls at arm.com,
                    llvm-bugs at lists.llvm.org, silviu.baranga at arm.com,
                    srhines at google.com
    Classification: Unclassified

The AArch64 backend runs into a fatal error with the -mgeneral-regs-only when
inline assembly refers to a SIMD register.

A reduced test-case:

$ cat > clobber.c << EOF
void dummy() {
    __asm__ volatile ("" ::: "v0");
}
EOF

$ clang -c clobber.c -target aarch64-linux-gnu -mgeneral-regs-only 
fatal error: error in backend: Do not know how to split the result of this
      operator!

The code is compiled by gcc, though.  Seems like gcc is lenient with respect to
this flag.  From https://gcc.gnu.org/onlinedocs/gcc/AArch64-Options.html:
-mgeneral-regs-only
Generate code which uses only the general-purpose registers. This will prevent
the compiler from using floating-point and Advanced SIMD registers but will not
impose any restrictions on the assembler. 

>From http://clang.llvm.org/docs/UsersManual.html:
-mgeneral-regs-only
Generate code which only uses the general purpose registers.
This option restricts the generated code to use general registers only. This
only applies to the AArch64 architecture.

There are two possible actions here:
1. Match gcc and allow inline assembly to have SIMD registers.  This may be
hard to do, considering that '-mgeneral-regs-only' just passes '-targe
t-feature -fp-armv8 -target-feature -crypto -target-feature -neon' to the
driver.

2. Make the driver not crash, and issue an error instead.

This usage seems prevalent in the kernel, which uses -mgeneral-regs-only to
avoid saving and restoring the userspace FPSIMD context on every syscall, but
hard-codes FPSIMD or crypto instructions in the handful of places they're
useful.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20161025/bc624dc5/attachment.html>


More information about the llvm-bugs mailing list