[llvm-commits] [llvm-gcc] SETCC Removal Patch (Please Commit)

Rafael EspĂ­ndola rafael.espindola at gmail.com
Sat Dec 30 05:38:59 PST 2006


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



More information about the llvm-commits mailing list