From: Colin LeMahieu Date: Wed, 26 Nov 2014 18:55:59 +0000 (+0000) Subject: [Hexagon] Adding and64, or64, and xor64 instructions. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1df05cd7b664a8a120dc02e53b001344f7618d63;p=oota-llvm.git [Hexagon] Adding and64, or64, and xor64 instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222846 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Hexagon/HexagonInstrInfo.td b/lib/Target/Hexagon/HexagonInstrInfo.td index 925adc5162d..5dfb13c629c 100644 --- a/lib/Target/Hexagon/HexagonInstrInfo.td +++ b/lib/Target/Hexagon/HexagonInstrInfo.td @@ -701,6 +701,19 @@ def A2_subp : T_ALU64_arith<"sub", 0b001, 0b111, 0, 1, 0>; def: Pat<(i64 (add I64:$Rs, I64:$Rt)), (A2_addp I64:$Rs, I64:$Rt)>; def: Pat<(i64 (sub I64:$Rs, I64:$Rt)), (A2_subp I64:$Rs, I64:$Rt)>; +class T_ALU64_logical MinOp, bit OpsRev, bit IsComm, + bit IsNeg> + : T_ALU64_rr; + +def A2_andp : T_ALU64_logical<"and", 0b000, 0, 1, 0>; +def A2_orp : T_ALU64_logical<"or", 0b010, 0, 1, 0>; +def A2_xorp : T_ALU64_logical<"xor", 0b100, 0, 1, 0>; + +def: Pat<(i64 (and I64:$Rs, I64:$Rt)), (A2_andp I64:$Rs, I64:$Rt)>; +def: Pat<(i64 (or I64:$Rs, I64:$Rt)), (A2_orp I64:$Rs, I64:$Rt)>; +def: Pat<(i64 (xor I64:$Rs, I64:$Rt)), (A2_xorp I64:$Rs, I64:$Rt)>; + // Patfrag to convert the usual comparison patfrags (e.g. setlt) to ones // that reverse the order of the operands. class RevCmp : PatFrag<(ops node:$rhs, node:$lhs), F.Fragment>; diff --git a/test/MC/Hexagon/inst_and64.ll b/test/MC/Hexagon/inst_and64.ll new file mode 100644 index 00000000000..0b830746326 --- /dev/null +++ b/test/MC/Hexagon/inst_and64.ll @@ -0,0 +1,10 @@ +;; RUN: llc -mtriple=hexagon-unknown-elf -filetype=obj %s -o - \ +;; RUN: | llvm-objdump -s - | FileCheck %s + +define i64 @foo (i64 %a, i64 %b) +{ + %1 = and i64 %a, %b + ret i64 %1 +} + +; CHECK: 0000 0042e0d3 00c09f52 diff --git a/test/MC/Hexagon/inst_or64.ll b/test/MC/Hexagon/inst_or64.ll new file mode 100644 index 00000000000..ea104300da3 --- /dev/null +++ b/test/MC/Hexagon/inst_or64.ll @@ -0,0 +1,10 @@ +;; RUN: llc -mtriple=hexagon-unknown-elf -filetype=obj %s -o - \ +;; RUN: | llvm-objdump -s - | FileCheck %s + +define i64 @foo (i64 %a, i64 %b) +{ + %1 = or i64 %a, %b + ret i64 %1 +} + +; CHECK: 0000 4042e0d3 00c09f52 diff --git a/test/MC/Hexagon/inst_xor64.ll b/test/MC/Hexagon/inst_xor64.ll new file mode 100644 index 00000000000..7f77c4614cf --- /dev/null +++ b/test/MC/Hexagon/inst_xor64.ll @@ -0,0 +1,10 @@ +;; RUN: llc -mtriple=hexagon-unknown-elf -filetype=obj %s -o - \ +;; RUN: | llvm-objdump -s - | FileCheck %s + +define i64 @foo (i64 %a, i64 %b) +{ + %1 = xor i64 %a, %b + ret i64 %1 +} + +; CHECK: 0000 8042e0d3 00c09f52