[llvm] r211077 - [FastISel][X86] Refactor the code to get the X86 condition from a helper function. NFC.

Stephan Bergmann sbergman at redhat.com
Tue Jun 17 03:59:51 PDT 2014


On 06/17/2014 01:58 AM, Juergen Ributzka wrote:
> Author: ributzka
> Date: Mon Jun 16 18:58:24 2014
> New Revision: 211077
>
> URL: http://llvm.org/viewvc/llvm-project?rev=211077&view=rev
> Log:
> [FastISel][X86] Refactor the code to get the X86 condition from a helper function. NFC.
>
> Make use of helper functions to simplify the branch and compare instruction
> selection in FastISel. Also add test cases for compare and conditonal branch.
>
> Added:
>      llvm/trunk/test/CodeGen/X86/fast-isel-cmp-branch2.ll
>      llvm/trunk/test/CodeGen/X86/fast-isel-cmp.ll
> Modified:
>      llvm/trunk/lib/Target/X86/X86FastISel.cpp
>      llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
>      llvm/trunk/lib/Target/X86/X86InstrInfo.h

Looks like that change broke __builtin_isfinite, at least on X86_64:

> $ cat test.cc
> #include <iostream>
> bool fin(double d) { return __builtin_isfinite(d); }
> int main() { std::cout << fin(1.0) << '\n'; }
>
> $ clang++ test.cc
> $ ./a.out
> 0

What changed is the code generated for

>     Value *IsNotInf =
>       Builder.CreateFCmpUNE(Abs, ConstantFP::getInfinity(V->getType()),"isinf");

(case Builtin::BI__builtin_isfinite in CodeGenFunction::EmitBuiltinExpr, 
tools/clang/lib/CodeGen/CGBuiltin.cpp), from

> 	movsd	-16(%rbp), %xmm1        # 8-byte Reload
> 	ucomisd	%xmm1, %xmm0
> 	setne	%al
> 	setp	%cl
> 	orb	%al, %cl

to

> 	movsd	-16(%rbp), %xmm1        # 8-byte Reload
> 	ucomisd	%xmm1, %xmm0
> 	setne	%al
> 	setp	%cl
> 	andb	%cl, %al

Stephan



More information about the llvm-commits mailing list