[mips] Refine octeon instructions seq/seqi/sne/snei
[oota-llvm.git] / test / CodeGen / Mips / octeon.ll
1 ; 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
4 define i64 @addi64(i64 %a, i64 %b) nounwind {
5 entry:
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
18 define i64 @mul(i64 %a, i64 %b) nounwind {
19 entry:
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 }
30
31 define i64 @cmpeq(i64 %a, i64 %b) nounwind {
32 entry:
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
47 define i64 @cmpeqi(i64 %a) nounwind {
48 entry:
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
64 define i64 @cmpne(i64 %a, i64 %b) nounwind {
65 entry:
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
80 define i64 @cmpnei(i64 %a) nounwind {
81 entry:
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 }