mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 21:29:41 +00:00
Reapply r81171 with a fix: don't try to use i64 when it
isn't legal. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@81492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c24edfaee2
commit
5e5abb77fe
@ -615,12 +615,27 @@ FastISel::SelectFNeg(User *I) {
|
|||||||
unsigned OpReg = getRegForValue(BinaryOperator::getFNegArgument(I));
|
unsigned OpReg = getRegForValue(BinaryOperator::getFNegArgument(I));
|
||||||
if (OpReg == 0) return false;
|
if (OpReg == 0) return false;
|
||||||
|
|
||||||
// Twiddle the sign bit with xor.
|
// Bitcast the value to integer, twiddle the sign bit with xor,
|
||||||
|
// and then bitcast it back to floating-point.
|
||||||
EVT VT = TLI.getValueType(I->getType());
|
EVT VT = TLI.getValueType(I->getType());
|
||||||
if (VT.getSizeInBits() > 64) return false;
|
if (VT.getSizeInBits() > 64) return false;
|
||||||
unsigned ResultReg = FastEmit_ri_(VT.getSimpleVT(), ISD::XOR, OpReg,
|
EVT IntVT = EVT::getIntegerVT(I->getContext(), VT.getSizeInBits());
|
||||||
UINT64_C(1) << (VT.getSizeInBits()-1),
|
if (!TLI.isTypeLegal(IntVT))
|
||||||
VT.getSimpleVT());
|
return false;
|
||||||
|
|
||||||
|
unsigned IntReg = FastEmit_r(VT.getSimpleVT(), IntVT.getSimpleVT(),
|
||||||
|
ISD::BIT_CONVERT, OpReg);
|
||||||
|
if (IntReg == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
unsigned IntResultReg = FastEmit_ri_(IntVT.getSimpleVT(), ISD::XOR, IntReg,
|
||||||
|
UINT64_C(1) << (VT.getSizeInBits()-1),
|
||||||
|
IntVT.getSimpleVT());
|
||||||
|
if (IntResultReg == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ResultReg = FastEmit_r(IntVT.getSimpleVT(), VT.getSimpleVT(),
|
||||||
|
ISD::BIT_CONVERT, IntResultReg);
|
||||||
if (ResultReg == 0)
|
if (ResultReg == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
; RUN: llc < %s -fast-isel -march=x86-64 | FileCheck %s
|
; RUN: llc < %s -fast-isel -fast-isel-abort -march=x86-64 | FileCheck %s
|
||||||
|
; RUN: llc < %s -fast-isel -march=x86 | grep xor | count 2
|
||||||
|
|
||||||
; CHECK: doo:
|
; CHECK: doo:
|
||||||
; CHECK: xorpd
|
; CHECK: xor
|
||||||
define double @doo(double %x) nounwind {
|
define double @doo(double %x) nounwind {
|
||||||
%y = fsub double -0.0, %x
|
%y = fsub double -0.0, %x
|
||||||
ret double %y
|
ret double %y
|
||||||
}
|
}
|
||||||
|
|
||||||
; CHECK: foo:
|
; CHECK: foo:
|
||||||
; CHECK: xorps
|
; CHECK: xor
|
||||||
define float @foo(float %x) nounwind {
|
define float @foo(float %x) nounwind {
|
||||||
%y = fsub float -0.0, %x
|
%y = fsub float -0.0, %x
|
||||||
ret float %y
|
ret float %y
|
||||||
|
Loading…
x
Reference in New Issue
Block a user