[llvm-commits] [llvm] r161732 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp test/CodeGen/X86/pr13577.ll
Michael Liao
michael.liao at intel.com
Sat Aug 11 16:47:06 PDT 2012
Author: hliao
Date: Sat Aug 11 18:47:06 2012
New Revision: 161732
URL: http://llvm.org/viewvc/llvm-project?rev=161732&view=rev
Log:
fix PR13577, an issue introduced by r161687
- FCMOV only supports a subset of X86 conditions. Skip boolean
simplification if X86 condition is not valid for FCMOV.
- add a minimal test case for PR13577.
Added:
llvm/trunk/test/CodeGen/X86/pr13577.ll
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=161732&r1=161731&r2=161732&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Aug 11 18:47:06 2012
@@ -13843,6 +13843,22 @@
return SetCC.getOperand(1);
}
+static bool IsValidFCMOVCondition(X86::CondCode CC) {
+ switch (CC) {
+ default:
+ return false;
+ case X86::COND_B:
+ case X86::COND_BE:
+ case X86::COND_E:
+ case X86::COND_P:
+ case X86::COND_AE:
+ case X86::COND_A:
+ case X86::COND_NE:
+ case X86::COND_NP:
+ return true;
+ }
+}
+
/// Optimize X86ISD::CMOV [LHS, RHS, CONDCODE (e.g. X86::COND_NE), CONDVAL]
static SDValue PerformCMOVCombine(SDNode *N, SelectionDAG &DAG,
TargetLowering::DAGCombinerInfo &DCI) {
@@ -13871,7 +13887,9 @@
SDValue Flags;
Flags = BoolTestSetCCCombine(Cond, CC);
- if (Flags.getNode()) {
+ if (Flags.getNode() &&
+ // Extra check as FCMOV only supports a subset of X86 cond.
+ (FalseOp.getValueType() != MVT::f80 || IsValidFCMOVCondition(CC))) {
SDValue Ops[] = { FalseOp, TrueOp,
DAG.getConstant(CC, MVT::i8), Flags };
return DAG.getNode(X86ISD::CMOV, DL, N->getVTList(),
Added: llvm/trunk/test/CodeGen/X86/pr13577.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/pr13577.ll?rev=161732&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/X86/pr13577.ll (added)
+++ llvm/trunk/test/CodeGen/X86/pr13577.ll Sat Aug 11 18:47:06 2012
@@ -0,0 +1,8 @@
+; RUN: llc < %s -march=x86-64
+
+define x86_fp80 @foo(x86_fp80 %a) {
+ %1 = tail call x86_fp80 @copysignl(x86_fp80 0xK7FFF8000000000000000, x86_fp80 %a) nounwind readnone
+ ret x86_fp80 %1
+}
+
+declare x86_fp80 @copysignl(x86_fp80, x86_fp80) nounwind readnone
More information about the llvm-commits
mailing list