[llvm-bugs] [Bug 43334] New: unexpected failure for -mno-sse2
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Sep 16 15:14:59 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=43334
Bug ID: 43334
Summary: unexpected failure for -mno-sse2
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: X86
Assignee: unassignedbugs at nondot.org
Reporter: ndesaulniers at google.com
CC: craig.topper at gmail.com, llvm-bugs at lists.llvm.org,
llvm-dev at redking.me.uk, spatel+llvm at rotateright.com,
srhines at google.com
Blocks: 4068
Consider:
$ cat foo.c
// double __floatunsidf (unsigned int i)
double foo(unsigned int i) {
return (double) i;
}
$ clang -O2 -mno-sse2 foo.c
error: SSE2 register return with SSE2 disabled
return (double) i;
^
$ gcc -O2 -mno-sse2 foo.c && llvm-objdump -d foo.o
foo:
movl %edi, %edi
movq %rdi, -8(%rsp)
fildq -8(%rsp)
fstpl -8(%rsp)
movlps -8(%rsp), %xmm0
ret
Adding -mno-80387 to clang seems to then complicate things further: clang
generates:
foo: # @foo
pushq %rax
callq __floatunsidf
popq %rcx
retq
This is important because:
1. the kernel builds with -mno-see2 -mno-80387 (and a few other related but
less relevant flags:
https://github.com/ClangBuiltLinux/linux/blob/52a5525214d0d612160154d902956eca0558b7c0/arch/x86/Makefile#L61-L62)
since saving/restoring fp register state gets complicated/expensive for all
registers added via ISA extensions).
2. the kernel does not define soft float routines like __floatunsidf.
-mhard-float and -ffreestanding don't prevent clang from generating references
to these soft float routines.
Referenced Bugs:
https://bugs.llvm.org/show_bug.cgi?id=4068
[Bug 4068] [Meta] Compiling the Linux kernel with clang
--
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/20190916/0ac00b95/attachment.html>
More information about the llvm-bugs
mailing list