2014-04-04 00:01:44 +08:00
|
|
|
; RUN: llc -mtriple=arm-eabi -mattr=+v6 %s -o - | FileCheck %s -check-prefix=V6
|
|
|
|
; RUN: llc -mtriple=arm-eabi %s -o - | FileCheck %s -check-prefix=V4
|
|
|
|
; RUN: llc -mtriple=thumb-eabi -mcpu=cortex-m3 %s -o - | FileCheck %s -check-prefix=M3
|
2007-01-19 17:20:23 +08:00
|
|
|
|
2011-09-21 05:38:18 +08:00
|
|
|
define i32 @smulhi(i32 %x, i32 %y) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; V6-LABEL: smulhi:
|
2011-09-21 05:38:18 +08:00
|
|
|
; V6: smmul
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; V4-LABEL: smulhi:
|
2011-09-21 05:38:18 +08:00
|
|
|
; V4: smull
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; M3-LABEL: smulhi:
|
2011-09-21 05:38:18 +08:00
|
|
|
; M3: smull
|
2008-02-18 04:02:20 +08:00
|
|
|
%tmp = sext i32 %x to i64 ; <i64> [#uses=1]
|
|
|
|
%tmp1 = sext i32 %y to i64 ; <i64> [#uses=1]
|
|
|
|
%tmp2 = mul i64 %tmp1, %tmp ; <i64> [#uses=1]
|
|
|
|
%tmp3 = lshr i64 %tmp2, 32 ; <i64> [#uses=1]
|
|
|
|
%tmp3.upgrd.1 = trunc i64 %tmp3 to i32 ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp3.upgrd.1
|
2007-01-19 17:20:23 +08:00
|
|
|
}
|
|
|
|
|
2011-09-21 05:38:18 +08:00
|
|
|
define i32 @umulhi(i32 %x, i32 %y) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; V6-LABEL: umulhi:
|
2011-09-21 05:38:18 +08:00
|
|
|
; V6: umull
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; V4-LABEL: umulhi:
|
2011-09-21 05:38:18 +08:00
|
|
|
; V4: umull
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; M3-LABEL: umulhi:
|
2011-09-21 05:38:18 +08:00
|
|
|
; M3: umull
|
2008-02-18 04:02:20 +08:00
|
|
|
%tmp = zext i32 %x to i64 ; <i64> [#uses=1]
|
|
|
|
%tmp1 = zext i32 %y to i64 ; <i64> [#uses=1]
|
|
|
|
%tmp2 = mul i64 %tmp1, %tmp ; <i64> [#uses=1]
|
|
|
|
%tmp3 = lshr i64 %tmp2, 32 ; <i64> [#uses=1]
|
|
|
|
%tmp3.upgrd.2 = trunc i64 %tmp3 to i32 ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp3.upgrd.2
|
2007-01-19 17:20:23 +08:00
|
|
|
}
|
2011-09-21 05:38:18 +08:00
|
|
|
|
|
|
|
; rdar://r10152911
|
|
|
|
define i32 @t3(i32 %a) nounwind {
|
2013-07-14 14:24:09 +08:00
|
|
|
; V6-LABEL: t3:
|
2011-09-21 05:38:18 +08:00
|
|
|
; V6: smmla
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; V4-LABEL: t3:
|
2011-09-21 05:38:18 +08:00
|
|
|
; V4: smull
|
|
|
|
|
2013-07-14 14:24:09 +08:00
|
|
|
; M3-LABEL: t3:
|
2011-09-21 05:38:18 +08:00
|
|
|
; M3-NOT: smmla
|
|
|
|
; M3: smull
|
|
|
|
entry:
|
|
|
|
%tmp1 = mul nsw i32 %a, 3
|
|
|
|
%tmp2 = sdiv i32 %tmp1, 23
|
|
|
|
ret i32 %tmp2
|
|
|
|
}
|