[llvm] r222399 - [Hexagon] Adding A2_xor instruction with IR selection pattern and test.

Colin LeMahieu colinl at codeaurora.org
Wed Nov 19 15:22:24 PST 2014


Author: colinl
Date: Wed Nov 19 17:22:23 2014
New Revision: 222399

URL: http://llvm.org/viewvc/llvm-project?rev=222399&view=rev
Log:
[Hexagon] Adding A2_xor instruction with IR selection pattern and test.

Added:
    llvm/trunk/test/MC/Hexagon/inst_xor.ll
Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
    llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp?rev=222399&r1=222398&r2=222399&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.cpp Wed Nov 19 17:22:23 2014
@@ -1307,10 +1307,12 @@ bool HexagonInstrInfo::isConditionalALU3
     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:

Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td?rev=222399&r1=222398&r2=222399&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfo.td Wed Nov 19 17:22:23 2014
@@ -165,6 +165,7 @@ defm add : T_ALU32_3op_A2<"add", 0b011,
 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<SDNode Op, InstHexagon MI, ValueType ResT>
@@ -175,6 +176,7 @@ def: BinOp32_pat<add, A2_add, i32>;
 def: BinOp32_pat<and, A2_and, i32>;
 def: BinOp32_pat<or,  A2_or,  i32>;
 def: BinOp32_pat<sub, A2_sub, i32>;
+def: BinOp32_pat<xor, A2_xor, i32>;
 
 multiclass ALU32_Pbase<string mnemonic, RegisterClass RC, bit isNot,
                        bit isPredNew> {
@@ -211,10 +213,6 @@ multiclass ALU32_base<string mnemonic, s
   }
 }
 
-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.

Added: llvm/trunk/test/MC/Hexagon/inst_xor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Hexagon/inst_xor.ll?rev=222399&view=auto
==============================================================================
--- llvm/trunk/test/MC/Hexagon/inst_xor.ll (added)
+++ llvm/trunk/test/MC/Hexagon/inst_xor.ll Wed Nov 19 17:22:23 2014
@@ -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





More information about the llvm-commits mailing list