[PATCH] D31807: Fix signed multiplication with overflow fallback.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 26 06:54:43 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL301404: Fix signed multiplication with overflow fallback. (authored by rsingh).
Changed prior to commit:
https://reviews.llvm.org/D31807?vs=95160&id=96729#toc
Repository:
rL LLVM
https://reviews.llvm.org/D31807
Files:
llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
llvm/trunk/test/CodeGen/ARM/v6m-smul-with-overflow.ll
Index: llvm/trunk/test/CodeGen/ARM/v6m-smul-with-overflow.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/v6m-smul-with-overflow.ll
+++ llvm/trunk/test/CodeGen/ARM/v6m-smul-with-overflow.ll
@@ -0,0 +1,16 @@
+; RUN: llc < %s -mtriple=thumbv6m-none-eabi | FileCheck %s
+
+define i1 @signed_multiplication_did_overflow(i32, i32) {
+; CHECK-LABEL: signed_multiplication_did_overflow:
+entry-block:
+ %2 = tail call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %0, i32 %1)
+ %3 = extractvalue { i32, i1 } %2, 1
+ ret i1 %3
+
+; CHECK: mov r2, r1
+; CHECK: asrs r1, r0, #31
+; CHECK: asrs r3, r2, #31
+; CHECK: bl __aeabi_lmul
+}
+
+declare { i32, i1 } @llvm.smul.with.overflow.i32(i32, i32)
Index: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -3497,11 +3497,11 @@
// part.
unsigned LoSize = VT.getSizeInBits();
SDValue HiLHS =
- DAG.getNode(ISD::SRA, dl, VT, RHS,
+ DAG.getNode(ISD::SRA, dl, VT, LHS,
DAG.getConstant(LoSize - 1, dl,
TLI.getPointerTy(DAG.getDataLayout())));
SDValue HiRHS =
- DAG.getNode(ISD::SRA, dl, VT, LHS,
+ DAG.getNode(ISD::SRA, dl, VT, RHS,
DAG.getConstant(LoSize - 1, dl,
TLI.getPointerTy(DAG.getDataLayout())));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31807.96729.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170426/d6108ce5/attachment.bin>
More information about the llvm-commits
mailing list