blob: 8fb86c238950bfa699f2a9a47a6bc468a8d5d087 [file] [log] [blame]
Akira Hatanaka3d602412013-04-13 00:55:41 +00001; RUN: llc -march=mips -mattr=dsp < %s | FileCheck %s -check-prefix=R1
2; RUN: llc -march=mips -mattr=dspr2 < %s | FileCheck %s -check-prefix=R2
Akira Hatanakafd2cd0d2013-03-30 02:14:45 +00003
Akira Hatanaka3d602412013-04-13 00:55:41 +00004; R1: test_lbux:
5; R1: lbux ${{[0-9]+}}
Akira Hatanakafd2cd0d2013-03-30 02:14:45 +00006
7define zeroext i8 @test_lbux(i8* nocapture %b, i32 %i) {
8entry:
9 %add.ptr = getelementptr inbounds i8* %b, i32 %i
10 %0 = load i8* %add.ptr, align 1
11 ret i8 %0
12}
13
Akira Hatanaka3d602412013-04-13 00:55:41 +000014; R1: test_lhx:
15; R1: lhx ${{[0-9]+}}
Akira Hatanakafd2cd0d2013-03-30 02:14:45 +000016
17define signext i16 @test_lhx(i16* nocapture %b, i32 %i) {
18entry:
19 %add.ptr = getelementptr inbounds i16* %b, i32 %i
20 %0 = load i16* %add.ptr, align 2
21 ret i16 %0
22}
23
Akira Hatanaka3d602412013-04-13 00:55:41 +000024; R1: test_lwx:
25; R1: lwx ${{[0-9]+}}
Akira Hatanakafd2cd0d2013-03-30 02:14:45 +000026
27define i32 @test_lwx(i32* nocapture %b, i32 %i) {
28entry:
29 %add.ptr = getelementptr inbounds i32* %b, i32 %i
30 %0 = load i32* %add.ptr, align 4
31 ret i32 %0
32}
Akira Hatanaka3d602412013-04-13 00:55:41 +000033
34; R1: test_add_v2q15_:
35; R1: addq.ph ${{[0-9]+}}
36
37define { i32 } @test_add_v2q15_(i32 %a.coerce, i32 %b.coerce) {
38entry:
39 %0 = bitcast i32 %a.coerce to <2 x i16>
40 %1 = bitcast i32 %b.coerce to <2 x i16>
41 %add = add <2 x i16> %0, %1
42 %2 = bitcast <2 x i16> %add to i32
43 %.fca.0.insert = insertvalue { i32 } undef, i32 %2, 0
44 ret { i32 } %.fca.0.insert
45}
46
47; R1: test_sub_v2q15_:
48; R1: subq.ph ${{[0-9]+}}
49
50define { i32 } @test_sub_v2q15_(i32 %a.coerce, i32 %b.coerce) {
51entry:
52 %0 = bitcast i32 %a.coerce to <2 x i16>
53 %1 = bitcast i32 %b.coerce to <2 x i16>
54 %sub = sub <2 x i16> %0, %1
55 %2 = bitcast <2 x i16> %sub to i32
56 %.fca.0.insert = insertvalue { i32 } undef, i32 %2, 0
57 ret { i32 } %.fca.0.insert
58}
59
60; R2: test_mul_v2q15_:
61; R2: mul.ph ${{[0-9]+}}
62
63; mul.ph is an R2 instruction. Check that multiply node gets expanded.
64; R1: test_mul_v2q15_:
65; R1: mul ${{[0-9]+}}
66; R1: mul ${{[0-9]+}}
67
68define { i32 } @test_mul_v2q15_(i32 %a.coerce, i32 %b.coerce) {
69entry:
70 %0 = bitcast i32 %a.coerce to <2 x i16>
71 %1 = bitcast i32 %b.coerce to <2 x i16>
72 %mul = mul <2 x i16> %0, %1
73 %2 = bitcast <2 x i16> %mul to i32
74 %.fca.0.insert = insertvalue { i32 } undef, i32 %2, 0
75 ret { i32 } %.fca.0.insert
76}
77
78; R1: test_add_v4i8_:
79; R1: addu.qb ${{[0-9]+}}
80
81define { i32 } @test_add_v4i8_(i32 %a.coerce, i32 %b.coerce) {
82entry:
83 %0 = bitcast i32 %a.coerce to <4 x i8>
84 %1 = bitcast i32 %b.coerce to <4 x i8>
85 %add = add <4 x i8> %0, %1
86 %2 = bitcast <4 x i8> %add to i32
87 %.fca.0.insert = insertvalue { i32 } undef, i32 %2, 0
88 ret { i32 } %.fca.0.insert
89}
90
91; R1: test_sub_v4i8_:
92; R1: subu.qb ${{[0-9]+}}
93
94define { i32 } @test_sub_v4i8_(i32 %a.coerce, i32 %b.coerce) {
95entry:
96 %0 = bitcast i32 %a.coerce to <4 x i8>
97 %1 = bitcast i32 %b.coerce to <4 x i8>
98 %sub = sub <4 x i8> %0, %1
99 %2 = bitcast <4 x i8> %sub to i32
100 %.fca.0.insert = insertvalue { i32 } undef, i32 %2, 0
101 ret { i32 } %.fca.0.insert
102}
103
104; DSP-ASE doesn't have a v4i8 multiply instruction. Check that multiply node gets expanded.
105; R2: test_mul_v4i8_:
106; R2: mul ${{[0-9]+}}
107; R2: mul ${{[0-9]+}}
108; R2: mul ${{[0-9]+}}
109; R2: mul ${{[0-9]+}}
110
111define { i32 } @test_mul_v4i8_(i32 %a.coerce, i32 %b.coerce) {
112entry:
113 %0 = bitcast i32 %a.coerce to <4 x i8>
114 %1 = bitcast i32 %b.coerce to <4 x i8>
115 %mul = mul <4 x i8> %0, %1
116 %2 = bitcast <4 x i8> %mul to i32
117 %.fca.0.insert = insertvalue { i32 } undef, i32 %2, 0
118 ret { i32 } %.fca.0.insert
119}
120
121; R1: test_addsc:
122; R1: addsc ${{[0-9]+}}
123; R1: addwc ${{[0-9]+}}
124
125define i64 @test_addsc(i64 %a, i64 %b) {
126entry:
127 %add = add nsw i64 %b, %a
128 ret i64 %add
129}
130