thumb1-div.ll
1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
; RUN: llc < %s -mtriple=thumb-none-eabi -mcpu=cortex-m23 | \
; RUN: FileCheck %s -check-prefix=CHECK
define i32 @f1(i32 %a, i32 %b) {
entry:
; CHECK-LABEL: f1
; CHECK: sdiv
%tmp1 = sdiv i32 %a, %b ; <i32> [#uses=1]
ret i32 %tmp1
}
define i32 @f2(i32 %a, i32 %b) {
entry:
; CHECK-LABEL: f2
; CHECK: udiv
%tmp1 = udiv i32 %a, %b ; <i32> [#uses=1]
ret i32 %tmp1
}
define i32 @f3(i32 %a, i32 %b) {
entry:
; CHECK-LABEL: f3
%tmp1 = srem i32 %a, %b ; <i32> [#uses=1]
ret i32 %tmp1
; CHECK: sdiv
; CHECK-NEXT: muls
; CHECK-NEXT: subs
}
define i32 @f4(i32 %a, i32 %b) {
entry:
; CHECK-LABEL: f4
; CHECK: udiv
; CHECK-NEXT: muls
; CHECK-NEXT: subs
%tmp1 = urem i32 %a, %b ; <i32> [#uses=1]
ret i32 %tmp1
}
define i64 @f5(i64 %a, i64 %b) {
entry:
; CHECK-LABEL: f5
; EABI MODE = Remainder in R2-R3, quotient in R0-R1
; CHECK: __aeabi_ldivmod
; CHECK-NEXT: mov r0, r2
; CHECK-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
; EABI MODE = Remainder in R2-R3, quotient in R0-R1
; CHECK: __aeabi_uldivmod
; CHECK: mov r0, r2
; CHECK: mov r1, r3
%tmp1 = urem i64 %a, %b ; <i64> [#uses=1]
ret i64 %tmp1
}