This repository has been archived by the owner on Feb 5, 2019. It is now read-only.
forked from luqmana/llvm
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from parched/rust-smulo
Fix signed multiplication with overflow
- Loading branch information
Showing
2 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |