I don't have a normative document at hand, but I believe that in C !=
should return true if one of the operands is unordered. Currently,
llvm-gcc produces a "fcmp one".

I have patched llvm-conver.cpp:TreeToLLVM::Emit to emit a "fcmp une"
in the NE_EXPR case. The  generated code now is:

%tmp = fcmp une float %a, %b
%tmp2 = tail call bool %llvm.isunordered.f32( float %a, float %b )
%tmp3 = or bool %tmp2, %tmp

Correct, but redundant. The call to llvm.isunordered is added by
TreeToLLVM::EmitCompare. Simply removing the "if" produces the correct
code. It looks like the call to isunordered is a leftover of the old
compare instruction.

An updated patch is attached.

Comments?

Best Regards,
Rafael
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to