Skip to content

Commit 128c43f

Browse files
committed
Add AND
1 parent e507e3f commit 128c43f

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

llvm/lib/Target/Fero/FeroInstrInfo.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ def MOV_indirect : Type3Inst<(outs GPR:$Ra), (ins MEMroffset:$Rb), 0b0011101, 1,
133133
def ADD : Type3Inst<(outs GPR:$Ra), (ins GPR:$Rai, GPR:$Rb), 0b0011010, 0, "add", "$Ra, $Rb", "$Ra = $Rai">;
134134
def SUB : Type3Inst<(outs GPR:$Ra), (ins GPR:$Rai, GPR:$Rb), 0b0011101, 0, "sub", "$Ra, $Rb", "$Ra = $Rai">;
135135
def CMP : Type2Inst<(outs FR:$f), (ins GPR:$Ra, GPR:$Rb), 0b0000010, 0, "cmp", "$Ra, $Rb", "">;
136+
def AND : Type2Inst<(outs GPR:$Ra), (ins GPR:$Rai, GPR:$Rb), 0b0000011, 0, "and", "$Ra, $Rb", "$Ra = $Rai">;
136137
def OR : Type3Inst<(outs GPR:$Ra), (ins GPR:$Rai, GPR:$Rb), 0b0100000, 0, "or", "$Ra, $Rb", "$Ra = $Rai">;
137138
def STR : Type3Inst<(outs), (ins MEMroffset:$Ra, GPR:$Rb), 0b0100001, 0, "str", "$Ra, $Rb", "">;
138139

@@ -166,3 +167,4 @@ def : Pat<(add GPR:$Ra, GPR:$Rb), (ADD GPR:$Ra, GPR:$Rb)>;
166167
def : Pat<(sub GPR:$Ra, GPR:$Rb), (SUB GPR:$Ra, GPR:$Rb)>;
167168
def : Pat<(store GPR:$Rb, GPR:$Ra), (STR GPR:$Ra, (i16 0), GPR:$Rb)>;
168169
def : Pat<(or GPR:$Ra, GPR:$Rb), (OR GPR:$Ra, GPR:$Rb)>;
170+
def : Pat<(and GPR:$Ra, GPR:$Rb), (AND GPR:$Ra, GPR:$Rb)>;

llvm/test/CodeGen/Fero/simple.ll

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,13 @@ if.then: ; preds = %entry
107107
if.end: ; preds = %if.then, %entry
108108
ret void
109109
}
110+
111+
define i16 @and(i16 %a, i16 %b) {
112+
entry:
113+
; CHECK-LABEL: and:
114+
; CHECK: and r1, r0
115+
; CHECK-NEXT: mov r0, r1
116+
; CHECK-NEXT: ret
117+
%and = and i16 %b, %a
118+
ret i16 %and
119+
}

0 commit comments

Comments
 (0)