[cfe-commits] r63280 - in /cfe/trunk: lib/AST/ExprConstant.cpp test/CodeGen/const-init.c
Daniel Dunbar
daniel at zuster.org
Thu Jan 29 14:25:39 PST 2009
What about them? I followed the existing code for folding == and != of
floats, in the optimistic hope that it was already correct.
Again, if you are aware of specific issues, please file them with test cases.
- Daniel
On Thu, Jan 29, 2009 at 12:20 PM, Neil Booth <neil at daikokuya.co.uk> wrote:
> Daniel Dunbar wrote:-
>
>> + APFloat::cmpResult CR_r =
>> + LHS.getComplexFloatReal().compare(RHS.getComplexFloatReal());
>> + APFloat::cmpResult CR_i =
>> + LHS.getComplexFloatImag().compare(RHS.getComplexFloatImag());
>> +
>> + Result.setIsUnsigned(E->getType()->isUnsignedIntegerType());
>> + if (E->getOpcode() == BinaryOperator::EQ)
>> + Result = (CR_r == APFloat::cmpEqual &&
>> + CR_i == APFloat::cmpEqual);
>> + else if (E->getOpcode() == BinaryOperator::NE)
>> + Result = ((CR_r == APFloat::cmpGreaterThan ||
>> + CR_r == APFloat::cmpLessThan) &&
>> + (CR_i == APFloat::cmpGreaterThan ||
>> + CR_i == APFloat::cmpLessThan));
>> + else
>> + assert(0 && "Invalid complex compartison.");
>> + Result.setIsUnsigned(E->getType()->isUnsignedIntegerType());
>> + return true;
>
> What about NaNs?
>
> Neil.
>
More information about the cfe-commits
mailing list