[llvm] r281966 - AVX-512: Fixed a bug in lowering saturated operations on KNL.
Elena Demikhovsky via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 20 04:02:27 PDT 2016
Author: delena
Date: Tue Sep 20 06:02:26 2016
New Revision: 281966
URL: http://llvm.org/viewvc/llvm-project?rev=281966&view=rev
Log:
AVX-512: Fixed a bug in lowering saturated operations on KNL.
The generated code is still not optimal.
Differential Revision: https://reviews.llvm.org/D24723
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/test/CodeGen/X86/xaluo.ll
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=281966&r1=281965&r2=281966&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Tue Sep 20 06:02:26 2016
@@ -20867,10 +20867,13 @@ static SDValue LowerXALUO(SDValue Op, Se
SDValue Sum = DAG.getNode(X86ISD::UMUL, DL, VTs, LHS, RHS);
SDValue SetCC =
- DAG.getNode(X86ISD::SETCC, DL, N->getValueType(1),
+ DAG.getNode(X86ISD::SETCC, DL, MVT::i8,
DAG.getConstant(X86::COND_O, DL, MVT::i32),
SDValue(Sum.getNode(), 2));
+ if (N->getValueType(1) == MVT::i1)
+ SetCC = DAG.getNode(ISD::TRUNCATE, DL, MVT::i1, SetCC);
+
return DAG.getNode(ISD::MERGE_VALUES, DL, N->getVTList(), Sum, SetCC);
}
}
@@ -20880,10 +20883,13 @@ static SDValue LowerXALUO(SDValue Op, Se
SDValue Sum = DAG.getNode(BaseOp, DL, VTs, LHS, RHS);
SDValue SetCC =
- DAG.getNode(X86ISD::SETCC, DL, N->getValueType(1),
+ DAG.getNode(X86ISD::SETCC, DL, MVT::i8,
DAG.getConstant(Cond, DL, MVT::i32),
SDValue(Sum.getNode(), 1));
+ if (N->getValueType(1) == MVT::i1)
+ SetCC = DAG.getNode(ISD::TRUNCATE, DL, MVT::i1, SetCC);
+
return DAG.getNode(ISD::MERGE_VALUES, DL, N->getVTList(), Sum, SetCC);
}
Modified: llvm/trunk/test/CodeGen/X86/xaluo.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/xaluo.ll?rev=281966&r1=281965&r2=281966&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/xaluo.ll (original)
+++ llvm/trunk/test/CodeGen/X86/xaluo.ll Tue Sep 20 06:02:26 2016
@@ -736,6 +736,15 @@ continue:
}
define i1 @bug27873(i64 %c1, i1 %c2) {
+; CHECK-LABEL: bug27873:
+; CHECK: ## BB#0:
+; CHECK-NEXT: movl $160, %ecx
+; CHECK-NEXT: movq %rdi, %rax
+; CHECK-NEXT: mulq %rcx
+; CHECK-NEXT: seto %al
+; CHECK-NEXT: orb %sil, %al
+; CHECK-NEXT: retq
+;
; KNL-LABEL: bug27873:
; KNL: ## BB#0:
; KNL-NEXT: andl $1, %esi
@@ -744,6 +753,7 @@ define i1 @bug27873(i64 %c1, i1 %c2) {
; KNL-NEXT: movq %rdi, %rax
; KNL-NEXT: mulq %rcx
; KNL-NEXT: seto %al
+; KNL-NEXT: andl $1, %eax
; KNL-NEXT: kmovw %eax, %k1
; KNL-NEXT: korw %k1, %k0, %k0
; KNL-NEXT: kmovw %k0, %eax
More information about the llvm-commits
mailing list