1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test
Bob Haarman 99d0b11cd5 [X86] avoid assert with varargs, soft float, and no-implicit-float
Fixes:
 - PR36507 Floating point varargs are not handled correctly with
   -mno-implicit-float
 - PR48528 __builtin_va_start assumes it can pass SSE registers
   when using -Xclang -msoft-float -Xclang -no-implicit-float

On x86_64, floating-point parameters are normally passed in XMM
registers. For va_start, we spill those to memory so va_arg can
find them. There is an interaction here with -msoft-float and
-no-implicit-float:

When -msoft-float is in effect, instead of passing floating-point
parameters in XMM registers, they are passed in general-purpose
registers.

When -no-implicit-float is in effect, it "disables implicit
floating-point instructions" (per the LangRef). The intended
effect is to not have the compiler generate floating-point code
unless explicit floating-point operations are present in the
source code, but what exactly counts as an explicit floating-point
operation is not specified. The existing behavior of LLVM here has
led to some surprises and PRs.

This change modifies the behavior as follows:

  | soft | no-implicit | old behavior    | new behavior    |
  |  no  |   no        | spill XMM regs  | spill XMM regs  |
  | yes  |   no        | don't spill XMM | don't spill XMM |
  |  no  |  yes        | don't spill XMM | spill XMM regs  |
  | yes  |  yes        | assert          | don't spill XMM |

In particular, this avoids the assert that happens when
-msoft-float and -no-implicit-float are both in effect. This
seems like a perfectly reasonable combination: If we don't want
to rely on hardware floating-point support, we want to both
avoid using float registers to pass parameters and avoid having
the compiler generate floating-point code that wasn't in the
original program. Instead of crashing the compiler, the new
behavior is to not synthesize floating-point code in this
case. This fixes PR48528.

The other interesting case is when -no-implicit-float is in
effect, but -msoft-float is not. In that case, any floating-point
parameters that are present will be in XMM registers, and so we
have to spill them to correctly handle those. This fixes
PR36507. The spill is conditional on %al indicating that
parameters are present in XMM registers, so no floating-point
code will be executed unless the function is called with
floating-point parameters.

Reviewed By: rnk

Differential Revision: https://reviews.llvm.org/D104001
2021-06-15 11:27:35 -07:00
..
Analysis [CostModel][AArch64] Improve the cost estimate of CTPOP intrinsic 2021-06-11 11:15:46 +01:00
Assembler Intrinsic::getName: require a Module argument 2021-06-14 14:52:29 +02:00
Bindings
Bitcode
BugPoint
CodeGen [X86] avoid assert with varargs, soft float, and no-implicit-float 2021-06-15 11:27:35 -07:00
DebugInfo [IROutliner] Adding DebugInfo handling for IR Outlined Functions 2021-06-15 10:57:08 -05:00
Demangle
Examples
ExecutionEngine [JITLink][MachO] Add missing testcase. 2021-06-13 20:43:49 +10:00
Feature
FileCheck
Instrumentation [HWASan] Enable globals support for LAM. 2021-06-14 14:20:44 -07:00
Integer
JitListener
Linker [IR] make -warn-frame-size into a module attr 2021-06-10 16:15:27 -07:00
LTO
MachineVerifier
MC [PowerPC] Export 16 byte load-store instructions 2021-06-15 01:56:10 +00:00
Object
ObjectYAML
Other [NewPM] Remove SpeculateAroundPHIs pass 2021-06-15 20:35:55 +03:00
SafepointIRVerifier
Support
SymbolRewriter
TableGen
ThinLTO/X86
tools [MCA][InstrBuilder] Check for the presence of flag VariadicOpsAreDefs. 2021-06-15 09:52:38 +01:00
Transforms [NewPM] Remove SpeculateAroundPHIs pass 2021-06-15 20:35:55 +03:00
Unit
Verifier [VP] Binary floating-point intrinsics. 2021-06-14 08:51:41 +02:00
YAMLParser
.clang-format
CMakeLists.txt Revert "[IRSim] Adding basic implementation of llvm-sim." 2021-06-11 15:44:19 -05:00
lit.cfg.py Revert "[IRSim] Adding basic implementation of llvm-sim." 2021-06-11 15:44:19 -05:00
lit.site.cfg.py.in
TestRunner.sh