[llvm] r225371 - [Hexagon] Adding encoding for popcount, fastcorner, dword asr with rounding.
Colin LeMahieu
colinl at codeaurora.org
Wed Jan 7 12:07:28 PST 2015
Author: colinl
Date: Wed Jan 7 14:07:28 2015
New Revision: 225371
URL: http://llvm.org/viewvc/llvm-project?rev=225371&view=rev
Log:
[Hexagon] Adding encoding for popcount, fastcorner, dword asr with rounding.
Modified:
llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
llvm/trunk/lib/Target/Hexagon/HexagonInstrInfoV5.td
llvm/trunk/test/MC/Disassembler/Hexagon/cr.txt
llvm/trunk/test/MC/Disassembler/Hexagon/xtype_bit.txt
llvm/trunk/test/MC/Disassembler/Hexagon/xtype_shift.txt
Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h?rev=225371&r1=225370&r2=225371&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelLowering.h Wed Jan 7 14:07:28 2015
@@ -52,7 +52,8 @@ bool isPositiveHalfWord(SDNode *N);
CALL, // A call instruction.
RET_FLAG, // Return with a flag operand.
BR_JT, // Jump table.
- BARRIER, // Memory barrier.
+ BARRIER, // Memory barrier
+ POPCOUNT,
COMBINE,
WrapperJT,
WrapperCP,
Modified: llvm/trunk/lib/Target/Hexagon/HexagonInstrInfoV5.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonInstrInfoV5.td?rev=225371&r1=225370&r2=225371&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonInstrInfoV5.td (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonInstrInfoV5.td Wed Jan 7 14:07:28 2015
@@ -1,3 +1,42 @@
+//=- HexagonInstrInfoV5.td - Target Desc. for Hexagon Target -*- tablegen -*-=//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file describes the Hexagon V5 instructions in TableGen format.
+//
+//===----------------------------------------------------------------------===//
+
+//===----------------------------------------------------------------------===//
+// XTYPE/MPY
+//===----------------------------------------------------------------------===//
+
+let isCodeGenOnly = 0 in
+def S2_asr_i_p_rnd : S_2OpInstImm<"asr", 0b110, 0b111, u6Imm,
+ [(set I64:$dst,
+ (sra (i64 (add (i64 (sra I64:$src1, u6ImmPred:$src2)), 1)),
+ (i32 1)))], 1>,
+ Requires<[HasV5T]> {
+ bits<6> src2;
+ let Inst{13-8} = src2;
+}
+
+let isCodeGenOnly = 0 in
+def C4_fastcorner9 : T_LOGICAL_2OP<"fastcorner9", 0b000, 0, 0>,
+ Requires<[HasV5T]> {
+ let Inst{13,7,4} = 0b111;
+}
+
+let isCodeGenOnly = 0 in
+def C4_fastcorner9_not : T_LOGICAL_2OP<"!fastcorner9", 0b000, 0, 0>,
+ Requires<[HasV5T]> {
+ let Inst{20,13,7,4} = 0b1111;
+}
+
def SDTHexagonFCONST32 : SDTypeProfile<1, 1, [
SDTCisVT<0, f32>,
SDTCisPtrTy<1>]>;
@@ -52,6 +91,27 @@ def TFRI_cNotPt_f : ALU32_ri<(outs IntRe
[]>,
Requires<[HasV5T]>;
+def SDTHexagonI32I64: SDTypeProfile<1, 1, [SDTCisVT<0, i32>,
+ SDTCisVT<1, i64>]>;
+
+def HexagonPOPCOUNT: SDNode<"HexagonISD::POPCOUNT", SDTHexagonI32I64>;
+
+let hasNewValue = 1, validSubTargets = HasV5SubT, isCodeGenOnly = 0 in
+def S5_popcountp : ALU64_rr<(outs IntRegs:$Rd), (ins DoubleRegs:$Rss),
+ "$Rd = popcount($Rss)",
+ [(set I32:$Rd, (HexagonPOPCOUNT I64:$Rss))], "", S_2op_tc_2_SLOT23>,
+ Requires<[HasV5T]> {
+ bits<5> Rd;
+ bits<5> Rss;
+
+ let IClass = 0b1000;
+
+ let Inst{27-21} = 0b1000011;
+ let Inst{7-5} = 0b011;
+ let Inst{4-0} = Rd;
+ let Inst{20-16} = Rss;
+ }
+
// Convert single precision to double precision and vice-versa.
def CONVERT_sf2df : ALU64_rr<(outs DoubleRegs:$dst), (ins IntRegs:$src),
"$dst = convert_sf2df($src)",
Modified: llvm/trunk/test/MC/Disassembler/Hexagon/cr.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/Hexagon/cr.txt?rev=225371&r1=225370&r2=225371&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/Hexagon/cr.txt (original)
+++ llvm/trunk/test/MC/Disassembler/Hexagon/cr.txt Wed Jan 7 14:07:28 2015
@@ -1,5 +1,9 @@
# RUN: llvm-mc --triple hexagon -disassemble < %s | FileCheck %s
+0x93 0xe1 0x12 0x6b
+# CHECK: p3 = !fastcorner9(p2, p1)
+0x91 0xe3 0x02 0x6b
+# CHECK: p1 = fastcorner9(p2, p3)
0x01 0xc0 0x82 0x6b
# CHECK: p1 = any8(p2)
0x01 0xc0 0xa2 0x6b
Modified: llvm/trunk/test/MC/Disassembler/Hexagon/xtype_bit.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/Hexagon/xtype_bit.txt?rev=225371&r1=225370&r2=225371&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/Hexagon/xtype_bit.txt (original)
+++ llvm/trunk/test/MC/Disassembler/Hexagon/xtype_bit.txt Wed Jan 7 14:07:28 2015
@@ -20,6 +20,8 @@
# CHECK: r17 = cl1(r21)
0xf1 0xc0 0x15 0x8c
# CHECK: r17 = normamt(r21)
+0x71 0xc0 0x74 0x88
+# CHECK: r17 = popcount(r21:20)
0x51 0xc0 0xf4 0x88
# CHECK: r17 = ct0(r21:20)
0x91 0xc0 0xf4 0x88
Modified: llvm/trunk/test/MC/Disassembler/Hexagon/xtype_shift.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Disassembler/Hexagon/xtype_shift.txt?rev=225371&r1=225370&r2=225371&view=diff
==============================================================================
--- llvm/trunk/test/MC/Disassembler/Hexagon/xtype_shift.txt (original)
+++ llvm/trunk/test/MC/Disassembler/Hexagon/xtype_shift.txt Wed Jan 7 14:07:28 2015
@@ -86,6 +86,8 @@
# CHECK: r17 ^= lsr(r21, #31)
0x51 0xdf 0x95 0x8e
# CHECK: r17 ^= asl(r21, #31)
+0xf0 0xdf 0xd4 0x80
+# CHECK: r17:16 = asr(r21:20, #31):rnd
0x11 0xdf 0x55 0x8c
# CHECK: r17 = asr(r21, #31):rnd
0x51 0xdf 0x55 0x8c
More information about the llvm-commits
mailing list