[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

Eric Christopher echristo at apple.com
Tue Jul 28 19:04:25 PDT 2009


On Jul 28, 2009, at 6:57 PM, Evan Cheng wrote:

> Is there a way to make use of ptest for non-intrinsic form of
> comparison of two SSE values?

Qualified yes. I'm trying to figure out how to make this work for  
things like an & of two SSE values or the other two, just not sure how  
to do it yet.

Another quick optimization that Dan suggested was trying to optimize  
code that looks like this:

#include <smmintrin.h>

int foo (__m128i a, __m128i b)
{
    if (_mm_testz_si128(a, b) != 0) return 4;

    return 8;
}

where we should be able to get rid of the extra (bonus!) setcc that  
we've got in the generated code (cruft removed):

_foo:
	ptest 	%xmm1, %xmm0
	sete	%al
	movzbl	%al, %eax
	testl	%eax, %eax
	sete	%al
	movzbl	%al, %eax
	leal	4(,%eax,4), %eax
	ret

Honestly it's the movzbl instructions that irritate me the most, but  
there's no setcc that will set an entire register :(

-eric



More information about the llvm-commits mailing list