2015-08-24 17:17:18 +08:00
|
|
|
; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-a8 | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SWDIV
|
|
|
|
; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=swift | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV
|
|
|
|
; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-r4 | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SWDIV
|
|
|
|
; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-r4f | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SWDIV
|
|
|
|
; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-r5 | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV
|
|
|
|
; RUN: llc < %s -mtriple=arm-none-eabi -mcpu=cortex-a8 | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-EABI
|
2017-02-10 07:29:14 +08:00
|
|
|
; RUN: llc < %s -mtriple=armv7ve-none-linux-gnu | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV
|
|
|
|
; RUN: llc < %s -mtriple=thumbv7ve-none-linux-gnu | \
|
|
|
|
; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV \
|
|
|
|
; RUN: -check-prefix=CHECK-THUMB
|
2006-10-18 05:05:33 +08:00
|
|
|
|
2008-02-18 04:02:20 +08:00
|
|
|
define i32 @f1(i32 %a, i32 %b) {
|
2006-10-18 05:05:33 +08:00
|
|
|
entry:
|
2015-08-24 17:17:18 +08:00
|
|
|
; CHECK-LABEL: f1
|
2015-04-09 22:07:28 +08:00
|
|
|
; CHECK-SWDIV: __divsi3
|
2012-09-30 05:43:49 +08:00
|
|
|
|
2017-02-10 07:29:14 +08:00
|
|
|
; CHECK-THUMB: .thumb_func
|
2013-06-05 06:52:09 +08:00
|
|
|
; CHECK-HWDIV: sdiv
|
2015-08-24 17:17:18 +08:00
|
|
|
|
|
|
|
; CHECK-EABI: __aeabi_idiv
|
2008-02-18 04:02:20 +08:00
|
|
|
%tmp1 = sdiv i32 %a, %b ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp1
|
2006-10-18 05:05:33 +08:00
|
|
|
}
|
|
|
|
|
2008-02-18 04:02:20 +08:00
|
|
|
define i32 @f2(i32 %a, i32 %b) {
|
2006-10-18 05:05:33 +08:00
|
|
|
entry:
|
2015-08-24 17:17:18 +08:00
|
|
|
; CHECK-LABEL: f2
|
2015-04-09 22:07:28 +08:00
|
|
|
; CHECK-SWDIV: __udivsi3
|
2012-09-30 05:43:49 +08:00
|
|
|
|
2017-02-10 07:29:14 +08:00
|
|
|
; CHECK-THUMB: .thumb_func
|
2013-06-05 06:52:09 +08:00
|
|
|
; CHECK-HWDIV: udiv
|
2015-08-24 17:17:18 +08:00
|
|
|
|
|
|
|
; CHECK-EABI: __aeabi_uidiv
|
2008-02-18 04:02:20 +08:00
|
|
|
%tmp1 = udiv i32 %a, %b ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp1
|
2006-10-18 05:05:33 +08:00
|
|
|
}
|
|
|
|
|
2008-02-18 04:02:20 +08:00
|
|
|
define i32 @f3(i32 %a, i32 %b) {
|
2006-10-18 05:05:33 +08:00
|
|
|
entry:
|
2015-08-24 17:17:18 +08:00
|
|
|
; CHECK-LABEL: f3
|
2015-04-09 22:07:28 +08:00
|
|
|
; CHECK-SWDIV: __modsi3
|
2012-09-30 05:43:49 +08:00
|
|
|
|
2017-02-10 07:29:14 +08:00
|
|
|
; CHECK-THUMB: .thumb_func
|
2013-06-05 06:52:09 +08:00
|
|
|
; CHECK-HWDIV: sdiv
|
|
|
|
; CHECK-HWDIV: mls
|
2015-08-24 17:17:18 +08:00
|
|
|
|
|
|
|
; EABI MODE = Remainder in R1, quotient in R0
|
|
|
|
; CHECK-EABI: __aeabi_idivmod
|
|
|
|
; CHECK-EABI-NEXT: mov r0, r1
|
2008-02-18 04:02:20 +08:00
|
|
|
%tmp1 = srem i32 %a, %b ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp1
|
2006-10-18 05:05:33 +08:00
|
|
|
}
|
|
|
|
|
2008-02-18 04:02:20 +08:00
|
|
|
define i32 @f4(i32 %a, i32 %b) {
|
2006-10-18 05:05:33 +08:00
|
|
|
entry:
|
2015-08-24 17:17:18 +08:00
|
|
|
; CHECK-LABEL: f4
|
2015-04-09 22:07:28 +08:00
|
|
|
; CHECK-SWDIV: __umodsi3
|
2012-09-30 05:43:49 +08:00
|
|
|
|
2017-02-10 07:29:14 +08:00
|
|
|
; CHECK-THUMB: .thumb_func
|
2013-06-05 06:52:09 +08:00
|
|
|
; CHECK-HWDIV: udiv
|
|
|
|
; CHECK-HWDIV: mls
|
2015-08-24 17:17:18 +08:00
|
|
|
|
|
|
|
; EABI MODE = Remainder in R1, quotient in R0
|
|
|
|
; CHECK-EABI: __aeabi_uidivmod
|
|
|
|
; CHECK-EABI-NEXT: mov r0, r1
|
2008-02-18 04:02:20 +08:00
|
|
|
%tmp1 = urem i32 %a, %b ; <i32> [#uses=1]
|
|
|
|
ret i32 %tmp1
|
2006-10-18 05:05:33 +08:00
|
|
|
}
|
2008-02-18 04:02:20 +08:00
|
|
|
|
2015-08-24 17:17:18 +08:00
|
|
|
|
|
|
|
define i64 @f5(i64 %a, i64 %b) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: f5
|
|
|
|
; CHECK-SWDIV: __moddi3
|
|
|
|
|
|
|
|
; CHECK-HWDIV: __moddi3
|
|
|
|
|
|
|
|
; EABI MODE = Remainder in R2-R3, quotient in R0-R1
|
|
|
|
; CHECK-EABI: __aeabi_ldivmod
|
|
|
|
; CHECK-EABI-NEXT: mov r0, r2
|
|
|
|
; CHECK-EABI-NEXT: mov r1, r3
|
|
|
|
%tmp1 = srem i64 %a, %b ; <i64> [#uses=1]
|
|
|
|
ret i64 %tmp1
|
|
|
|
}
|
|
|
|
|
|
|
|
define i64 @f6(i64 %a, i64 %b) {
|
|
|
|
entry:
|
|
|
|
; CHECK-LABEL: f6
|
|
|
|
; CHECK-SWDIV: __umoddi3
|
|
|
|
|
|
|
|
; CHECK-HWDIV: __umoddi3
|
|
|
|
|
|
|
|
; EABI MODE = Remainder in R2-R3, quotient in R0-R1
|
|
|
|
; CHECK-EABI: __aeabi_uldivmod
|
|
|
|
; CHECK-EABI-NEXT: mov r0, r2
|
|
|
|
; CHECK-EABI-NEXT: mov r1, r3
|
|
|
|
%tmp1 = urem i64 %a, %b ; <i64> [#uses=1]
|
|
|
|
ret i64 %tmp1
|
|
|
|
}
|