summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Colombet <qcolombet@apple.com>2016-06-10 20:50:35 +0000
committerQuentin Colombet <qcolombet@apple.com>2016-06-10 20:50:35 +0000
commitf2a1909bb5b7f7ee85522cff3f36c69778fdbd8f (patch)
treede0d6a0b503a5c73ff7e4fe3f41dbacc7bf9bcc3
parent401d0a1ac90e1967ac41b544c9f11cc47f0c1f51 (diff)
downloadbcm5719-llvm-f2a1909bb5b7f7ee85522cff3f36c69778fdbd8f.tar.gz
bcm5719-llvm-f2a1909bb5b7f7ee85522cff3f36c69778fdbd8f.zip
[IRTranslator] Support the translation of or.
Now or instructions get translated into G_OR. llvm-svn: 272433
-rw-r--r--llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp2
-rw-r--r--llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll23
2 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index ea11b316255..f4f1906be81 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -104,6 +104,8 @@ bool IRTranslator::translate(const Instruction &Inst) {
switch(Inst.getOpcode()) {
case Instruction::Add:
return translateBinaryOp(TargetOpcode::G_ADD, Inst);
+ case Instruction::Or:
+ return translateBinaryOp(TargetOpcode::G_OR, Inst);
case Instruction::Br:
return translateBr(Inst);
case Instruction::Ret:
diff --git a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
index 8baa64df9d8..2ce035e1dc0 100644
--- a/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
+++ b/llvm/test/CodeGen/AArch64/GlobalISel/arm64-irtranslator.ll
@@ -38,3 +38,26 @@ define void @uncondbr() {
end:
ret void
}
+
+; Tests for or.
+; CHECK: name: ori64
+; CHECK: [[ARG1:%[0-9]+]](64) = COPY %x0
+; CHECK-NEXT: [[ARG2:%[0-9]+]](64) = COPY %x1
+; CHECK-NEXT: [[RES:%[0-9]+]](64) = G_OR i64 [[ARG1]], [[ARG2]]
+; CHECK-NEXT: %x0 = COPY [[RES]]
+; CHECK-NEXT: RET_ReallyLR implicit %x0
+define i64 @ori64(i64 %arg1, i64 %arg2) {
+ %res = or i64 %arg1, %arg2
+ ret i64 %res
+}
+
+; CHECK: name: ori32
+; CHECK: [[ARG1:%[0-9]+]](32) = COPY %w0
+; CHECK-NEXT: [[ARG2:%[0-9]+]](32) = COPY %w1
+; CHECK-NEXT: [[RES:%[0-9]+]](32) = G_OR i32 [[ARG1]], [[ARG2]]
+; CHECK-NEXT: %w0 = COPY [[RES]]
+; CHECK-NEXT: RET_ReallyLR implicit %w0
+define i32 @ori32(i32 %arg1, i32 %arg2) {
+ %res = or i32 %arg1, %arg2
+ ret i32 %res
+}
OpenPOWER on IntegriCloud