1 ; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-a8 | \
2 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SWDIV
3 ; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=swift | \
4 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV
5 ; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-r4 | \
6 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SWDIV
7 ; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-r4f | \
8 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-SWDIV
9 ; RUN: llc < %s -mtriple=arm-apple-ios -mcpu=cortex-r5 | \
10 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV
11 ; RUN: llc < %s -mtriple=arm-none-eabi -mcpu=cortex-a8 | \
12 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-EABI
14 define i32 @f1(i32 %a, i32 %b) {
17 ; CHECK-SWDIV: __divsi3
21 ; CHECK-EABI: __aeabi_idiv
22 %tmp1 = sdiv i32 %a, %b ; <i32> [#uses=1]
26 define i32 @f2(i32 %a, i32 %b) {
29 ; CHECK-SWDIV: __udivsi3
33 ; CHECK-EABI: __aeabi_uidiv
34 %tmp1 = udiv i32 %a, %b ; <i32> [#uses=1]
38 define i32 @f3(i32 %a, i32 %b) {
41 ; CHECK-SWDIV: __modsi3
46 ; EABI MODE = Remainder in R1, quotient in R0
47 ; CHECK-EABI: __aeabi_idivmod
48 ; CHECK-EABI-NEXT: mov r0, r1
49 %tmp1 = srem i32 %a, %b ; <i32> [#uses=1]
53 define i32 @f4(i32 %a, i32 %b) {
56 ; CHECK-SWDIV: __umodsi3
61 ; EABI MODE = Remainder in R1, quotient in R0
62 ; CHECK-EABI: __aeabi_uidivmod
63 ; CHECK-EABI-NEXT: mov r0, r1
64 %tmp1 = urem i32 %a, %b ; <i32> [#uses=1]
69 define i64 @f5(i64 %a, i64 %b) {
72 ; CHECK-SWDIV: __moddi3
74 ; CHECK-HWDIV: __moddi3
76 ; EABI MODE = Remainder in R2-R3, quotient in R0-R1
77 ; CHECK-EABI: __aeabi_ldivmod
78 ; CHECK-EABI-NEXT: mov r0, r2
79 ; CHECK-EABI-NEXT: mov r1, r3
80 %tmp1 = srem i64 %a, %b ; <i64> [#uses=1]
84 define i64 @f6(i64 %a, i64 %b) {
87 ; CHECK-SWDIV: __umoddi3
89 ; CHECK-HWDIV: __umoddi3
91 ; EABI MODE = Remainder in R2-R3, quotient in R0-R1
92 ; CHECK-EABI: __aeabi_uldivmod
93 ; CHECK-EABI-NEXT: mov r0, r2
94 ; CHECK-EABI-NEXT: mov r1, r3
95 %tmp1 = urem i64 %a, %b ; <i64> [#uses=1]