mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-15 07:34:33 +00:00
Generate ftst instructions for comparison against zero
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11098 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
acc00bc609
commit
9f08a92e6c
@ -702,6 +702,15 @@ unsigned ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1,
|
||||
return OpNum;
|
||||
}
|
||||
|
||||
// Special case handling of comparison against +/- 0.0
|
||||
if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op1))
|
||||
if (CFP->isExactlyValue(+0.0) || CFP->isExactlyValue(-0.0)) {
|
||||
BMI(MBB, IP, X86::FTST, 1).addReg(Op0r);
|
||||
BMI(MBB, IP, X86::FNSTSWr8, 0);
|
||||
BMI(MBB, IP, X86::SAHF, 1);
|
||||
return OpNum;
|
||||
}
|
||||
|
||||
unsigned Op1r = getReg(Op1, MBB, IP);
|
||||
switch (Class) {
|
||||
default: assert(0 && "Unknown type class!");
|
||||
|
@ -702,6 +702,15 @@ unsigned ISel::EmitComparison(unsigned OpNum, Value *Op0, Value *Op1,
|
||||
return OpNum;
|
||||
}
|
||||
|
||||
// Special case handling of comparison against +/- 0.0
|
||||
if (ConstantFP *CFP = dyn_cast<ConstantFP>(Op1))
|
||||
if (CFP->isExactlyValue(+0.0) || CFP->isExactlyValue(-0.0)) {
|
||||
BMI(MBB, IP, X86::FTST, 1).addReg(Op0r);
|
||||
BMI(MBB, IP, X86::FNSTSWr8, 0);
|
||||
BMI(MBB, IP, X86::SAHF, 1);
|
||||
return OpNum;
|
||||
}
|
||||
|
||||
unsigned Op1r = getReg(Op1, MBB, IP);
|
||||
switch (Class) {
|
||||
default: assert(0 && "Unknown type class!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user