[llvm-commits] [llvm] r77407 - in /llvm/trunk: include/llvm/IntrinsicsX86.td lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrSSE.td test/CodeGen/X86/sse41.ll

Evan Cheng evan.cheng at apple.com
Tue Jul 28 22:44:09 PDT 2009


On Jul 28, 2009, at 10:29 PM, Chris Lattner wrote:

>
> On Jul 28, 2009, at 10:10 PM, Eli Friedman wrote:
>
>> On Tue, Jul 28, 2009 at 9:44 PM, Chris Lattner<clattner at apple.com>
>> wrote:
>>> From my understanding, I think that ptest is commutative (but maybe
>>> only for "z", but not the others?).  If unconditionally true, you  
>>> can
>>> declare this with [SDNPCommutative] as a third argument to SDNode  
>>> and
>>> the instruction should be figured out to be commutative.  If only
>>> true
>>> in some cases, more trickery will be required.
>>
>> For PTEST, the ZF flag is commutative, but the CF flag is not.
>
> Ok, that's what I feared.  This means that we need conditional flag
> liveness stuff?  Is there a way to know (e.g. in regalloc, when doing
> a spill) that only one flag is used?  Do we have flag subregs?

Not yet.

If we care about this, the solution is to lower ptestz and ptestc,  
ptestnzc to different x86isd nodes.

Evan

>
> Perhaps this should just go in the readme-sse.txt file to worry about
> later.
>
> -Chris
>
>>
>>
>>> It should allow the instruction to fold the load instead of
>>> producing:
>>>
>>> _test:
>>>       movl    4(%esp), %eax
>>>       movaps  (%eax), %xmm1
>>>       ptest   %xmm0, %xmm1
>>>       sete    %al
>>>       movzbl  %al, %eax
>>>       ret
>>>
>>> Does "ptest" need to be added to the load folding table in case it  
>>> is
>>> isel'd as reg/reg but an operand gets spilled (thus the regalloc
>>> should fold the load by forming reg/mem)?
>>
>> I think the issue here is that it doesn't know it's safe to commute
>> the ptest...
>>
>> -Eli
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list