blob: 621784a4f21c955227adf883ccd84a00bc36c064 [file] [log] [blame]
Wesley Pecka70f28c2010-02-23 19:15:24 +00001; Ensure that multiplication is lowered to function calls when the multiplier
2; unit is not available in the hardware and that function calls are not used
3; when the multiplier unit is available in the hardware.
4;
5; RUN: llc < %s -march=mblaze | FileCheck -check-prefix=FUN %s
6; RUN: llc < %s -march=mblaze -mattr=+div | FileCheck -check-prefix=DIV %s
7
8define i8 @test_i8(i8 %a, i8 %b) {
9 ; FUN: test_i8:
10 ; DIV: test_i8:
11
12 %tmp.1 = udiv i8 %a, %b
13 ; FUN-NOT: idiv
14 ; FUN: brlid
15 ; DIV-NOT: brlid
Dan Gohman8c2d2702011-10-24 17:45:02 +000016 ; DIV: idiv
Wesley Pecka70f28c2010-02-23 19:15:24 +000017
18 %tmp.2 = sdiv i8 %a, %b
19 ; FUN-NOT: idiv
20 ; FUN: brlid
21 ; DIV-NOT: brlid
Dan Gohman8c2d2702011-10-24 17:45:02 +000022 ; DIV-NOT: idiv
23 ; DIV: idivu
Wesley Pecka70f28c2010-02-23 19:15:24 +000024
25 %tmp.3 = add i8 %tmp.1, %tmp.2
26 ret i8 %tmp.3
27 ; FUN: rtsd
28 ; DIV: rtsd
29}
30
31define i16 @test_i16(i16 %a, i16 %b) {
32 ; FUN: test_i16:
33 ; DIV: test_i16:
34
35 %tmp.1 = udiv i16 %a, %b
36 ; FUN-NOT: idiv
37 ; FUN: brlid
38 ; DIV-NOT: brlid
Dan Gohman8c2d2702011-10-24 17:45:02 +000039 ; DIV: idiv
Wesley Pecka70f28c2010-02-23 19:15:24 +000040
41 %tmp.2 = sdiv i16 %a, %b
42 ; FUN-NOT: idiv
43 ; FUN: brlid
44 ; DIV-NOT: brlid
Dan Gohman8c2d2702011-10-24 17:45:02 +000045 ; DIV-NOT: idiv
46 ; DIV: idivu
Wesley Pecka70f28c2010-02-23 19:15:24 +000047
48 %tmp.3 = add i16 %tmp.1, %tmp.2
49 ret i16 %tmp.3
50 ; FUN: rtsd
51 ; DIV: rtsd
52}
53
54define i32 @test_i32(i32 %a, i32 %b) {
55 ; FUN: test_i32:
56 ; DIV: test_i32:
57
58 %tmp.1 = udiv i32 %a, %b
59 ; FUN-NOT: idiv
60 ; FUN: brlid
61 ; DIV-NOT: brlid
Dan Gohman8c2d2702011-10-24 17:45:02 +000062 ; DIV: idiv
Wesley Pecka70f28c2010-02-23 19:15:24 +000063
64 %tmp.2 = sdiv i32 %a, %b
65 ; FUN-NOT: idiv
66 ; FUN: brlid
67 ; DIV-NOT: brlid
Dan Gohman8c2d2702011-10-24 17:45:02 +000068 ; DIV-NOT: idiv
69 ; DIV: idivu
Wesley Pecka70f28c2010-02-23 19:15:24 +000070
71 %tmp.3 = add i32 %tmp.1, %tmp.2
72 ret i32 %tmp.3
73 ; FUN: rtsd
74 ; DIV: rtsd
75}