[llvm] r199798 - AVX512: combining setcc and zext is wrong on AVX512
Elena Demikhovsky
elena.demikhovsky at intel.com
Wed Jan 22 04:26:20 PST 2014
Author: delena
Date: Wed Jan 22 06:26:19 2014
New Revision: 199798
URL: http://llvm.org/viewvc/llvm-project?rev=199798&view=rev
Log:
AVX512: combining setcc and zext is wrong on AVX512
because vector compare instruction puts result in mask register.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/trunk/test/CodeGen/X86/avx512-vec-cmp.ll
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=199798&r1=199797&r2=199798&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Jan 22 06:26:19 2014
@@ -5082,9 +5082,12 @@ SDValue DAGCombiner::visitZERO_EXTEND(SD
if (N0.getOpcode() == ISD::SETCC) {
if (!LegalOperations && VT.isVector() &&
N0.getValueType().getVectorElementType() == MVT::i1) {
+ EVT N0VT = N0.getOperand(0).getValueType();
+ if (getSetCCResultType(N0VT) == N0.getValueType())
+ return SDValue();
+
// zext(setcc) -> (and (vsetcc), (1, 1, ...) for vectors.
// Only do this before legalize for now.
- EVT N0VT = N0.getOperand(0).getValueType();
EVT EltVT = VT.getVectorElementType();
SmallVector<SDValue,8> OneOps(VT.getVectorNumElements(),
DAG.getConstant(1, EltVT));
Modified: llvm/trunk/test/CodeGen/X86/avx512-vec-cmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/avx512-vec-cmp.ll?rev=199798&r1=199797&r2=199798&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/avx512-vec-cmp.ll (original)
+++ llvm/trunk/test/CodeGen/X86/avx512-vec-cmp.ll Wed Jan 22 06:26:19 2014
@@ -122,3 +122,14 @@ define i16 @test12(<16 x i64> %a, <16 x
%res1 = bitcast <16 x i1> %res to i16
ret i16 %res1
}
+
+; CHECK-LABEL: test13
+; CHECK: vcmpeqps %zmm
+; CHECK: vpbroadcastd
+; CHECK: ret
+define <16 x i32> @test13(<16 x float>%a, <16 x float>%b)
+{
+ %cmpvector_i = fcmp oeq <16 x float> %a, %b
+ %conv = zext <16 x i1> %cmpvector_i to <16 x i32>
+ ret <16 x i32> %conv
+}
More information about the llvm-commits
mailing list