http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56863
Bug #: 56863 Summary: cmpnltpd recognition Classification: Unclassified Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: gli...@gcc.gnu.org Target: x86_64-linux-gnu Hello, I was looking at this program, trying to get it to generate cmpnltpd: #include <x86intrin.h> __m128d f(__m128d a, __m128d b){ return (__m128d)(~(a<b)); } but it doesn't: cmpltpd %xmm1, %xmm0 pcmpeqd %xmm1, %xmm1 pxor %xmm0, %xmm1 movapd %xmm1, %xmm0 One reason seems to be that the instruction is modeled as (unge a b), whereas from a trapping point of view I think it should be (not (lt a b)). But even -ffast-math does not help. As a side note, notice that: return (__m128d)((a<b)?0:(__m128i){-1,-1}); uses pandn instead of pxor to generate the negation. I don't think one is better than the other, I was just surprised to see the difference.