static BinaryOperator *CreateNot(Value *Op, const Twine &Name,
BasicBlock *InsertAtEnd);
- /// Check if the given Value is an FNeg instruction.
- static bool isFNeg(const Value *V, bool IgnoreZeroSign=false);
-
- /// Helper functions to extract the unary argument of an FNeg.
- static const Value *getFNegArgument(const Value *BinOp);
- static Value *getFNegArgument( Value *BinOp);
-
BinaryOps getOpcode() const {
return static_cast<BinaryOps>(Instruction::getOpcode());
}
Op->getType(), Name, InsertAtEnd);
}
-bool BinaryOperator::isFNeg(const Value *V, bool IgnoreZeroSign) {
- if (const BinaryOperator *Bop = dyn_cast<BinaryOperator>(V))
- if (Bop->getOpcode() == Instruction::FSub)
- if (Constant *C = dyn_cast<Constant>(Bop->getOperand(0))) {
- if (!IgnoreZeroSign)
- IgnoreZeroSign = cast<Instruction>(V)->hasNoSignedZeros();
- return !IgnoreZeroSign ? C->isNegativeZeroValue() : C->isZeroValue();
- }
- return false;
-}
-
-Value *BinaryOperator::getFNegArgument(Value *BinOp) {
- return cast<BinaryOperator>(BinOp)->getOperand(1);
-}
-
-const Value *BinaryOperator::getFNegArgument(const Value *BinOp) {
- return getFNegArgument(const_cast<Value*>(BinOp));
-}
-
// Exchange the two operands to this instruction. This instruction is safe to
// use on any binary instruction and does not modify the semantics of the
// instruction. If the instruction is order-dependent (SetLT f.e.), the opcode