1; RUN: llc -O1 -mtriple=armv5te-none-none-eabi %s -o - | FileCheck %s
2; RUN: llc -O1 -mtriple=armv6-none-none-eabi %s -o - | FileCheck %s
3; RUN: llc -O1 -mtriple=armv7-none-none-eabi %s -o - | FileCheck %s
4; RUN: llc -O1 -mtriple=thumbv7-none-none-eabi %s -o - | FileCheck %s
5; RUN: llc -O1 -mtriple=thumbv6t2-none-none-eabi %s -o - | FileCheck %s
6; RUN: llc -O1 -mtriple=thumbv7em-none-none-eabi %s -o - | FileCheck %s
7; RUN: llc -O1 -mtriple=thumbv8m.main-none-none-eabi -mattr=+dsp %s -o - | FileCheck %s
8define i32 @smulbb(i32 %a, i32 %b) {
9; CHECK-LABEL: smulbb
10; CHECK: smulbb r0, r0, r1
11  %tmp = call i32 @llvm.arm.smulbb(i32 %a, i32 %b)
12  ret i32 %tmp
13}
14
15define i32 @smulbt(i32 %a, i32 %b) {
16; CHECK-LABEL: smulbt
17; CHECK: smulbt r0, r0, r1
18  %tmp = call i32 @llvm.arm.smulbt(i32 %a, i32 %b)
19  ret i32 %tmp
20}
21
22define i32 @smultb(i32 %a, i32 %b) {
23; CHECK-LABEL: smultb
24; CHECK: smultb r0, r0, r1
25  %tmp = call i32 @llvm.arm.smultb(i32 %a, i32 %b)
26  ret i32 %tmp
27}
28
29define i32 @smultt(i32 %a, i32 %b) {
30; CHECK-LABEL: smultt
31; CHECK: smultt r0, r0, r1
32  %tmp = call i32 @llvm.arm.smultt(i32 %a, i32 %b)
33  ret i32 %tmp
34}
35
36define i32 @smulwb(i32 %a, i32 %b) {
37; CHECK-LABEL: smulwb
38; CHECK: smulwb r0, r0, r1
39  %tmp = call i32 @llvm.arm.smulwb(i32 %a, i32 %b)
40  ret i32 %tmp
41}
42
43define i32 @smulwt(i32 %a, i32 %b) {
44; CHECK-LABEL: smulwt
45; CHECK: smulwt r0, r0, r1
46  %tmp = call i32 @llvm.arm.smulwt(i32 %a, i32 %b)
47  ret i32 %tmp
48}
49
50define i32 @acc_mults(i32 %a, i32 %b, i32 %acc) {
51; CHECK-LABEL: acc_mults
52; CHECK: smlabb r2, r0, r1, r2
53; CHECK: smlabt r2, r0, r1, r2
54; CHECK: smlatb r2, r0, r1, r2
55; CHECK: smlatt r2, r0, r1, r2
56; CHECK: smlawb r2, r0, r1, r2
57; CHECK: smlawt r0, r0, r1, r2
58  %acc1 = call i32 @llvm.arm.smlabb(i32 %a, i32 %b, i32 %acc)
59  %acc2 = call i32 @llvm.arm.smlabt(i32 %a, i32 %b, i32 %acc1)
60  %acc3 = call i32 @llvm.arm.smlatb(i32 %a, i32 %b, i32 %acc2)
61  %acc4 = call i32 @llvm.arm.smlatt(i32 %a, i32 %b, i32 %acc3)
62  %acc5 = call i32 @llvm.arm.smlawb(i32 %a, i32 %b, i32 %acc4)
63  %acc6 = call i32 @llvm.arm.smlawt(i32 %a, i32 %b, i32 %acc5)
64  ret i32 %acc6
65}
66
67define i32 @qadd(i32 %a, i32 %b) nounwind {
68; CHECK-LABEL: qadd
69; CHECK: qadd r0, r0, r1
70  %tmp = call i32 @llvm.arm.qadd(i32 %a, i32 %b)
71  ret i32 %tmp
72}
73
74define i32 @qsub(i32 %a, i32 %b) nounwind {
75; CHECK-LABEL: qsub
76; CHECK: qsub r0, r0, r1
77  %tmp = call i32 @llvm.arm.qsub(i32 %a, i32 %b)
78  ret i32 %tmp
79}
80
81define i32 @qdadd(i32 %a, i32 %b) nounwind {
82; CHECK-LABEL: qdadd
83; CHECK: qdadd r0, r1, r0
84  %dbl = call i32 @llvm.arm.qadd(i32 %a, i32 %a)
85  %add = call i32 @llvm.arm.qadd(i32 %dbl, i32 %b)
86  ret i32 %add
87}
88
89define i32 @qdsub(i32 %a, i32 %b) nounwind {
90; CHECK-LABEL: qdsub
91; CHECK: qdsub r0, r0, r1
92  %dbl = call i32 @llvm.arm.qadd(i32 %b, i32 %b)
93  %add = call i32 @llvm.arm.qsub(i32 %a, i32 %dbl)
94  ret i32 %add
95}
96
97declare i32 @llvm.arm.smulbb(i32 %a, i32 %b) nounwind readnone
98declare i32 @llvm.arm.smulbt(i32 %a, i32 %b) nounwind readnone
99declare i32 @llvm.arm.smultb(i32 %a, i32 %b) nounwind readnone
100declare i32 @llvm.arm.smultt(i32 %a, i32 %b) nounwind readnone
101declare i32 @llvm.arm.smulwb(i32 %a, i32 %b) nounwind readnone
102declare i32 @llvm.arm.smulwt(i32 %a, i32 %b) nounwind readnone
103declare i32 @llvm.arm.smlabb(i32, i32, i32) nounwind
104declare i32 @llvm.arm.smlabt(i32, i32, i32) nounwind
105declare i32 @llvm.arm.smlatb(i32, i32, i32) nounwind
106declare i32 @llvm.arm.smlatt(i32, i32, i32) nounwind
107declare i32 @llvm.arm.smlawb(i32, i32, i32) nounwind
108declare i32 @llvm.arm.smlawt(i32, i32, i32) nounwind
109declare i32 @llvm.arm.qadd(i32, i32) nounwind
110declare i32 @llvm.arm.qsub(i32, i32) nounwind
111