By far, one of the most common uses of isnan is to make 'isunordered'
authorChris Lattner <sabre@nondot.org>
Fri, 11 Jun 2004 05:33:49 +0000 (05:33 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 11 Jun 2004 05:33:49 +0000 (05:33 +0000)
commit01cdb1b3670ee5dfacbf344182d8c79c09844393
tree0f86add385f59a38bdcc873bc770987e2dacddb4
parentc31ae50c04ca42f447c649c6a528e20ab3ea791f
By far, one of the most common uses of isnan is to make 'isunordered'
comparisons.  In an 'isunordered' predicate, which looks like this at
the LLVM level:

        %a = call bool %llvm.isnan(double %X)
        %b = call bool %llvm.isnan(double %Y)
        %COM = or bool %a, %b

We used to generate this code:

        fxch %ST(1)
        fucomip %ST(0), %ST(0)
        setp %AL
        fucomip %ST(0), %ST(0)
        setp %AH
        or %AL, %AH

With this patch, we generate this code:

        fucomip %ST(0), %ST(1)
        fstp %ST(0)
        setp %AL

Which should make alkis happy.  Tested as X86/compare_folding.llx:test1

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14148 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/InstSelectSimple.cpp
lib/Target/X86/X86ISelSimple.cpp