-
Notifications
You must be signed in to change notification settings - Fork 14.9k
Open
Labels
good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:SelectionDAGSelectionDAGISel as wellSelectionDAGISel as wellmissed-optimization
Description
Similar to what we did in #163981 for X86ISD::PCMPGT - when we are testing for a negative value, then we only need to demand the signbit
define <4 x i32> @select(<4 x i32> %x, <4 x i32> %y, <4 x i32> %a, <4 x i32> %b) {
%umax = tail call <4 x i32> @llvm.umax.v4i32(<4 x i32> %x, <4 x i32> %y)
%cmp = icmp slt <4 x i32> %umax, zeroinitializer
%res = select <4 x i1> %cmp, <4 x i32> %a, <4 x i32> %b
ret <4 x i32> %res
}
llvm -mcpu=x86-64-v4
select: # @select
vpmaxud %xmm1, %xmm0, %xmm0
vpmovd2m %xmm0, %k1
vpblendmd %xmm2, %xmm3, %xmm0 {%k1}
retq
the VPMAXUD is unnecessary - could be:
select: # @select
vpor %xmm1, %xmm0, %xmm0
vpmovd2m %xmm0, %k1
vpblendmd %xmm2, %xmm3, %xmm0 {%k1}
retq
We already have the ISD::UMAX -> ISD::OR simplification in place but we don't recursively call SimplifyDemandedBits from the ISD::SETCC node
Metadata
Metadata
Assignees
Labels
good first issuehttps://github.com/llvm/llvm-project/contributehttps://github.com/llvm/llvm-project/contributellvm:SelectionDAGSelectionDAGISel as wellSelectionDAGISel as wellmissed-optimization