mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-09 13:33:17 +00:00
Avoid excess precision issues that lead to generating host-compiler-specific code.
Switch lowering probably shouldn't be using FP for this. This resolves PR9581. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129199 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9055ccdb6b
commit
c3e4e59d10
@ -2019,9 +2019,13 @@ bool SelectionDAGBuilder::handleBTSplitSwitchCase(CaseRec& CR,
|
||||
APInt Range = ComputeRange(LEnd, RBegin);
|
||||
assert((Range - 2ULL).isNonNegative() &&
|
||||
"Invalid case distance");
|
||||
double LDensity = (double)LSize.roundToDouble() /
|
||||
// Use volatile double here to avoid excess precision issues on some hosts,
|
||||
// e.g. that use 80-bit X87 registers.
|
||||
volatile double LDensity =
|
||||
(double)LSize.roundToDouble() /
|
||||
(LEnd - First + 1ULL).roundToDouble();
|
||||
double RDensity = (double)RSize.roundToDouble() /
|
||||
volatile double RDensity =
|
||||
(double)RSize.roundToDouble() /
|
||||
(Last - RBegin + 1ULL).roundToDouble();
|
||||
double Metric = Range.logBase2()*(LDensity+RDensity);
|
||||
// Should always split in some non-trivial place
|
||||
|
Loading…
x
Reference in New Issue
Block a user