From e8cdd171f9c56b35872847f1e37a570833fb97e9 Mon Sep 17 00:00:00 2001 From: Colin LeMahieu Date: Wed, 19 Nov 2014 23:22:23 +0000 Subject: [PATCH] [Hexagon] Adding A2_xor instruction with IR selection pattern and test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222399 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Hexagon/HexagonInstrInfo.cpp | 6 ++++-- lib/Target/Hexagon/HexagonInstrInfo.td | 6 ++---- test/MC/Hexagon/inst_xor.ll | 10 ++++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 test/MC/Hexagon/inst_xor.ll diff --git a/lib/Target/Hexagon/HexagonInstrInfo.cpp b/lib/Target/Hexagon/HexagonInstrInfo.cpp index 13e1e6dd27a..1688c4ad3fb 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.cpp +++ b/lib/Target/Hexagon/HexagonInstrInfo.cpp @@ -1307,10 +1307,12 @@ bool HexagonInstrInfo::isConditionalALU32 (const MachineInstr* MI) const { case Hexagon::A2_porfnew: case Hexagon::A2_port: case Hexagon::A2_portnew: + case Hexagon::A2_pxorf: + case Hexagon::A2_pxorfnew: + case Hexagon::A2_pxort: + case Hexagon::A2_pxortnew: case Hexagon::ADD_ri_cPt: case Hexagon::ADD_ri_cNotPt: - case Hexagon::XOR_rr_cPt: - case Hexagon::XOR_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 9238e816317..4090681c30d 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.td +++ b/lib/Target/Hexagon/HexagonInstrInfo.td @@ -165,6 +165,7 @@ 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>; +defm xor : T_ALU32_3op_A2<"xor", 0b001, 0b011, 0, 1>; // Pats for instruction selection. class BinOp32_pat @@ -175,6 +176,7 @@ def: BinOp32_pat; def: BinOp32_pat; def: BinOp32_pat; def: BinOp32_pat; +def: BinOp32_pat; multiclass ALU32_Pbase { @@ -211,10 +213,6 @@ multiclass ALU32_base { } } -let isCommutable = 1 in { - defm XOR_rr : ALU32_base<"xor", "XOR", xor>, ImmRegRel, PredNewRel; -} - defm SUB_rr : ALU32_base<"sub", "SUB", sub>, ImmRegRel, PredNewRel; // Combines the two integer registers SRC1 and SRC2 into a double register. diff --git a/test/MC/Hexagon/inst_xor.ll b/test/MC/Hexagon/inst_xor.ll new file mode 100644 index 00000000000..fe989e50385 --- /dev/null +++ b/test/MC/Hexagon/inst_xor.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 = xor i32 %a, %b + ret i32 %1 +} + +; CHECK: 0000 004160f1 00c09f52 \ No newline at end of file -- 2.34.1