Hi, LLVM made a change a few months ago and starting erroring out when a float is returned in x64 and SSE is disabled. This makes sense, really, since it's specified by the ABI that the return value must be put in a register you were told to disable, but it's breaking soft floats in Rust on x64. It seems there are two options: LLVM could break the ABI spec and have working soft floats on 64bit or Rust could offer a configuration option to remove float support from its "libcore" (the freestanding stdlib). What do you guys think about fixing it on your end? Relevant links: Clang error w/ same message: https://llvm.org/bugs/show_bug.cgi?id=23203 Report of rust bug: https://github.com/rust-lang/rust/issues/26449 Discussion on why Rust doesn't want to fix (a refused patch to libcore): https://github.com/rust-lang/rust/pull/26749 The error is coming from one of these files: lib/Target/X86/X86FastISel.cpp:3166: report_fatal_error("SSE register return with SSE disabled"); lib/Target/X86/X86ISelLowering.cpp:2107: report_fatal_error("SSE register return with SSE disabled"); lib/Target/X86/X86ISelLowering.cpp:2261: report_fatal_error("SSE register return with SSE disabled"); test/CodeGen/X86/nosse-error2.ll:4:; NOSSE: {{SSE register return with SSE disabled}} test/CodeGen/X86/nosse-error1.ll:4:; NOSSE: {{SSE register return with SSE disabled}} Thanks for your time, Tyler Hardin -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150822/a70dc3e4/attachment.html>
Looks like an attribute mixup in Clang. I can convince LLVM to generate soft float code if I hack up the attributes with sed like so: $ echo 'float f(float a, float b) { return a + b; }' | clang -x c++ - --target=x86_64-linux -mno-sse -msoft-float -emit-llvm -S -o - | sed -e 's/use-soft-float"="false"/use-soft-float"="true"/' | sed -e 's/noimplicitflo at//' | llc ... subq $16, %rsp movl %edi, -4(%rbp) movl %esi, -8(%rbp) movl -4(%rbp), %edi callq __addsf3 addq $16, %rsp popq %rbp retq On Sat, Aug 22, 2015 at 4:43 PM, Tyler Hardin via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi, > > LLVM made a change a few months ago and starting erroring out when a float > is returned in x64 and SSE is disabled. This makes sense, really, since > it's specified by the ABI that the return value must be put in a register > you were told to disable, but it's breaking soft floats in Rust on x64. It > seems there are two options: LLVM could break the ABI spec and have working > soft floats on 64bit or Rust could offer a configuration option to remove > float support from its "libcore" (the freestanding stdlib). > > What do you guys think about fixing it on your end? > > Relevant links: > Clang error w/ same message: https://llvm.org/bugs/show_bug.cgi?id=23203 > Report of rust bug: https://github.com/rust-lang/rust/issues/26449 > Discussion on why Rust doesn't want to fix (a refused patch to libcore): > https://github.com/rust-lang/rust/pull/26749 > > The error is coming from one of these files: > lib/Target/X86/X86FastISel.cpp:3166: report_fatal_error("SSE register > return with SSE disabled"); > lib/Target/X86/X86ISelLowering.cpp:2107: report_fatal_error("SSE > register return with SSE disabled"); > lib/Target/X86/X86ISelLowering.cpp:2261: report_fatal_error("SSE > register return with SSE disabled"); > test/CodeGen/X86/nosse-error2.ll:4:; NOSSE: {{SSE register return with SSE > disabled}} > test/CodeGen/X86/nosse-error1.ll:4:; NOSSE: {{SSE register return with SSE > disabled}} > > Thanks for your time, > Tyler Hardin > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150826/d6585435/attachment.html>
Hmm. I did the same thing with Rust. If I pass the LLVM IR to llc myself, it works fine. I had taken this as a sign that it was a bug in Rust, but it seems like I'm back to having no clue at all. If you're interested, you can read most of the debugging I've done at the bottom of this discussion: https://github.com/rust-lang/rust/pull/26749. On Aug 26, 2015 6:48 PM, "Reid Kleckner" <rnk at google.com> wrote:> Looks like an attribute mixup in Clang. I can convince LLVM to generate > soft float code if I hack up the attributes with sed like so: > > $ echo 'float f(float a, float b) { return a + b; }' | clang -x c++ - > --target=x86_64-linux -mno-sse -msoft-float -emit-llvm -S -o - | sed -e > 's/use-soft-float"="false"/use-soft-float"="true"/' | sed -e > 's/noimplicitflo at//' | llc > ... > subq $16, %rsp > movl %edi, -4(%rbp) > movl %esi, -8(%rbp) > movl -4(%rbp), %edi > callq __addsf3 > addq $16, %rsp > popq %rbp > retq > > On Sat, Aug 22, 2015 at 4:43 PM, Tyler Hardin via llvm-dev < > llvm-dev at lists.llvm.org> wrote: > >> Hi, >> >> LLVM made a change a few months ago and starting erroring out when a >> float is returned in x64 and SSE is disabled. This makes sense, really, >> since it's specified by the ABI that the return value must be put in a >> register you were told to disable, but it's breaking soft floats in Rust on >> x64. It seems there are two options: LLVM could break the ABI spec and have >> working soft floats on 64bit or Rust could offer a configuration option to >> remove float support from its "libcore" (the freestanding stdlib). >> >> What do you guys think about fixing it on your end? >> >> Relevant links: >> Clang error w/ same message: https://llvm.org/bugs/show_bug.cgi?id=23203 >> Report of rust bug: https://github.com/rust-lang/rust/issues/26449 >> Discussion on why Rust doesn't want to fix (a refused patch to libcore): >> https://github.com/rust-lang/rust/pull/26749 >> >> The error is coming from one of these files: >> lib/Target/X86/X86FastISel.cpp:3166: report_fatal_error("SSE >> register return with SSE disabled"); >> lib/Target/X86/X86ISelLowering.cpp:2107: report_fatal_error("SSE >> register return with SSE disabled"); >> lib/Target/X86/X86ISelLowering.cpp:2261: report_fatal_error("SSE >> register return with SSE disabled"); >> test/CodeGen/X86/nosse-error2.ll:4:; NOSSE: {{SSE register return with >> SSE disabled}} >> test/CodeGen/X86/nosse-error1.ll:4:; NOSSE: {{SSE register return with >> SSE disabled}} >> >> Thanks for your time, >> Tyler Hardin >> >> _______________________________________________ >> LLVM Developers mailing list >> llvm-dev at lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >> >> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150826/49eba86f/attachment.html>