[llvm-commits] [llvm] r59450 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp test/CodeGen/XCore/2008-11-17-Shl64.ll

Richard Osborne richard at xmos.com
Mon Nov 17 09:34:31 PST 2008


Author: friedgold
Date: Mon Nov 17 11:34:31 2008
New Revision: 59450

URL: http://llvm.org/viewvc/llvm-project?rev=59450&view=rev
Log:
Don't produce ADDC/ADDE when expanding SHL unless they are legal
for the target. This fixes PR3080.

Added:
    llvm/trunk/test/CodeGen/XCore/2008-11-17-Shl64.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp?rev=59450&r1=59449&r2=59450&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp Mon Nov 17 11:34:31 2008
@@ -1073,7 +1073,8 @@
     } else if (Amt == NVTBits) {
       Lo = DAG.getConstant(0, NVT);
       Hi = InL;
-    } else if (Amt == 1) {
+    } else if (Amt == 1 &&
+               TLI.isOperationLegal(ISD::ADDC, TLI.getTypeToExpandTo(NVT))) {
       // Emit this X << 1 as X+X.
       SDVTList VTList = DAG.getVTList(NVT, MVT::Flag);
       SDValue LoOps[2] = { InL, InL };

Added: llvm/trunk/test/CodeGen/XCore/2008-11-17-Shl64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/XCore/2008-11-17-Shl64.ll?rev=59450&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/XCore/2008-11-17-Shl64.ll (added)
+++ llvm/trunk/test/CodeGen/XCore/2008-11-17-Shl64.ll Mon Nov 17 11:34:31 2008
@@ -0,0 +1,6 @@
+; RUN: llvm-as < %s | llc -march=xcore > %t1.s
+; PR3080
+define i64 @test(i64 %a) {
+	%result = shl i64 %a, 1
+	ret i64 %result
+}





More information about the llvm-commits mailing list