1 ; RUN: llc -mattr=mul,movw < %s -march=avr | FileCheck %s
3 ; Unsigned 8-bit division
4 define i8 @udiv8(i8 %a, i8 %b) {
6 ; CHECK: call __udivmodqi4
9 %quotient = udiv i8 %a, %b
13 ; Signed 8-bit division
14 define i8 @sdiv8(i8 %a, i8 %b) {
16 ; CHECK: call __divmodqi4
19 %quotient = sdiv i8 %a, %b
23 ; Unsigned 16-bit division
24 define i16 @udiv16(i16 %a, i16 %b) {
25 ; CHECK-LABEL: udiv16:
26 ; CHECK: call __udivmodhi4
27 ; CHECK-NEXT: movw r24, r22
29 %quot = udiv i16 %a, %b
33 ; Signed 16-bit division
34 define i16 @sdiv16(i16 %a, i16 %b) {
35 ; CHECK-LABEL: sdiv16:
36 ; CHECK: call __divmodhi4
37 ; CHECK-NEXT: movw r24, r22
39 %quot = sdiv i16 %a, %b
43 ; Unsigned 32-bit division
44 define i32 @udiv32(i32 %a, i32 %b) {
45 ; CHECK-LABEL: udiv32:
46 ; CHECK: call __udivmodsi4
47 ; CHECK-NEXT: movw r22, r18
48 ; CHECK-NEXT: movw r24, r20
50 %quot = udiv i32 %a, %b
54 ; Signed 32-bit division
55 define i32 @sdiv32(i32 %a, i32 %b) {
56 ; CHECK-LABEL: sdiv32:
57 ; CHECK: call __divmodsi4
58 ; CHECK-NEXT: movw r22, r18
59 ; CHECK-NEXT: movw r24, r20
61 %quot = sdiv i32 %a, %b
65 ; Unsigned 64-bit division
66 define i64 @udiv64(i64 %a, i64 %b) {
67 ; CHECK-LABEL: udiv64:
68 ; CHECK: call __udivdi3
70 %quot = udiv i64 %a, %b
74 ; Signed 64-bit division
75 define i64 @sdiv64(i64 %a, i64 %b) {
76 ; CHECK-LABEL: sdiv64:
77 ; CHECK: call __divdi3
79 %quot = sdiv i64 %a, %b
83 ; Unsigned 128-bit division
84 define i128 @udiv128(i128 %a, i128 %b) {
85 ; CHECK-LABEL: udiv128:
86 ; CHECK: call __udivti3
88 %quot = udiv i128 %a, %b
92 ; Signed 128-bit division
93 define i128 @sdiv128(i128 %a, i128 %b) {
94 ; CHECK-LABEL: sdiv128:
95 ; CHECK: call __divti3
97 %quot = sdiv i128 %a, %b