blob: f7fbfb1f6e6200af77f7e10dc17258f264d4b13e [file] [log] [blame]
Kai Nacke93fe5e82014-03-20 11:51:58 +00001; RUN: llc -O1 < %s -march=mips64 -mcpu=octeon | FileCheck %s -check-prefix=OCTEON
2; RUN: llc -O1 < %s -march=mips64 -mcpu=mips64 | FileCheck %s -check-prefix=MIPS64
3
Kai Nacke13673ac2014-04-02 18:40:43 +00004define i64 @addi64(i64 %a, i64 %b) nounwind {
5entry:
6; OCTEON-LABEL: addi64:
7; OCTEON: jr $ra
8; OCTEON: baddu $2, $4, $5
9; MIPS64-LABEL: addi64:
10; MIPS64: daddu
11; MIPS64: jr
12; MIPS64: andi
13 %add = add i64 %a, %b
14 %and = and i64 %add, 255
15 ret i64 %and
16}
17
Kai Nacke93fe5e82014-03-20 11:51:58 +000018define i64 @mul(i64 %a, i64 %b) nounwind {
19entry:
20; OCTEON-LABEL: mul:
21; OCTEON: jr $ra
22; OCTEON: dmul $2, $4, $5
23; MIPS64-LABEL: mul:
24; MIPS64: dmult
25; MIPS64: jr
26; MIPS64: mflo
27 %res = mul i64 %a, %b
28 ret i64 %res
29}
Kai Nacke755b6e82015-01-14 10:19:09 +000030
31define i64 @cmpeq(i64 %a, i64 %b) nounwind {
32entry:
33; OCTEON-LABEL: cmpeq:
34; OCTEON: jr $ra
35; OCTEON: seq $2, $4, $5
36; MIPS64-LABEL: cmpeq:
37; MIPS64: xor $1, $4, $5
38; MIPS64: sltiu $1, $1, 1
39; MIPS64: dsll $1, $1, 32
40; MIPS64: jr $ra
41; MIPS64: dsrl $2, $1, 32
42 %res = icmp eq i64 %a, %b
43 %res2 = zext i1 %res to i64
44 ret i64 %res2
45}
46
47define i64 @cmpeqi(i64 %a) nounwind {
48entry:
49; OCTEON-LABEL: cmpeqi:
50; OCTEON: jr $ra
51; OCTEON: seqi $2, $4, 42
52; MIPS64-LABEL: cmpeqi:
53; MIPS64: daddiu $1, $zero, 42
54; MIPS64: xor $1, $4, $1
55; MIPS64: sltiu $1, $1, 1
56; MIPS64: dsll $1, $1, 32
57; MIPS64: jr $ra
58; MIPS64: dsrl $2, $1, 32
59 %res = icmp eq i64 %a, 42
60 %res2 = zext i1 %res to i64
61 ret i64 %res2
62}
63
64define i64 @cmpne(i64 %a, i64 %b) nounwind {
65entry:
66; OCTEON-LABEL: cmpne:
67; OCTEON: jr $ra
68; OCTEON: sne $2, $4, $5
69; MIPS64-LABEL: cmpne:
70; MIPS64: xor $1, $4, $5
71; MIPS64: sltu $1, $zero, $1
72; MIPS64: dsll $1, $1, 32
73; MIPS64: jr $ra
74; MIPS64: dsrl $2, $1, 32
75 %res = icmp ne i64 %a, %b
76 %res2 = zext i1 %res to i64
77 ret i64 %res2
78}
79
80define i64 @cmpnei(i64 %a) nounwind {
81entry:
82; OCTEON-LABEL: cmpnei:
83; OCTEON: jr $ra
84; OCTEON: snei $2, $4, 42
85; MIPS64-LABEL: cmpnei:
86; MIPS64: daddiu $1, $zero, 42
87; MIPS64: xor $1, $4, $1
88; MIPS64: sltu $1, $zero, $1
89; MIPS64: dsll $1, $1, 32
90; MIPS64: jr $ra
91; MIPS64: dsrl $2, $1, 32
92 %res = icmp ne i64 %a, 42
93 %res2 = zext i1 %res to i64
94 ret i64 %res2
95}
Kai Nacke63072f82015-01-20 16:10:51 +000096
97define i64 @bbit0(i64 %a) nounwind {
98entry:
99; OCTEON-LABEL: bbit0:
100; OCTEON: bbit0 $4, 3, $[[BB0:BB[0-9_]+]]
101; MIPS64-LABEL: bbit0:
102; MIPS64: andi $[[T0:[0-9]+]], $4, 8
103; MIPS64: beqz $[[T0]], $[[BB0:BB[0-9_]+]]
104 %bit = and i64 %a, 8
105 %res = icmp eq i64 %bit, 0
106 br i1 %res, label %endif, label %if
107if:
108 ret i64 48
109
110endif:
111 ret i64 12
112}
113
114define i64 @bbit032(i64 %a) nounwind {
115entry:
116; OCTEON-LABEL: bbit032:
117; OCTEON: bbit032 $4, 3, $[[BB0:BB[0-9_]+]]
118; MIPS64-LABEL: bbit032:
119; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 1
120; MIPS64: dsll $[[T1:[0-9]+]], $[[T0]], 35
121; MIPS64: and $[[T2:[0-9]+]], $4, $[[T1]]
122; MIPS64: beqz $[[T2]], $[[BB0:BB[0-9_]+]]
123 %bit = and i64 %a, 34359738368
124 %res = icmp eq i64 %bit, 0
125 br i1 %res, label %endif, label %if
126if:
127 ret i64 48
128
129endif:
130 ret i64 12
131}
132
133define i64 @bbit1(i64 %a) nounwind {
134entry:
135; OCTEON-LABEL: bbit1:
136; OCTEON: bbit1 $4, 3, $[[BB0:BB[0-9_]+]]
137; MIPS64-LABEL: bbit1:
138; MIPS64: andi $[[T0:[0-9]+]], $4, 8
139; MIPS64: beqz $[[T0]], $[[BB0:BB[0-9_]+]]
140 %bit = and i64 %a, 8
141 %res = icmp ne i64 %bit, 0
142 br i1 %res, label %endif, label %if
143if:
144 ret i64 48
145
146endif:
147 ret i64 12
148}
149
150define i64 @bbit132(i64 %a) nounwind {
151entry:
152; OCTEON-LABEL: bbit132:
153; OCTEON: bbit132 $4, 3, $[[BB0:BB[0-9_]+]]
154; MIPS64-LABEL: bbit132:
155; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 1
156; MIPS64: dsll $[[T1:[0-9]+]], $[[T0]], 35
157; MIPS64: and $[[T2:[0-9]+]], $4, $[[T1]]
158; MIPS64: beqz $[[T2]], $[[BB0:BB[0-9_]+]]
159 %bit = and i64 %a, 34359738368
160 %res = icmp ne i64 %bit, 0
161 br i1 %res, label %endif, label %if
162if:
163 ret i64 48
164
165endif:
166 ret i64 12
167}