diff options
| author | Dan Gohman <gohman@apple.com> | 2009-09-11 00:36:43 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-09-11 00:36:43 +0000 |
| commit | 9cbef32726b8cd392e600594cd75f9b99fa60635 (patch) | |
| tree | 213fb39b9dd04ba071fc72951167241660ad6fc7 /llvm/lib/CodeGen | |
| parent | 89b090e51edfa2bd595a992a73c4faf429f45265 (diff) | |
| download | bcm5719-llvm-9cbef32726b8cd392e600594cd75f9b99fa60635.tar.gz bcm5719-llvm-9cbef32726b8cd392e600594cd75f9b99fa60635.zip | |
Make fast-isel try ISD::FNEG before resorting to bitcasts and xors.
llvm-svn: 81493
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 15c2140b86c..54544a4d149 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -615,9 +615,17 @@ FastISel::SelectFNeg(User *I) { unsigned OpReg = getRegForValue(BinaryOperator::getFNegArgument(I)); if (OpReg == 0) return false; + // If the target has ISD::FNEG, use it. + EVT VT = TLI.getValueType(I->getType()); + unsigned ResultReg = FastEmit_r(VT.getSimpleVT(), VT.getSimpleVT(), + ISD::FNEG, OpReg); + if (ResultReg != 0) { + UpdateValueMap(I, ResultReg); + return true; + } + // 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()); if (VT.getSizeInBits() > 64) return false; EVT IntVT = EVT::getIntegerVT(I->getContext(), VT.getSizeInBits()); if (!TLI.isTypeLegal(IntVT)) |

