Noticed while investigating SIGN patterns:
define i16 @cmp_sle_1(<16 x i8> %x) {
%c = icmp sle <16 x i8> %x, splat (i8 0)
%x = bitcast <16 x i1> %c to i16
ret i16 %x
}
Both InstCombine and DAG fold this to:
define i16 @cmp_sle_1(<16 x i8> %x) {
%c = icmp slt <16 x i8> %x, splat (i8 1)
%x = bitcast <16 x i1> %c to i16
ret i16 %x
}
-mcpu=x86-64-v3 - no ICMP_SLE handling so uses NOT(ICMP_SGT)
cmp_sle_1: # @cmp_sle_1
# %bb.0:
vpxor %xmm0, %xmm0, %xmm0
vpcmpgtb %xmm0, %xmm1, %xmm0
vpmovmskb %xmm0, %eax
notl %eax
# kill: def $ax killed $ax killed $eax
retq
# -- End function
-mcpu=x86-64-v4 - VPCMP can use all condcodes, but chooses to load a constant:
.LCPI0_0:
.zero 16,1
cmp_sle_1: # @cmp_sle_1
# %bb.0:
vpcmpltb .LCPI0_0(%rip), %xmm1, %k0
kmovd %k0, %eax
# kill: def $ax killed $ax killed $eax
retq
# -- End function
Noticed while investigating SIGN patterns:
Both InstCombine and DAG fold this to:
-mcpu=x86-64-v3 - no ICMP_SLE handling so uses NOT(ICMP_SGT)
-mcpu=x86-64-v4 - VPCMP can use all condcodes, but chooses to load a constant: