[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
Eli Friedman
eli.friedman at gmail.com
Tue Jul 28 22:10:47 PDT 2009
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.
> 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
More information about the llvm-commits
mailing list