From fb1c650fd0b497a4b742615ed46a040f769c476a Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Wed, 19 Nov 2014 22:58:04 +0000 Subject: [PATCH] [Hexagon] Adding A2_or instruction with IR selection pattern and test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222396 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/HexagonInstrInfo.cpp | 6 ++++-- lib/Target/Hexagon/HexagonInstrInfo.td | 3 ++- test/MC/Hexagon/inst_or.ll | 10 ++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 test/MC/Hexagon/inst_or.ll diff --git a/lib/Target/Hexagon/HexagonInstrInfo.cpp b/lib/Target/Hexagon/HexagonInstrInfo.cpp index c320575ae68..13e1e6dd27a 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -1303,12 +1303,14 @@ bool HexagonInstrInfo::isConditionalALU32 (const MachineInstr* MI) const { case Hexagon::A2_pandfnew: case Hexagon::A2_pandt: case Hexagon::A2_pandtnew: + case Hexagon::A2_porf: + case Hexagon::A2_porfnew: + case Hexagon::A2_port: + case Hexagon::A2_portnew: case Hexagon::ADD_ri_cPt: case Hexagon::ADD_ri_cNotPt: case Hexagon::XOR_rr_cPt: case Hexagon::XOR_rr_cNotPt: - case Hexagon::OR_rr_cPt: - case Hexagon::OR_rr_cNotPt: case Hexagon::SUB_rr_cPt: case Hexagon::SUB_rr_cNotPt: case Hexagon::COMBINE_rr_cPt: diff --git a/lib/Target/Hexagon/HexagonInstrInfo.td b/lib/Target/Hexagon/HexagonInstrInfo.td index 826b76e36fc..9238e816317 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.td +++ b/lib/Target/Hexagon/HexagonInstrInfo.td @@ -163,6 +163,7 @@ multiclass T_ALU32_3op_A2 MajOp, bits<3> MinOp, let isCodeGenOnly = 0 in defm add : T_ALU32_3op_A2<"add", 0b011, 0b000, 0, 1>; defm and : T_ALU32_3op_A2<"and", 0b001, 0b000, 0, 1>; +defm or : T_ALU32_3op_A2<"or", 0b001, 0b001, 0, 1>; defm sub : T_ALU32_3op_A2<"sub", 0b011, 0b001, 1, 0>; // Pats for instruction selection. @@ -172,6 +173,7 @@ class BinOp32_pat def: BinOp32_pat; def: BinOp32_pat; +def: BinOp32_pat; def: BinOp32_pat; multiclass ALU32_Pbase { let isCommutable = 1 in { defm XOR_rr : ALU32_base<"xor", "XOR", xor>, ImmRegRel, PredNewRel; - defm OR_rr : ALU32_base<"or", "OR", or>, ImmRegRel, PredNewRel; } defm SUB_rr : ALU32_base<"sub", "SUB", sub>, ImmRegRel, PredNewRel; diff --git a/test/MC/Hexagon/inst_or.ll b/test/MC/Hexagon/inst_or.ll new file mode 100644 index 00000000000..fe8152b31f4 --- /dev/null +++ b/test/MC/Hexagon/inst_or.ll @@ -0,0 +1,10 @@ +;; RUN: llc -mtriple=hexagon-unknown-elf -filetype=obj %s -o - \ +;; RUN: | llvm-objdump -s - | FileCheck %s + +define i32 @foo (i32 %a, i32 %b) +{ + %1 = or i32 %a, %b + ret i32 %1 +} + +; CHECK: 0000 004120f1 00c09f52 \ No newline at end of file