Skip to content

Commit 5d171fc

Browse files
author
Jozef Kolek
committedFeb 19, 2015
[mips][microMIPS] Make usage of AND16, OR16 and XOR16 by code generator
Differential Revision: http://reviews.llvm.org/D7611 llvm-svn: 229845
1 parent 38dea42 commit 5d171fc

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed
 

‎llvm/lib/Target/Mips/MipsInstrInfo.td

+2
Original file line numberDiff line numberDiff line change
@@ -1154,12 +1154,14 @@ def ADD : MMRel, ArithLogicR<"add", GPR32Opnd>, ADD_FM<0, 0x20>;
11541154
def SUB : MMRel, ArithLogicR<"sub", GPR32Opnd>, ADD_FM<0, 0x22>;
11551155
def SLT : MMRel, SetCC_R<"slt", setlt, GPR32Opnd>, ADD_FM<0, 0x2a>;
11561156
def SLTu : MMRel, SetCC_R<"sltu", setult, GPR32Opnd>, ADD_FM<0, 0x2b>;
1157+
let AdditionalPredicates = [NotInMicroMips] in {
11571158
def AND : MMRel, ArithLogicR<"and", GPR32Opnd, 1, II_AND, and>,
11581159
ADD_FM<0, 0x24>;
11591160
def OR : MMRel, ArithLogicR<"or", GPR32Opnd, 1, II_OR, or>,
11601161
ADD_FM<0, 0x25>;
11611162
def XOR : MMRel, ArithLogicR<"xor", GPR32Opnd, 1, II_XOR, xor>,
11621163
ADD_FM<0, 0x26>;
1164+
}
11631165
def NOR : MMRel, LogicNOR<"nor", GPR32Opnd>, ADD_FM<0, 0x27>;
11641166

11651167
/// Shift Instructions
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
2+
; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
3+
4+
define i32 @main() {
5+
entry:
6+
%retval = alloca i32, align 4
7+
%a = alloca i32, align 4
8+
%b = alloca i32, align 4
9+
%c = alloca i32, align 4
10+
store i32 0, i32* %retval
11+
%0 = load i32* %b, align 4
12+
%1 = load i32* %c, align 4
13+
%and = and i32 %0, %1
14+
store i32 %and, i32* %a, align 4
15+
ret i32 0
16+
}
17+
18+
; CHECK: and16
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
2+
; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
3+
4+
define i32 @main() {
5+
entry:
6+
%retval = alloca i32, align 4
7+
%a = alloca i32, align 4
8+
%b = alloca i32, align 4
9+
%c = alloca i32, align 4
10+
store i32 0, i32* %retval
11+
%0 = load i32* %b, align 4
12+
%1 = load i32* %c, align 4
13+
%or = or i32 %0, %1
14+
store i32 %or, i32* %a, align 4
15+
ret i32 0
16+
}
17+
18+
; CHECK: or16
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
; RUN: llc -march=mipsel -mcpu=mips32r2 -mattr=+micromips \
2+
; RUN: -relocation-model=pic -O3 < %s | FileCheck %s
3+
4+
define i32 @main() {
5+
entry:
6+
%retval = alloca i32, align 4
7+
%a = alloca i32, align 4
8+
%b = alloca i32, align 4
9+
%c = alloca i32, align 4
10+
store i32 0, i32* %retval
11+
%0 = load i32* %b, align 4
12+
%1 = load i32* %c, align 4
13+
%xor = xor i32 %0, %1
14+
store i32 %xor, i32* %a, align 4
15+
ret i32 0
16+
}
17+
18+
; CHECK: xor16

0 commit comments

Comments
 (0)
Please sign in to comment.