[Hexagon] Adding encoding for popcount, fastcorner, dword asr with rounding.

llvm-svn: 225371
This commit is contained in:
Colin LeMahieu 2015-01-07 20:07:28 +00:00
parent cf5b7b89ba
commit bb38f7d496
5 changed files with 70 additions and 1 deletions

View 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,

View 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)",

View 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

View 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

View 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