]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/commitdiff
[Hexagon] Adding encoding for popcount, fastcorner, dword asr with rounding.
authorColin LeMahieu <colinl@codeaurora.org>
Wed, 7 Jan 2015 20:07:28 +0000 (20:07 +0000)
committerColin LeMahieu <colinl@codeaurora.org>
Wed, 7 Jan 2015 20:07:28 +0000 (20:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225371 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Hexagon/HexagonISelLowering.h
lib/Target/Hexagon/HexagonInstrInfoV5.td
test/MC/Disassembler/Hexagon/cr.txt
test/MC/Disassembler/Hexagon/xtype_bit.txt
test/MC/Disassembler/Hexagon/xtype_shift.txt

index 88743df8f282dda78a15ba8e3d0d5a5fcb396afa..d03b1b8d9f4a69908872e0e6ba35eb343f82752f 100644 (file)
@@ -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,
index f2eafd95370249f0364fa441c68cc05fd8542442..876c8dbb9b109c7279b6766cedb14a28ba990422 100644 (file)
@@ -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 IntRegs:$dst),
            []>,
           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)",
index bcba0ba34c503b3c67aa04213d14cef9e08696c5..89157156cffd5caaee51acba2e810ffadbdd196b 100644 (file)
@@ -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
index 9ee340b5690008971ff65b8a8731f9223fb446f4..d1ec38e0218387a941a4ebbdd9371cb61b990a43 100644 (file)
@@ -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
index 1a0fbe418527c1b215f9f7bc52a1254941f2f81b..9912fd3f1f41db032872c6ccf1fb920fe727da13 100644 (file)
@@ -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