1 ; RUN: llc -O1 < %s -march=mips64 -mcpu=octeon | FileCheck %s -check-prefix=ALL -check-prefix=OCTEON
2 ; RUN: llc -O1 < %s -march=mips64 -mcpu=mips64 | FileCheck %s -check-prefix=ALL -check-prefix=MIPS64
4 define i64 @addi64(i64 %a, i64 %b) nounwind {
8 ; OCTEON: baddu $2, $4, $5
9 ; MIPS64: daddu $[[T0:[0-9]+]], $4, $5
11 ; MIPS64: andi $2, $[[T0]], 255
13 %and = and i64 %add, 255
17 define i64 @mul(i64 %a, i64 %b) nounwind {
21 ; OCTEON: dmul $2, $4, $5
22 ; MIPS64: dmult $4, $5
29 define i64 @cmpeq(i64 %a, i64 %b) nounwind {
33 ; OCTEON: seq $2, $4, $5
34 ; MIPS64: xor $[[T0:[0-9]+]], $4, $5
35 ; MIPS64: sltiu $[[T1:[0-9]+]], $[[T0]], 1
36 ; MIPS64: dsll $[[T2:[0-9]+]], $[[T1]], 32
38 ; MIPS64: dsrl $2, $[[T2]], 32
39 %res = icmp eq i64 %a, %b
40 %res2 = zext i1 %res to i64
44 define i64 @cmpeqi(i64 %a) nounwind {
48 ; OCTEON: seqi $2, $4, 42
49 ; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 42
50 ; MIPS64: xor $[[T1:[0-9]+]], $4, $[[T0]]
51 ; MIPS64: sltiu $[[T2:[0-9]+]], $[[T1]], 1
52 ; MIPS64: dsll $[[T3:[0-9]+]], $[[T2]], 32
54 ; MIPS64: dsrl $2, $[[T3]], 32
55 %res = icmp eq i64 %a, 42
56 %res2 = zext i1 %res to i64
60 define i64 @cmpne(i64 %a, i64 %b) nounwind {
64 ; OCTEON: sne $2, $4, $5
65 ; MIPS64: xor $[[T0:[0-9]+]], $4, $5
66 ; MIPS64: sltu $[[T1:[0-9]+]], $zero, $[[T0]]
67 ; MIPS64: dsll $[[T2:[0-9]+]], $[[T1]], 32
69 ; MIPS64: dsrl $2, $[[T2]], 32
70 %res = icmp ne i64 %a, %b
71 %res2 = zext i1 %res to i64
75 define i64 @cmpnei(i64 %a) nounwind {
79 ; OCTEON: snei $2, $4, 42
80 ; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 42
81 ; MIPS64: xor $[[T1:[0-9]+]], $4, $[[T0]]
82 ; MIPS64: sltu $[[T2:[0-9]+]], $zero, $[[T1]]
83 ; MIPS64: dsll $[[T3:[0-9]+]], $[[T2]], 32
85 ; MIPS64: dsrl $2, $[[T3]], 32
86 %res = icmp ne i64 %a, 42
87 %res2 = zext i1 %res to i64
91 define i64 @bbit0(i64 %a) nounwind {
94 ; OCTEON: bbit0 $4, 3, $[[BB0:BB[0-9_]+]]
95 ; MIPS64: andi $[[T0:[0-9]+]], $4, 8
96 ; MIPS64: bnez $[[T0]], $[[BB0:BB[0-9_]+]]
98 %res = icmp eq i64 %bit, 0
99 br i1 %res, label %endif, label %if
107 define i64 @bbit032(i64 %a) nounwind {
109 ; ALL-LABEL: bbit032:
110 ; OCTEON: bbit032 $4, 3, $[[BB0:BB[0-9_]+]]
111 ; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 1
112 ; MIPS64: dsll $[[T1:[0-9]+]], $[[T0]], 35
113 ; MIPS64: and $[[T2:[0-9]+]], $4, $[[T1]]
114 ; MIPS64: bnez $[[T2]], $[[BB0:BB[0-9_]+]]
115 %bit = and i64 %a, 34359738368
116 %res = icmp eq i64 %bit, 0
117 br i1 %res, label %endif, label %if
125 define i64 @bbit1(i64 %a) nounwind {
128 ; OCTEON: bbit1 $4, 3, $[[BB0:BB[0-9_]+]]
129 ; MIPS64: andi $[[T0:[0-9]+]], $4, 8
130 ; MIPS64: beqz $[[T0]], $[[BB0:BB[0-9_]+]]
132 %res = icmp ne i64 %bit, 0
133 br i1 %res, label %endif, label %if
141 define i64 @bbit132(i64 %a) nounwind {
143 ; ALL-LABEL: bbit132:
144 ; OCTEON: bbit132 $4, 3, $[[BB0:BB[0-9_]+]]
145 ; MIPS64: daddiu $[[T0:[0-9]+]], $zero, 1
146 ; MIPS64: dsll $[[T1:[0-9]+]], $[[T0]], 35
147 ; MIPS64: and $[[T2:[0-9]+]], $4, $[[T1]]
148 ; MIPS64: beqz $[[T2]], $[[BB0:BB[0-9_]+]]
149 %bit = and i64 %a, 34359738368
150 %res = icmp ne i64 %bit, 0
151 br i1 %res, label %endif, label %if