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 13 ; RUN: llc < %s -mtriple=armv7ve-none-linux-gnu | \ 14 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV 15 ; RUN: llc < %s -mtriple=thumbv7ve-none-linux-gnu | \ 16 ; RUN: FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-HWDIV \ 17 ; RUN: -check-prefix=CHECK-THUMB 18 19 define i32 @f1(i32 %a, i32 %b) { 20 entry: 21 ; CHECK-LABEL: f1 22 ; CHECK-SWDIV: __divsi3 23 24 ; CHECK-THUMB: .thumb_func 25 ; CHECK-HWDIV: sdiv 26 27 ; CHECK-EABI: __aeabi_idiv 28 %tmp1 = sdiv i32 %a, %b ; <i32> [#uses=1] 29 ret i32 %tmp1 30 } 31 32 define i32 @f2(i32 %a, i32 %b) { 33 entry: 34 ; CHECK-LABEL: f2 35 ; CHECK-SWDIV: __udivsi3 36 37 ; CHECK-THUMB: .thumb_func 38 ; CHECK-HWDIV: udiv 39 40 ; CHECK-EABI: __aeabi_uidiv 41 %tmp1 = udiv i32 %a, %b ; <i32> [#uses=1] 42 ret i32 %tmp1 43 } 44 45 define i32 @f3(i32 %a, i32 %b) { 46 entry: 47 ; CHECK-LABEL: f3 48 ; CHECK-SWDIV: __modsi3 49 50 ; CHECK-THUMB: .thumb_func 51 ; CHECK-HWDIV: sdiv 52 ; CHECK-HWDIV: mls 53 54 ; EABI MODE = Remainder in R1, quotient in R0 55 ; CHECK-EABI: __aeabi_idivmod 56 ; CHECK-EABI-NEXT: mov r0, r1 57 %tmp1 = srem i32 %a, %b ; <i32> [#uses=1] 58 ret i32 %tmp1 59 } 60 61 define i32 @f4(i32 %a, i32 %b) { 62 entry: 63 ; CHECK-LABEL: f4 64 ; CHECK-SWDIV: __umodsi3 65 66 ; CHECK-THUMB: .thumb_func 67 ; CHECK-HWDIV: udiv 68 ; CHECK-HWDIV: mls 69 70 ; EABI MODE = Remainder in R1, quotient in R0 71 ; CHECK-EABI: __aeabi_uidivmod 72 ; CHECK-EABI-NEXT: mov r0, r1 73 %tmp1 = urem i32 %a, %b ; <i32> [#uses=1] 74 ret i32 %tmp1 75 } 76 77 78 define i64 @f5(i64 %a, i64 %b) { 79 entry: 80 ; CHECK-LABEL: f5 81 ; CHECK-SWDIV: __moddi3 82 83 ; CHECK-HWDIV: __moddi3 84 85 ; EABI MODE = Remainder in R2-R3, quotient in R0-R1 86 ; CHECK-EABI: __aeabi_ldivmod 87 ; CHECK-EABI-NEXT: mov r0, r2 88 ; CHECK-EABI-NEXT: mov r1, r3 89 %tmp1 = srem i64 %a, %b ; <i64> [#uses=1] 90 ret i64 %tmp1 91 } 92 93 define i64 @f6(i64 %a, i64 %b) { 94 entry: 95 ; CHECK-LABEL: f6 96 ; CHECK-SWDIV: __umoddi3 97 98 ; CHECK-HWDIV: __umoddi3 99 100 ; EABI MODE = Remainder in R2-R3, quotient in R0-R1 101 ; CHECK-EABI: __aeabi_uldivmod 102 ; CHECK-EABI-NEXT: mov r0, r2 103 ; CHECK-EABI-NEXT: mov r1, r3 104 %tmp1 = urem i64 %a, %b ; <i64> [#uses=1] 105 ret i64 %tmp1 106 } 107