From f98f2ce29e6e2996fa58f38979143eceaa818335 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Tue, 11 Dec 2012 21:25:42 +0000 Subject: Add R600 backend A new backend supporting AMD GPUs: Radeon HD2XXX - HD7XXX git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169915 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 589 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 589 insertions(+) create mode 100644 lib/Target/R600/SIInstrInfo.td (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td new file mode 100644 index 0000000000..873a451e99 --- /dev/null +++ b/lib/Target/R600/SIInstrInfo.td @@ -0,0 +1,589 @@ +//===-- SIInstrInfo.td - SI Instruction Encodings ---------*- tablegen -*--===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +//===----------------------------------------------------------------------===// +// SI DAG Profiles +//===----------------------------------------------------------------------===// +def SDTVCCBinaryOp : SDTypeProfile<1, 2, [ + SDTCisInt<0>, SDTCisInt<1>, SDTCisSameAs<1, 2> +]>; + +//===----------------------------------------------------------------------===// +// SI DAG Nodes +//===----------------------------------------------------------------------===// + +// and operation on 64-bit wide vcc +def SIsreg1_and : SDNode<"SIISD::VCC_AND", SDTVCCBinaryOp, + [SDNPCommutative, SDNPAssociative] +>; + +// Special bitcast node for sharing VCC register between VALU and SALU +def SIsreg1_bitcast : SDNode<"SIISD::VCC_BITCAST", + SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]> +>; + +// and operation on 64-bit wide vcc +def SIvcc_and : SDNode<"SIISD::VCC_AND", SDTVCCBinaryOp, + [SDNPCommutative, SDNPAssociative] +>; + +// Special bitcast node for sharing VCC register between VALU and SALU +def SIvcc_bitcast : SDNode<"SIISD::VCC_BITCAST", + SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]> +>; + +class InstSI pattern> : + AMDGPUInst { + + field bits<4> EncodingType = 0; + field bits<1> NeedWait = 0; + + let TSFlags{3-0} = EncodingType; + let TSFlags{4} = NeedWait; + +} + +class Enc32 pattern> : + InstSI { + + field bits<32> Inst; +} + +class Enc64 pattern> : + InstSI { + + field bits<64> Inst; +} + +class SIOperand : Operand { + let EncoderMethod = "encodeOperand"; + let MIOperandInfo = opInfo; +} + +def IMM16bit : ImmLeaf < + i16, + [{return isInt<16>(Imm);}] +>; + +def IMM8bit : ImmLeaf < + i32, + [{return (int32_t)Imm >= 0 && (int32_t)Imm <= 0xff;}] +>; + +def IMM12bit : ImmLeaf < + i16, + [{return (int16_t)Imm >= 0 && (int16_t)Imm <= 0xfff;}] +>; + +def IMM32bitIn64bit : ImmLeaf < + i64, + [{return isInt<32>(Imm);}] +>; + +class GPR4Align : Operand { + let EncoderMethod = "GPR4AlignEncode"; + let MIOperandInfo = (ops rc:$reg); +} + +class GPR2Align : Operand { + let EncoderMethod = "GPR2AlignEncode"; + let MIOperandInfo = (ops rc:$reg); +} + +def SMRDmemrr : Operand { + let MIOperandInfo = (ops SReg_64, SReg_32); + let EncoderMethod = "GPR2AlignEncode"; +} + +def SMRDmemri : Operand { + let MIOperandInfo = (ops SReg_64, i32imm); + let EncoderMethod = "SMRDmemriEncode"; +} + +def ADDR_Reg : ComplexPattern; +def ADDR_Offset8 : ComplexPattern; + +let Uses = [EXEC] in { + +def EXP : Enc64< + (outs), + (ins i32imm:$en, i32imm:$tgt, i32imm:$compr, i32imm:$done, i32imm:$vm, + VReg_32:$src0, VReg_32:$src1, VReg_32:$src2, VReg_32:$src3), + "EXP $en, $tgt, $compr, $done, $vm, $src0, $src1, $src2, $src3", + [] > { + + bits<4> EN; + bits<6> TGT; + bits<1> COMPR; + bits<1> DONE; + bits<1> VM; + bits<8> VSRC0; + bits<8> VSRC1; + bits<8> VSRC2; + bits<8> VSRC3; + + let Inst{3-0} = EN; + let Inst{9-4} = TGT; + let Inst{10} = COMPR; + let Inst{11} = DONE; + let Inst{12} = VM; + let Inst{31-26} = 0x3e; + let Inst{39-32} = VSRC0; + let Inst{47-40} = VSRC1; + let Inst{55-48} = VSRC2; + let Inst{63-56} = VSRC3; + let EncodingType = 0; //SIInstrEncodingType::EXP + + let NeedWait = 1; + let usesCustomInserter = 1; +} + +class MIMG op, dag outs, dag ins, string asm, list pattern> : + Enc64 { + + bits<8> VDATA; + bits<4> DMASK; + bits<1> UNORM; + bits<1> GLC; + bits<1> DA; + bits<1> R128; + bits<1> TFE; + bits<1> LWE; + bits<1> SLC; + bits<8> VADDR; + bits<5> SRSRC; + bits<5> SSAMP; + + let Inst{11-8} = DMASK; + let Inst{12} = UNORM; + let Inst{13} = GLC; + let Inst{14} = DA; + let Inst{15} = R128; + let Inst{16} = TFE; + let Inst{17} = LWE; + let Inst{24-18} = op; + let Inst{25} = SLC; + let Inst{31-26} = 0x3c; + let Inst{39-32} = VADDR; + let Inst{47-40} = VDATA; + let Inst{52-48} = SRSRC; + let Inst{57-53} = SSAMP; + + let EncodingType = 2; //SIInstrEncodingType::MIMG + + let NeedWait = 1; + let usesCustomInserter = 1; +} + +class MTBUF op, dag outs, dag ins, string asm, list pattern> : + Enc64 { + + bits<8> VDATA; + bits<12> OFFSET; + bits<1> OFFEN; + bits<1> IDXEN; + bits<1> GLC; + bits<1> ADDR64; + bits<4> DFMT; + bits<3> NFMT; + bits<8> VADDR; + bits<5> SRSRC; + bits<1> SLC; + bits<1> TFE; + bits<8> SOFFSET; + + let Inst{11-0} = OFFSET; + let Inst{12} = OFFEN; + let Inst{13} = IDXEN; + let Inst{14} = GLC; + let Inst{15} = ADDR64; + let Inst{18-16} = op; + let Inst{22-19} = DFMT; + let Inst{25-23} = NFMT; + let Inst{31-26} = 0x3a; //encoding + let Inst{39-32} = VADDR; + let Inst{47-40} = VDATA; + let Inst{52-48} = SRSRC; + let Inst{54} = SLC; + let Inst{55} = TFE; + let Inst{63-56} = SOFFSET; + let EncodingType = 3; //SIInstrEncodingType::MTBUF + + let NeedWait = 1; + let usesCustomInserter = 1; + let neverHasSideEffects = 1; +} + +class MUBUF op, dag outs, dag ins, string asm, list pattern> : + Enc64 { + + bits<8> VDATA; + bits<12> OFFSET; + bits<1> OFFEN; + bits<1> IDXEN; + bits<1> GLC; + bits<1> ADDR64; + bits<1> LDS; + bits<8> VADDR; + bits<5> SRSRC; + bits<1> SLC; + bits<1> TFE; + bits<8> SOFFSET; + + let Inst{11-0} = OFFSET; + let Inst{12} = OFFEN; + let Inst{13} = IDXEN; + let Inst{14} = GLC; + let Inst{15} = ADDR64; + let Inst{16} = LDS; + let Inst{24-18} = op; + let Inst{31-26} = 0x38; //encoding + let Inst{39-32} = VADDR; + let Inst{47-40} = VDATA; + let Inst{52-48} = SRSRC; + let Inst{54} = SLC; + let Inst{55} = TFE; + let Inst{63-56} = SOFFSET; + let EncodingType = 4; //SIInstrEncodingType::MUBUF + + let NeedWait = 1; + let usesCustomInserter = 1; + let neverHasSideEffects = 1; +} + +} // End Uses = [EXEC] + +class SMRD op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<7> SDST; + bits<15> PTR; + bits<8> OFFSET = PTR{7-0}; + bits<1> IMM = PTR{8}; + bits<6> SBASE = PTR{14-9}; + + let Inst{7-0} = OFFSET; + let Inst{8} = IMM; + let Inst{14-9} = SBASE; + let Inst{21-15} = SDST; + let Inst{26-22} = op; + let Inst{31-27} = 0x18; //encoding + let EncodingType = 5; //SIInstrEncodingType::SMRD + + let NeedWait = 1; + let usesCustomInserter = 1; +} + +class SOP1 op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<7> SDST; + bits<8> SSRC0; + + let Inst{7-0} = SSRC0; + let Inst{15-8} = op; + let Inst{22-16} = SDST; + let Inst{31-23} = 0x17d; //encoding; + let EncodingType = 6; //SIInstrEncodingType::SOP1 + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class SOP2 op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<7> SDST; + bits<8> SSRC0; + bits<8> SSRC1; + + let Inst{7-0} = SSRC0; + let Inst{15-8} = SSRC1; + let Inst{22-16} = SDST; + let Inst{29-23} = op; + let Inst{31-30} = 0x2; // encoding + let EncodingType = 7; // SIInstrEncodingType::SOP2 + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class SOPC op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<8> SSRC0; + bits<8> SSRC1; + + let Inst{7-0} = SSRC0; + let Inst{15-8} = SSRC1; + let Inst{22-16} = op; + let Inst{31-23} = 0x17e; + let EncodingType = 8; // SIInstrEncodingType::SOPC + + let DisableEncoding = "$dst"; + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class SOPK op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits <7> SDST; + bits <16> SIMM16; + + let Inst{15-0} = SIMM16; + let Inst{22-16} = SDST; + let Inst{27-23} = op; + let Inst{31-28} = 0xb; //encoding + let EncodingType = 9; // SIInstrEncodingType::SOPK + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class SOPP op, dag ins, string asm, list pattern> : Enc32 < + (outs), + ins, + asm, + pattern > { + + bits <16> SIMM16; + + let Inst{15-0} = SIMM16; + let Inst{22-16} = op; + let Inst{31-23} = 0x17f; // encoding + let EncodingType = 10; // SIInstrEncodingType::SOPP + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +let Uses = [EXEC] in { + +class VINTRP op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<8> VDST; + bits<8> VSRC; + bits<2> ATTRCHAN; + bits<6> ATTR; + + let Inst{7-0} = VSRC; + let Inst{9-8} = ATTRCHAN; + let Inst{15-10} = ATTR; + let Inst{17-16} = op; + let Inst{25-18} = VDST; + let Inst{31-26} = 0x32; // encoding + let EncodingType = 11; // SIInstrEncodingType::VINTRP + + let neverHasSideEffects = 1; + let mayLoad = 1; + let mayStore = 0; +} + +class VOP1 op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<8> VDST; + bits<9> SRC0; + + let Inst{8-0} = SRC0; + let Inst{16-9} = op; + let Inst{24-17} = VDST; + let Inst{31-25} = 0x3f; //encoding + + let EncodingType = 12; // SIInstrEncodingType::VOP1 + let PostEncoderMethod = "VOPPostEncode"; + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class VOP2 op, dag outs, dag ins, string asm, list pattern> : + Enc32 { + + bits<8> VDST; + bits<9> SRC0; + bits<8> VSRC1; + + let Inst{8-0} = SRC0; + let Inst{16-9} = VSRC1; + let Inst{24-17} = VDST; + let Inst{30-25} = op; + let Inst{31} = 0x0; //encoding + + let EncodingType = 13; // SIInstrEncodingType::VOP2 + let PostEncoderMethod = "VOPPostEncode"; + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class VOP3 op, dag outs, dag ins, string asm, list pattern> : + Enc64 { + + bits<8> VDST; + bits<9> SRC0; + bits<9> SRC1; + bits<9> SRC2; + bits<3> ABS; + bits<1> CLAMP; + bits<2> OMOD; + bits<3> NEG; + + let Inst{7-0} = VDST; + let Inst{10-8} = ABS; + let Inst{11} = CLAMP; + let Inst{25-17} = op; + let Inst{31-26} = 0x34; //encoding + let Inst{40-32} = SRC0; + let Inst{49-41} = SRC1; + let Inst{58-50} = SRC2; + let Inst{60-59} = OMOD; + let Inst{63-61} = NEG; + + let EncodingType = 14; // SIInstrEncodingType::VOP3 + let PostEncoderMethod = "VOPPostEncode"; + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class VOP3b op, dag outs, dag ins, string asm, list pattern> : + Enc64 { + + bits<8> VDST; + bits<9> SRC0; + bits<9> SRC1; + bits<9> SRC2; + bits<7> SDST; + bits<2> OMOD; + bits<3> NEG; + + let Inst{7-0} = VDST; + let Inst{14-8} = SDST; + let Inst{25-17} = op; + let Inst{31-26} = 0x34; //encoding + let Inst{40-32} = SRC0; + let Inst{49-41} = SRC1; + let Inst{58-50} = SRC2; + let Inst{60-59} = OMOD; + let Inst{63-61} = NEG; + + let EncodingType = 14; // SIInstrEncodingType::VOP3 + let PostEncoderMethod = "VOPPostEncode"; + + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +class VOPC op, dag ins, string asm, list pattern> : + Enc32 <(outs VCCReg:$dst), ins, asm, pattern> { + + bits<9> SRC0; + bits<8> VSRC1; + + let Inst{8-0} = SRC0; + let Inst{16-9} = VSRC1; + let Inst{24-17} = op; + let Inst{31-25} = 0x3e; + + let EncodingType = 15; //SIInstrEncodingType::VOPC + let PostEncoderMethod = "VOPPostEncode"; + let DisableEncoding = "$dst"; + let mayLoad = 0; + let mayStore = 0; + let hasSideEffects = 0; +} + +} // End Uses = [EXEC] + +class MIMG_Load_Helper op, string asm> : MIMG < + op, + (outs VReg_128:$vdata), + (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128, + i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_128:$vaddr, + GPR4Align:$srsrc, GPR4Align:$ssamp), + asm, + []> { + let mayLoad = 1; + let mayStore = 0; +} + +class MUBUF_Load_Helper op, string asm, RegisterClass regClass> : MUBUF < + op, + (outs regClass:$dst), + (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, + i1imm:$lds, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, + i1imm:$tfe, SReg_32:$soffset), + asm, + []> { + let mayLoad = 1; + let mayStore = 0; +} + +class MTBUF_Load_Helper op, string asm, RegisterClass regClass> : MTBUF < + op, + (outs regClass:$dst), + (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, + i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align:$srsrc, + i1imm:$slc, i1imm:$tfe, SReg_32:$soffset), + asm, + []> { + let mayLoad = 1; + let mayStore = 0; +} + +class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBUF < + op, + (outs), + (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, + i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, + GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SReg_32:$soffset), + asm, + []> { + let mayStore = 1; + let mayLoad = 0; +} + +multiclass SMRD_Helper op, string asm, RegisterClass dstClass, + ValueType vt> { + def _IMM : SMRD < + op, + (outs dstClass:$dst), + (ins SMRDmemri:$src0), + asm, + [(set (vt dstClass:$dst), (constant_load ADDR_Offset8:$src0))] + >; + + def _SGPR : SMRD < + op, + (outs dstClass:$dst), + (ins SMRDmemrr:$src0), + asm, + [(set (vt dstClass:$dst), (constant_load ADDR_Reg:$src0))] + >; +} + +multiclass SMRD_32 op, string asm, RegisterClass dstClass> { + defm _F32 : SMRD_Helper ; + defm _I32 : SMRD_Helper ; +} + +include "SIInstrFormats.td" +include "SIInstructions.td" -- cgit v1.2.3-18-g5258 From 82d3d4524f2595b2dce617e963b6d67876b4f9ba Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Fri, 18 Jan 2013 21:15:53 +0000 Subject: R600: Proper insert S_WAITCNT instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some instructions like memory reads/writes are executed asynchronously, so we need to insert S_WAITCNT instructions to block before accessing their results. Previously we have just inserted S_WAITCNT instructions after each async instruction, this patch fixes this and adds a prober insertion pass. Patch by: Christian König Tested-by: Michel Dänzer Reviewed-by: Tom Stellard Signed-off-by: Christian König git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@172846 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 873a451e99..8ff2d6db16 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -42,11 +42,14 @@ class InstSI pattern> : AMDGPUInst { field bits<4> EncodingType = 0; - field bits<1> NeedWait = 0; + field bits<1> VM_CNT = 0; + field bits<1> EXP_CNT = 0; + field bits<1> LGKM_CNT = 0; let TSFlags{3-0} = EncodingType; - let TSFlags{4} = NeedWait; - + let TSFlags{4} = VM_CNT; + let TSFlags{5} = EXP_CNT; + let TSFlags{6} = LGKM_CNT; } class Enc32 pattern> : @@ -140,8 +143,7 @@ def EXP : Enc64< let Inst{63-56} = VSRC3; let EncodingType = 0; //SIInstrEncodingType::EXP - let NeedWait = 1; - let usesCustomInserter = 1; + let EXP_CNT = 1; } class MIMG op, dag outs, dag ins, string asm, list pattern> : @@ -174,11 +176,10 @@ class MIMG op, dag outs, dag ins, string asm, list pattern> : let Inst{47-40} = VDATA; let Inst{52-48} = SRSRC; let Inst{57-53} = SSAMP; - let EncodingType = 2; //SIInstrEncodingType::MIMG - let NeedWait = 1; - let usesCustomInserter = 1; + let VM_CNT = 1; + let EXP_CNT = 1; } class MTBUF op, dag outs, dag ins, string asm, list pattern> : @@ -215,8 +216,9 @@ class MTBUF op, dag outs, dag ins, string asm, list pattern> : let Inst{63-56} = SOFFSET; let EncodingType = 3; //SIInstrEncodingType::MTBUF - let NeedWait = 1; - let usesCustomInserter = 1; + let VM_CNT = 1; + let EXP_CNT = 1; + let neverHasSideEffects = 1; } @@ -252,8 +254,9 @@ class MUBUF op, dag outs, dag ins, string asm, list pattern> : let Inst{63-56} = SOFFSET; let EncodingType = 4; //SIInstrEncodingType::MUBUF - let NeedWait = 1; - let usesCustomInserter = 1; + let VM_CNT = 1; + let EXP_CNT = 1; + let neverHasSideEffects = 1; } @@ -276,8 +279,7 @@ class SMRD op, dag outs, dag ins, string asm, list pattern> : let Inst{31-27} = 0x18; //encoding let EncodingType = 5; //SIInstrEncodingType::SMRD - let NeedWait = 1; - let usesCustomInserter = 1; + let LGKM_CNT = 1; } class SOP1 op, dag outs, dag ins, string asm, list pattern> : -- cgit v1.2.3-18-g5258 From 914e47bb0c5d01e4c129b8753ef315517aae8f2f Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 7 Feb 2013 17:02:13 +0000 Subject: R600/SI: Make sample intrinsic address parameter type overloaded. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Handle vectors of 1 to 16 integers. Change the intrinsic names to prevent the wrong one from being selected at runtime due to the overloading. Patch By: Michel Dänzer Signed-off-by: Michel Dänzer Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174633 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 8ff2d6db16..9d9f5f6e1e 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -519,7 +519,7 @@ class MIMG_Load_Helper op, string asm> : MIMG < op, (outs VReg_128:$vdata), (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128, - i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_128:$vaddr, + i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr, GPR4Align:$srsrc, GPR4Align:$ssamp), asm, []> { -- cgit v1.2.3-18-g5258 From 75ddd4cd4c726b3bf93b2a83b51d95a505ce0739 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 7 Feb 2013 19:39:38 +0000 Subject: R600/SI: add proper 64bit immediate support v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: rebased on current upstream Patch by: Christian König Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174652 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 9d9f5f6e1e..83ee2cffb4 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -38,6 +38,16 @@ def SIvcc_bitcast : SDNode<"SIISD::VCC_BITCAST", SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]> >; +// Transformation function, extract the lower 32bit of a 64bit immediate +def LO32 : SDNodeXFormgetTargetConstant(N->getZExtValue() & 0xffffffff, MVT::i32); +}]>; + +// Transformation function, extract the upper 32bit of a 64bit immediate +def HI32 : SDNodeXFormgetTargetConstant(N->getZExtValue() >> 32, MVT::i32); +}]>; + class InstSI pattern> : AMDGPUInst { -- cgit v1.2.3-18-g5258 From fc207d8f57d3bd27aa0dc2dd40ecd344229477d3 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 7 Feb 2013 19:39:40 +0000 Subject: R600/SI: simplify and fix SMRD encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _SGPR variants where wrong. Patch by: Christian König Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174653 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 90 ++++++++++++++++-------------------------- 1 file changed, 34 insertions(+), 56 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 83ee2cffb4..13cf9f70e1 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -38,6 +38,11 @@ def SIvcc_bitcast : SDNode<"SIISD::VCC_BITCAST", SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]> >; +// SMRD takes a 64bit memory address and can only add an 32bit offset +def SIadd64bit32bit : SDNode<"ISD::ADD", + SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>, SDTCisVT<0, i64>, SDTCisVT<2, i32>]> +>; + // Transformation function, extract the lower 32bit of a 64bit immediate def LO32 : SDNodeXFormgetTargetConstant(N->getZExtValue() & 0xffffffff, MVT::i32); @@ -48,6 +53,20 @@ def HI32 : SDNodeXFormgetTargetConstant(N->getZExtValue() >> 32, MVT::i32); }]>; +def IMM8bitDWORD : ImmLeaf < + i32, [{ + return (Imm & ~0x3FC) == 0; + }], SDNodeXFormgetTargetConstant( + N->getZExtValue() >> 2, MVT::i32); + }]> +>; + +def IMM12bit : ImmLeaf < + i16, + [{return isUInt<12>(Imm);}] +>; + class InstSI pattern> : AMDGPUInst { @@ -79,49 +98,16 @@ class SIOperand : Operand { let MIOperandInfo = opInfo; } -def IMM16bit : ImmLeaf < - i16, - [{return isInt<16>(Imm);}] ->; - -def IMM8bit : ImmLeaf < - i32, - [{return (int32_t)Imm >= 0 && (int32_t)Imm <= 0xff;}] ->; - -def IMM12bit : ImmLeaf < - i16, - [{return (int16_t)Imm >= 0 && (int16_t)Imm <= 0xfff;}] ->; - -def IMM32bitIn64bit : ImmLeaf < - i64, - [{return isInt<32>(Imm);}] ->; - class GPR4Align : Operand { let EncoderMethod = "GPR4AlignEncode"; let MIOperandInfo = (ops rc:$reg); } -class GPR2Align : Operand { +class GPR2Align : Operand { let EncoderMethod = "GPR2AlignEncode"; let MIOperandInfo = (ops rc:$reg); } -def SMRDmemrr : Operand { - let MIOperandInfo = (ops SReg_64, SReg_32); - let EncoderMethod = "GPR2AlignEncode"; -} - -def SMRDmemri : Operand { - let MIOperandInfo = (ops SReg_64, i32imm); - let EncoderMethod = "SMRDmemriEncode"; -} - -def ADDR_Reg : ComplexPattern; -def ADDR_Offset8 : ComplexPattern; - let Uses = [EXEC] in { def EXP : Enc64< @@ -272,17 +258,15 @@ class MUBUF op, dag outs, dag ins, string asm, list pattern> : } // End Uses = [EXEC] -class SMRD op, dag outs, dag ins, string asm, list pattern> : - Enc32 { +class SMRD op, bits<1> imm, dag outs, dag ins, string asm, + list pattern> : Enc32 { bits<7> SDST; - bits<15> PTR; - bits<8> OFFSET = PTR{7-0}; - bits<1> IMM = PTR{8}; - bits<6> SBASE = PTR{14-9}; + bits<6> SBASE; + bits<8> OFFSET; let Inst{7-0} = OFFSET; - let Inst{8} = IMM; + let Inst{8} = imm; let Inst{14-9} = SBASE; let Inst{21-15} = SDST; let Inst{26-22} = op; @@ -573,29 +557,23 @@ class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBU let mayLoad = 0; } -multiclass SMRD_Helper op, string asm, RegisterClass dstClass, - ValueType vt> { +multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { def _IMM : SMRD < - op, - (outs dstClass:$dst), - (ins SMRDmemri:$src0), - asm, - [(set (vt dstClass:$dst), (constant_load ADDR_Offset8:$src0))] + op, 1, + (outs dstClass:$dst), + (ins GPR2Align:$sbase, i32imm:$offset), + asm, + [] >; def _SGPR : SMRD < - op, + op, 0, (outs dstClass:$dst), - (ins SMRDmemrr:$src0), + (ins GPR2Align:$sbase, SReg_32:$soff), asm, - [(set (vt dstClass:$dst), (constant_load ADDR_Reg:$src0))] + [] >; } -multiclass SMRD_32 op, string asm, RegisterClass dstClass> { - defm _F32 : SMRD_Helper ; - defm _I32 : SMRD_Helper ; -} - include "SIInstrFormats.td" include "SIInstructions.td" -- cgit v1.2.3-18-g5258 From 184f5c1545e06a99951f14d846a1d853ff19a2b8 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Thu, 7 Feb 2013 19:39:45 +0000 Subject: R600/SI: cleanup VGPR encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove all the unused code. Patch by: Christian König Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174656 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 13cf9f70e1..b983e8ae96 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -70,27 +70,27 @@ def IMM12bit : ImmLeaf < class InstSI pattern> : AMDGPUInst { - field bits<4> EncodingType = 0; field bits<1> VM_CNT = 0; field bits<1> EXP_CNT = 0; field bits<1> LGKM_CNT = 0; - let TSFlags{3-0} = EncodingType; - let TSFlags{4} = VM_CNT; - let TSFlags{5} = EXP_CNT; - let TSFlags{6} = LGKM_CNT; + let TSFlags{0} = VM_CNT; + let TSFlags{1} = EXP_CNT; + let TSFlags{2} = LGKM_CNT; } class Enc32 pattern> : InstSI { field bits<32> Inst; + let Size = 4; } class Enc64 pattern> : InstSI { field bits<64> Inst; + let Size = 8; } class SIOperand : Operand { @@ -137,7 +137,6 @@ def EXP : Enc64< let Inst{47-40} = VSRC1; let Inst{55-48} = VSRC2; let Inst{63-56} = VSRC3; - let EncodingType = 0; //SIInstrEncodingType::EXP let EXP_CNT = 1; } @@ -172,7 +171,6 @@ class MIMG op, dag outs, dag ins, string asm, list pattern> : let Inst{47-40} = VDATA; let Inst{52-48} = SRSRC; let Inst{57-53} = SSAMP; - let EncodingType = 2; //SIInstrEncodingType::MIMG let VM_CNT = 1; let EXP_CNT = 1; @@ -210,7 +208,6 @@ class MTBUF op, dag outs, dag ins, string asm, list pattern> : let Inst{54} = SLC; let Inst{55} = TFE; let Inst{63-56} = SOFFSET; - let EncodingType = 3; //SIInstrEncodingType::MTBUF let VM_CNT = 1; let EXP_CNT = 1; @@ -248,7 +245,6 @@ class MUBUF op, dag outs, dag ins, string asm, list pattern> : let Inst{54} = SLC; let Inst{55} = TFE; let Inst{63-56} = SOFFSET; - let EncodingType = 4; //SIInstrEncodingType::MUBUF let VM_CNT = 1; let EXP_CNT = 1; @@ -271,7 +267,6 @@ class SMRD op, bits<1> imm, dag outs, dag ins, string asm, let Inst{21-15} = SDST; let Inst{26-22} = op; let Inst{31-27} = 0x18; //encoding - let EncodingType = 5; //SIInstrEncodingType::SMRD let LGKM_CNT = 1; } @@ -286,7 +281,6 @@ class SOP1 op, dag outs, dag ins, string asm, list pattern> : let Inst{15-8} = op; let Inst{22-16} = SDST; let Inst{31-23} = 0x17d; //encoding; - let EncodingType = 6; //SIInstrEncodingType::SOP1 let mayLoad = 0; let mayStore = 0; @@ -305,7 +299,6 @@ class SOP2 op, dag outs, dag ins, string asm, list pattern> : let Inst{22-16} = SDST; let Inst{29-23} = op; let Inst{31-30} = 0x2; // encoding - let EncodingType = 7; // SIInstrEncodingType::SOP2 let mayLoad = 0; let mayStore = 0; @@ -322,7 +315,6 @@ class SOPC op, dag outs, dag ins, string asm, list pattern> : let Inst{15-8} = SSRC1; let Inst{22-16} = op; let Inst{31-23} = 0x17e; - let EncodingType = 8; // SIInstrEncodingType::SOPC let DisableEncoding = "$dst"; let mayLoad = 0; @@ -340,7 +332,6 @@ class SOPK op, dag outs, dag ins, string asm, list pattern> : let Inst{22-16} = SDST; let Inst{27-23} = op; let Inst{31-28} = 0xb; //encoding - let EncodingType = 9; // SIInstrEncodingType::SOPK let mayLoad = 0; let mayStore = 0; @@ -358,7 +349,6 @@ class SOPP op, dag ins, string asm, list pattern> : Enc32 < let Inst{15-0} = SIMM16; let Inst{22-16} = op; let Inst{31-23} = 0x17f; // encoding - let EncodingType = 10; // SIInstrEncodingType::SOPP let mayLoad = 0; let mayStore = 0; @@ -381,7 +371,6 @@ class VINTRP op, dag outs, dag ins, string asm, list pattern> : let Inst{17-16} = op; let Inst{25-18} = VDST; let Inst{31-26} = 0x32; // encoding - let EncodingType = 11; // SIInstrEncodingType::VINTRP let neverHasSideEffects = 1; let mayLoad = 1; @@ -399,9 +388,6 @@ class VOP1 op, dag outs, dag ins, string asm, list pattern> : let Inst{24-17} = VDST; let Inst{31-25} = 0x3f; //encoding - let EncodingType = 12; // SIInstrEncodingType::VOP1 - let PostEncoderMethod = "VOPPostEncode"; - let mayLoad = 0; let mayStore = 0; let hasSideEffects = 0; @@ -420,9 +406,6 @@ class VOP2 op, dag outs, dag ins, string asm, list pattern> : let Inst{30-25} = op; let Inst{31} = 0x0; //encoding - let EncodingType = 13; // SIInstrEncodingType::VOP2 - let PostEncoderMethod = "VOPPostEncode"; - let mayLoad = 0; let mayStore = 0; let hasSideEffects = 0; @@ -451,9 +434,6 @@ class VOP3 op, dag outs, dag ins, string asm, list pattern> : let Inst{60-59} = OMOD; let Inst{63-61} = NEG; - let EncodingType = 14; // SIInstrEncodingType::VOP3 - let PostEncoderMethod = "VOPPostEncode"; - let mayLoad = 0; let mayStore = 0; let hasSideEffects = 0; @@ -480,9 +460,6 @@ class VOP3b op, dag outs, dag ins, string asm, list pattern> : let Inst{60-59} = OMOD; let Inst{63-61} = NEG; - let EncodingType = 14; // SIInstrEncodingType::VOP3 - let PostEncoderMethod = "VOPPostEncode"; - let mayLoad = 0; let mayStore = 0; let hasSideEffects = 0; @@ -499,8 +476,6 @@ class VOPC op, dag ins, string asm, list pattern> : let Inst{24-17} = op; let Inst{31-25} = 0x3e; - let EncodingType = 15; //SIInstrEncodingType::VOPC - let PostEncoderMethod = "VOPPostEncode"; let DisableEncoding = "$dst"; let mayLoad = 0; let mayStore = 0; -- cgit v1.2.3-18-g5258 From 7c52866a14e0c928e9be020b9dc8e585f0965212 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Sat, 16 Feb 2013 11:28:02 +0000 Subject: R600/SI: move *_Helper definitions to SIInstrFormat.td MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a candidate for the stable branch. Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175351 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 66 ------------------------------------------ 1 file changed, 66 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index b983e8ae96..aa156f333e 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -484,71 +484,5 @@ class VOPC op, dag ins, string asm, list pattern> : } // End Uses = [EXEC] -class MIMG_Load_Helper op, string asm> : MIMG < - op, - (outs VReg_128:$vdata), - (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128, - i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr, - GPR4Align:$srsrc, GPR4Align:$ssamp), - asm, - []> { - let mayLoad = 1; - let mayStore = 0; -} - -class MUBUF_Load_Helper op, string asm, RegisterClass regClass> : MUBUF < - op, - (outs regClass:$dst), - (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, - i1imm:$lds, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, - i1imm:$tfe, SReg_32:$soffset), - asm, - []> { - let mayLoad = 1; - let mayStore = 0; -} - -class MTBUF_Load_Helper op, string asm, RegisterClass regClass> : MTBUF < - op, - (outs regClass:$dst), - (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, - i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align:$srsrc, - i1imm:$slc, i1imm:$tfe, SReg_32:$soffset), - asm, - []> { - let mayLoad = 1; - let mayStore = 0; -} - -class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBUF < - op, - (outs), - (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, - i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, - GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SReg_32:$soffset), - asm, - []> { - let mayStore = 1; - let mayLoad = 0; -} - -multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { - def _IMM : SMRD < - op, 1, - (outs dstClass:$dst), - (ins GPR2Align:$sbase, i32imm:$offset), - asm, - [] - >; - - def _SGPR : SMRD < - op, 0, - (outs dstClass:$dst), - (ins GPR2Align:$sbase, SReg_32:$soff), - asm, - [] - >; -} - include "SIInstrFormats.td" include "SIInstructions.td" -- cgit v1.2.3-18-g5258 From e9ba1830df2efef3da113a740909195e839ebd36 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Sat, 16 Feb 2013 11:28:30 +0000 Subject: R600/SI: nuke SReg_1 v3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's completely unnecessary and can be replace with proper SReg_64 handling instead. This actually fixes a piglit test on SI. v2: use correct register class in addRegisterClass, set special classes as not allocatable v3: revert setting special classes as not allocateable This is a candidate for the stable branch. Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175355 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 27 --------------------------- 1 file changed, 27 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index aa156f333e..efc6015c68 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -7,37 +7,10 @@ // //===----------------------------------------------------------------------===// -//===----------------------------------------------------------------------===// -// SI DAG Profiles -//===----------------------------------------------------------------------===// -def SDTVCCBinaryOp : SDTypeProfile<1, 2, [ - SDTCisInt<0>, SDTCisInt<1>, SDTCisSameAs<1, 2> -]>; - //===----------------------------------------------------------------------===// // SI DAG Nodes //===----------------------------------------------------------------------===// -// and operation on 64-bit wide vcc -def SIsreg1_and : SDNode<"SIISD::VCC_AND", SDTVCCBinaryOp, - [SDNPCommutative, SDNPAssociative] ->; - -// Special bitcast node for sharing VCC register between VALU and SALU -def SIsreg1_bitcast : SDNode<"SIISD::VCC_BITCAST", - SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]> ->; - -// and operation on 64-bit wide vcc -def SIvcc_and : SDNode<"SIISD::VCC_AND", SDTVCCBinaryOp, - [SDNPCommutative, SDNPAssociative] ->; - -// Special bitcast node for sharing VCC register between VALU and SALU -def SIvcc_bitcast : SDNode<"SIISD::VCC_BITCAST", - SDTypeProfile<1, 1, [SDTCisInt<0>, SDTCisInt<1>]> ->; - // SMRD takes a 64bit memory address and can only add an 32bit offset def SIadd64bit32bit : SDNode<"ISD::ADD", SDTypeProfile<1, 2, [SDTCisSameAs<0, 1>, SDTCisVT<0, i64>, SDTCisVT<2, i32>]> -- cgit v1.2.3-18-g5258 From ecc571f063eb0d6a49033fbe85ffbf0db6114f59 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Sat, 16 Feb 2013 11:28:36 +0000 Subject: R600/SI: Add pattern to simplify i64 loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a candidate for the stable branch. Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175356 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index efc6015c68..8c4e5afdeb 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -40,6 +40,10 @@ def IMM12bit : ImmLeaf < [{return isUInt<12>(Imm);}] >; +class InlineImm : ImmLeaf ; + class InstSI pattern> : AMDGPUInst { -- cgit v1.2.3-18-g5258 From 8c0b3a0d31f2eb04d96f63b72e189fe82f8b4a4f Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:16:44 +0000 Subject: R600/SI: cleanup SIInstrInfo.td and SIInstrFormat.td MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those two files got mixed up. Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175746 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 515 +++++++++++++---------------------------- 1 file changed, 158 insertions(+), 357 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 8c4e5afdeb..cf0d5b936a 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -1,4 +1,4 @@ -//===-- SIInstrInfo.td - SI Instruction Encodings ---------*- tablegen -*--===// +//===-- SIInstrInfo.td - SI Instruction Infos -------------*- tablegen -*--===// // // The LLVM Compiler Infrastructure // @@ -44,31 +44,10 @@ class InlineImm : ImmLeaf ; -class InstSI pattern> : - AMDGPUInst { - field bits<1> VM_CNT = 0; - field bits<1> EXP_CNT = 0; - field bits<1> LGKM_CNT = 0; - - let TSFlags{0} = VM_CNT; - let TSFlags{1} = EXP_CNT; - let TSFlags{2} = LGKM_CNT; -} - -class Enc32 pattern> : - InstSI { - - field bits<32> Inst; - let Size = 4; -} - -class Enc64 pattern> : - InstSI { - - field bits<64> Inst; - let Size = 8; -} +//===----------------------------------------------------------------------===// +// SI assembler operands +//===----------------------------------------------------------------------===// class SIOperand : Operand { let EncoderMethod = "encodeOperand"; @@ -85,381 +64,203 @@ class GPR2Align : Operand { let MIOperandInfo = (ops rc:$reg); } -let Uses = [EXEC] in { - -def EXP : Enc64< - (outs), - (ins i32imm:$en, i32imm:$tgt, i32imm:$compr, i32imm:$done, i32imm:$vm, - VReg_32:$src0, VReg_32:$src1, VReg_32:$src2, VReg_32:$src3), - "EXP $en, $tgt, $compr, $done, $vm, $src0, $src1, $src2, $src3", - [] > { - - bits<4> EN; - bits<6> TGT; - bits<1> COMPR; - bits<1> DONE; - bits<1> VM; - bits<8> VSRC0; - bits<8> VSRC1; - bits<8> VSRC2; - bits<8> VSRC3; - - let Inst{3-0} = EN; - let Inst{9-4} = TGT; - let Inst{10} = COMPR; - let Inst{11} = DONE; - let Inst{12} = VM; - let Inst{31-26} = 0x3e; - let Inst{39-32} = VSRC0; - let Inst{47-40} = VSRC1; - let Inst{55-48} = VSRC2; - let Inst{63-56} = VSRC3; - - let EXP_CNT = 1; -} - -class MIMG op, dag outs, dag ins, string asm, list pattern> : - Enc64 { - - bits<8> VDATA; - bits<4> DMASK; - bits<1> UNORM; - bits<1> GLC; - bits<1> DA; - bits<1> R128; - bits<1> TFE; - bits<1> LWE; - bits<1> SLC; - bits<8> VADDR; - bits<5> SRSRC; - bits<5> SSAMP; - - let Inst{11-8} = DMASK; - let Inst{12} = UNORM; - let Inst{13} = GLC; - let Inst{14} = DA; - let Inst{15} = R128; - let Inst{16} = TFE; - let Inst{17} = LWE; - let Inst{24-18} = op; - let Inst{25} = SLC; - let Inst{31-26} = 0x3c; - let Inst{39-32} = VADDR; - let Inst{47-40} = VDATA; - let Inst{52-48} = SRSRC; - let Inst{57-53} = SSAMP; - - let VM_CNT = 1; - let EXP_CNT = 1; -} - -class MTBUF op, dag outs, dag ins, string asm, list pattern> : - Enc64 { - - bits<8> VDATA; - bits<12> OFFSET; - bits<1> OFFEN; - bits<1> IDXEN; - bits<1> GLC; - bits<1> ADDR64; - bits<4> DFMT; - bits<3> NFMT; - bits<8> VADDR; - bits<5> SRSRC; - bits<1> SLC; - bits<1> TFE; - bits<8> SOFFSET; - - let Inst{11-0} = OFFSET; - let Inst{12} = OFFEN; - let Inst{13} = IDXEN; - let Inst{14} = GLC; - let Inst{15} = ADDR64; - let Inst{18-16} = op; - let Inst{22-19} = DFMT; - let Inst{25-23} = NFMT; - let Inst{31-26} = 0x3a; //encoding - let Inst{39-32} = VADDR; - let Inst{47-40} = VDATA; - let Inst{52-48} = SRSRC; - let Inst{54} = SLC; - let Inst{55} = TFE; - let Inst{63-56} = SOFFSET; - - let VM_CNT = 1; - let EXP_CNT = 1; - - let neverHasSideEffects = 1; -} +include "SIInstrFormats.td" -class MUBUF op, dag outs, dag ins, string asm, list pattern> : - Enc64 { - - bits<8> VDATA; - bits<12> OFFSET; - bits<1> OFFEN; - bits<1> IDXEN; - bits<1> GLC; - bits<1> ADDR64; - bits<1> LDS; - bits<8> VADDR; - bits<5> SRSRC; - bits<1> SLC; - bits<1> TFE; - bits<8> SOFFSET; - - let Inst{11-0} = OFFSET; - let Inst{12} = OFFEN; - let Inst{13} = IDXEN; - let Inst{14} = GLC; - let Inst{15} = ADDR64; - let Inst{16} = LDS; - let Inst{24-18} = op; - let Inst{31-26} = 0x38; //encoding - let Inst{39-32} = VADDR; - let Inst{47-40} = VDATA; - let Inst{52-48} = SRSRC; - let Inst{54} = SLC; - let Inst{55} = TFE; - let Inst{63-56} = SOFFSET; - - let VM_CNT = 1; - let EXP_CNT = 1; - - let neverHasSideEffects = 1; -} +//===----------------------------------------------------------------------===// +// +// SI Instruction multiclass helpers. +// +// Instructions with _32 take 32-bit operands. +// Instructions with _64 take 64-bit operands. +// +// VOP_* instructions can use either a 32-bit or 64-bit encoding. The 32-bit +// encoding is the standard encoding, but instruction that make use of +// any of the instruction modifiers must use the 64-bit encoding. +// +// Instructions with _e32 use the 32-bit encoding. +// Instructions with _e64 use the 64-bit encoding. +// +//===----------------------------------------------------------------------===// -} // End Uses = [EXEC] +//===----------------------------------------------------------------------===// +// Scalar classes +//===----------------------------------------------------------------------===// -class SMRD op, bits<1> imm, dag outs, dag ins, string asm, - list pattern> : Enc32 { +class SOP1_32 op, string opName, list pattern> + : SOP1 ; - bits<7> SDST; - bits<6> SBASE; - bits<8> OFFSET; - - let Inst{7-0} = OFFSET; - let Inst{8} = imm; - let Inst{14-9} = SBASE; - let Inst{21-15} = SDST; - let Inst{26-22} = op; - let Inst{31-27} = 0x18; //encoding +class SOP1_64 op, string opName, list pattern> + : SOP1 ; - let LGKM_CNT = 1; -} +class SOP2_32 op, string opName, list pattern> + : SOP2 ; -class SOP1 op, dag outs, dag ins, string asm, list pattern> : - Enc32 { +class SOP2_64 op, string opName, list pattern> + : SOP2 ; - bits<7> SDST; - bits<8> SSRC0; +class SOPC_32 op, string opName, list pattern> + : SOPC ; - let Inst{7-0} = SSRC0; - let Inst{15-8} = op; - let Inst{22-16} = SDST; - let Inst{31-23} = 0x17d; //encoding; +class SOPC_64 op, string opName, list pattern> + : SOPC ; - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; -} +class SOPK_32 op, string opName, list pattern> + : SOPK ; -class SOP2 op, dag outs, dag ins, string asm, list pattern> : - Enc32 { - - bits<7> SDST; - bits<8> SSRC0; - bits<8> SSRC1; +class SOPK_64 op, string opName, list pattern> + : SOPK ; - let Inst{7-0} = SSRC0; - let Inst{15-8} = SSRC1; - let Inst{22-16} = SDST; - let Inst{29-23} = op; - let Inst{31-30} = 0x2; // encoding +multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { + def _IMM : SMRD < + op, 1, (outs dstClass:$dst), + (ins GPR2Align:$sbase, i32imm:$offset), + asm, [] + >; - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; + def _SGPR : SMRD < + op, 0, (outs dstClass:$dst), + (ins GPR2Align:$sbase, SReg_32:$soff), + asm, [] + >; } -class SOPC op, dag outs, dag ins, string asm, list pattern> : - Enc32 { +//===----------------------------------------------------------------------===// +// Vector ALU classes +//===----------------------------------------------------------------------===// - bits<8> SSRC0; - bits<8> SSRC1; +class VOP3_32 op, string opName, list pattern> : VOP3 < + op, (outs VReg_32:$dst), + (ins VSrc_32:$src0, VReg_32:$src1, VReg_32:$src2, i32imm:$src3, + i32imm:$src4, i32imm:$src5, i32imm:$src6), + opName, pattern +>; - let Inst{7-0} = SSRC0; - let Inst{15-8} = SSRC1; - let Inst{22-16} = op; - let Inst{31-23} = 0x17e; +class VOP3_64 op, string opName, list pattern> : VOP3 < + op, (outs VReg_64:$dst), + (ins VSrc_64:$src0, VReg_64:$src1, VReg_64:$src2, + i32imm:$src3, i32imm:$src4, i32imm:$src5, i32imm:$src6), + opName, pattern +>; - let DisableEncoding = "$dst"; - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; +class VOP1_Helper op, RegisterClass vrc, RegisterClass arc, + string opName, list pattern> : + VOP1 < + op, (outs vrc:$dst), (ins arc:$src0), opName, pattern + >; + +multiclass VOP1_32 op, string opName, list pattern> { + def _e32: VOP1_Helper ; + def _e64 : VOP3_32 <{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + opName, [] + >; } -class SOPK op, dag outs, dag ins, string asm, list pattern> : - Enc32 { +multiclass VOP1_64 op, string opName, list pattern> { - bits <7> SDST; - bits <16> SIMM16; - - let Inst{15-0} = SIMM16; - let Inst{22-16} = SDST; - let Inst{27-23} = op; - let Inst{31-28} = 0xb; //encoding + def _e32 : VOP1_Helper ; - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; + def _e64 : VOP3_64 < + {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + opName, [] + >; } -class SOPP op, dag ins, string asm, list pattern> : Enc32 < - (outs), - ins, - asm, - pattern > { +class VOP2_Helper op, RegisterClass vrc, RegisterClass arc, + string opName, list pattern> : + VOP2 < + op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), opName, pattern + >; - bits <16> SIMM16; +multiclass VOP2_32 op, string opName, list pattern> { - let Inst{15-0} = SIMM16; - let Inst{22-16} = op; - let Inst{31-23} = 0x17f; // encoding + def _e32 : VOP2_Helper ; - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; + def _e64 : VOP3_32 <{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + opName, [] + >; } - -let Uses = [EXEC] in { - -class VINTRP op, dag outs, dag ins, string asm, list pattern> : - Enc32 { - bits<8> VDST; - bits<8> VSRC; - bits<2> ATTRCHAN; - bits<6> ATTR; +multiclass VOP2_64 op, string opName, list pattern> { + def _e32: VOP2_Helper ; - let Inst{7-0} = VSRC; - let Inst{9-8} = ATTRCHAN; - let Inst{15-10} = ATTR; - let Inst{17-16} = op; - let Inst{25-18} = VDST; - let Inst{31-26} = 0x32; // encoding - - let neverHasSideEffects = 1; - let mayLoad = 1; - let mayStore = 0; + def _e64 : VOP3_64 < + {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + opName, [] + >; } -class VOP1 op, dag outs, dag ins, string asm, list pattern> : - Enc32 { - - bits<8> VDST; - bits<9> SRC0; - - let Inst{8-0} = SRC0; - let Inst{16-9} = op; - let Inst{24-17} = VDST; - let Inst{31-25} = 0x3f; //encoding - - let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; +multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, + string opName, list pattern> { + + def _e32 : VOPC ; + def _e64 : VOP3 < + {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + (outs SReg_64:$dst), + (ins arc:$src0, vrc:$src1, + InstFlag:$abs, InstFlag:$clamp, + InstFlag:$omod, InstFlag:$neg), + opName, pattern + > { + let SRC2 = 0x80; + } } -class VOP2 op, dag outs, dag ins, string asm, list pattern> : - Enc32 { - - bits<8> VDST; - bits<9> SRC0; - bits<8> VSRC1; - - let Inst{8-0} = SRC0; - let Inst{16-9} = VSRC1; - let Inst{24-17} = VDST; - let Inst{30-25} = op; - let Inst{31} = 0x0; //encoding - +multiclass VOPC_32 op, string opName, list pattern> + : VOPC_Helper ; + +multiclass VOPC_64 op, string opName, list pattern> + : VOPC_Helper ; + +//===----------------------------------------------------------------------===// +// Vector I/O classes +//===----------------------------------------------------------------------===// + +class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBUF < + op, + (outs), + (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, + i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, + GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), + asm, + []> { + let mayStore = 1; let mayLoad = 0; - let mayStore = 0; - let hasSideEffects = 0; } -class VOP3 op, dag outs, dag ins, string asm, list pattern> : - Enc64 { - - bits<8> VDST; - bits<9> SRC0; - bits<9> SRC1; - bits<9> SRC2; - bits<3> ABS; - bits<1> CLAMP; - bits<2> OMOD; - bits<3> NEG; - - let Inst{7-0} = VDST; - let Inst{10-8} = ABS; - let Inst{11} = CLAMP; - let Inst{25-17} = op; - let Inst{31-26} = 0x34; //encoding - let Inst{40-32} = SRC0; - let Inst{49-41} = SRC1; - let Inst{58-50} = SRC2; - let Inst{60-59} = OMOD; - let Inst{63-61} = NEG; - - let mayLoad = 0; +class MUBUF_Load_Helper op, string asm, RegisterClass regClass> : MUBUF < + op, + (outs regClass:$dst), + (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, + i1imm:$lds, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, + i1imm:$tfe, SSrc_32:$soffset), + asm, + []> { + let mayLoad = 1; let mayStore = 0; - let hasSideEffects = 0; } -class VOP3b op, dag outs, dag ins, string asm, list pattern> : - Enc64 { - - bits<8> VDST; - bits<9> SRC0; - bits<9> SRC1; - bits<9> SRC2; - bits<7> SDST; - bits<2> OMOD; - bits<3> NEG; - - let Inst{7-0} = VDST; - let Inst{14-8} = SDST; - let Inst{25-17} = op; - let Inst{31-26} = 0x34; //encoding - let Inst{40-32} = SRC0; - let Inst{49-41} = SRC1; - let Inst{58-50} = SRC2; - let Inst{60-59} = OMOD; - let Inst{63-61} = NEG; - - let mayLoad = 0; +class MTBUF_Load_Helper op, string asm, RegisterClass regClass> : MTBUF < + op, + (outs regClass:$dst), + (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, + i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align:$srsrc, + i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), + asm, + []> { + let mayLoad = 1; let mayStore = 0; - let hasSideEffects = 0; } -class VOPC op, dag ins, string asm, list pattern> : - Enc32 <(outs VCCReg:$dst), ins, asm, pattern> { - - bits<9> SRC0; - bits<8> VSRC1; - - let Inst{8-0} = SRC0; - let Inst{16-9} = VSRC1; - let Inst{24-17} = op; - let Inst{31-25} = 0x3e; - - let DisableEncoding = "$dst"; - let mayLoad = 0; +class MIMG_Load_Helper op, string asm> : MIMG < + op, + (outs VReg_128:$vdata), + (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128, + i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr, + GPR4Align:$srsrc, GPR4Align:$ssamp), + asm, + []> { + let mayLoad = 1; let mayStore = 0; - let hasSideEffects = 0; } -} // End Uses = [EXEC] - -include "SIInstrFormats.td" include "SIInstructions.td" -- cgit v1.2.3-18-g5258 From 7fa9957b16ee314b294da8abbec70bd2f1dfa608 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:16:49 +0000 Subject: R600/SI: add constant for inline zero operand MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175747 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index cf0d5b936a..8b90d45645 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -49,9 +49,8 @@ class InlineImm : ImmLeaf : Operand { - let EncoderMethod = "encodeOperand"; - let MIOperandInfo = opInfo; +def SIOperand { + int ZERO = 0x80; } class GPR4Align : Operand { @@ -201,7 +200,7 @@ multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, InstFlag:$omod, InstFlag:$neg), opName, pattern > { - let SRC2 = 0x80; + let SRC2 = SIOperand.ZERO; } } -- cgit v1.2.3-18-g5258 From a38ccb4b32fca60264b734090a00cb850bcfbaf7 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:16:53 +0000 Subject: R600/SI: rework VOP1_* patterns v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing asm operation names. v2: use ZERO constant, also add asm operands Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175748 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 8b90d45645..2b313079da 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -141,29 +141,33 @@ class VOP3_64 op, string opName, list pattern> : VOP3 < opName, pattern >; -class VOP1_Helper op, RegisterClass vrc, RegisterClass arc, - string opName, list pattern> : - VOP1 < - op, (outs vrc:$dst), (ins arc:$src0), opName, pattern - >; +multiclass VOP1_Helper op, RegisterClass drc, RegisterClass src, + string opName, list pattern> { -multiclass VOP1_32 op, string opName, list pattern> { - def _e32: VOP1_Helper ; - def _e64 : VOP3_32 <{1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, - opName, [] + def _e32: VOP1 < + op, (outs drc:$dst), (ins src:$src0), + opName#"_e32 $dst, $src0", pattern >; -} -multiclass VOP1_64 op, string opName, list pattern> { - - def _e32 : VOP1_Helper ; - - def _e64 : VOP3_64 < + def _e64 : VOP3 < {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, - opName, [] - >; + (outs drc:$dst), + (ins src:$src0, + i32imm:$abs, i32imm:$clamp, + i32imm:$omod, i32imm:$neg), + opName#"_e64 $dst, $src0, $abs, $clamp, $omod, $neg", [] + > { + let SRC1 = SIOperand.ZERO; + let SRC2 = SIOperand.ZERO; + } } +multiclass VOP1_32 op, string opName, list pattern> + : VOP1_Helper ; + +multiclass VOP1_64 op, string opName, list pattern> + : VOP1_Helper ; + class VOP2_Helper op, RegisterClass vrc, RegisterClass arc, string opName, list pattern> : VOP2 < -- cgit v1.2.3-18-g5258 From 477963aff4f7fd93c3dfdb253c2983dc9f0450f9 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:16:58 +0000 Subject: R600/SI: rework VOP2_* pattern v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing asm operation names. v2: use ZERO constant, also add asm operands Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175749 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 2b313079da..dc18a7147d 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -168,29 +168,30 @@ multiclass VOP1_32 op, string opName, list pattern> multiclass VOP1_64 op, string opName, list pattern> : VOP1_Helper ; -class VOP2_Helper op, RegisterClass vrc, RegisterClass arc, - string opName, list pattern> : - VOP2 < - op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), opName, pattern +multiclass VOP2_Helper op, RegisterClass vrc, RegisterClass arc, + string opName, list pattern> { + def _e32 : VOP2 < + op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), + opName#"_e32 $dst, $src0, $src1", pattern >; -multiclass VOP2_32 op, string opName, list pattern> { - - def _e32 : VOP2_Helper ; - - def _e64 : VOP3_32 <{1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, - opName, [] - >; + def _e64 : VOP3 < + {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + (outs vrc:$dst), + (ins arc:$src0, vrc:$src1, + i32imm:$abs, i32imm:$clamp, + i32imm:$omod, i32imm:$neg), + opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", [] + > { + let SRC2 = SIOperand.ZERO; + } } -multiclass VOP2_64 op, string opName, list pattern> { - def _e32: VOP2_Helper ; +multiclass VOP2_32 op, string opName, list pattern> + : VOP2_Helper ; - def _e64 : VOP3_64 < - {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, - opName, [] - >; -} +multiclass VOP2_64 op, string opName, list pattern> + : VOP2_Helper ; multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, string opName, list pattern> { -- cgit v1.2.3-18-g5258 From 7b3dab2673128257b6bf9a3eaa4fe5aad9c9a675 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:17:04 +0000 Subject: R600/SI: simplify VOPC_* pattern v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing asm operation names. v2: fix name of the e64 encoding, also add asm operands Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175750 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index dc18a7147d..0808f24c21 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -194,26 +194,35 @@ multiclass VOP2_64 op, string opName, list pattern> : VOP2_Helper ; multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, - string opName, list pattern> { + string opName, ValueType vt, PatLeaf cond> { + + def _e32 : VOPC < + op, (ins arc:$src0, vrc:$src1), + opName#"_e32 $dst, $src0, $src1", [] + >; - def _e32 : VOPC ; def _e64 : VOP3 < {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, (outs SReg_64:$dst), (ins arc:$src0, vrc:$src1, InstFlag:$abs, InstFlag:$clamp, InstFlag:$omod, InstFlag:$neg), - opName, pattern + opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", + !if(!eq(!cast(cond), "COND_NULL"), [], + [(set SReg_64:$dst, (i1 (setcc (vt arc:$src0), vrc:$src1, cond)))] + ) > { let SRC2 = SIOperand.ZERO; } } -multiclass VOPC_32 op, string opName, list pattern> - : VOPC_Helper ; +multiclass VOPC_32 op, string opName, + ValueType vt = untyped, PatLeaf cond = COND_NULL> + : VOPC_Helper ; -multiclass VOPC_64 op, string opName, list pattern> - : VOPC_Helper ; +multiclass VOPC_64 op, string opName, + ValueType vt = untyped, PatLeaf cond = COND_NULL> + : VOPC_Helper ; //===----------------------------------------------------------------------===// // Vector I/O classes -- cgit v1.2.3-18-g5258 From b4dc10c8c5df75c0b281e0d815018b5830b965b9 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:17:09 +0000 Subject: R600/SI: rework VOP3 classes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Order the classes and add asm operands. Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175751 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 0808f24c21..05325db4d0 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -127,20 +127,6 @@ multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { // Vector ALU classes //===----------------------------------------------------------------------===// -class VOP3_32 op, string opName, list pattern> : VOP3 < - op, (outs VReg_32:$dst), - (ins VSrc_32:$src0, VReg_32:$src1, VReg_32:$src2, i32imm:$src3, - i32imm:$src4, i32imm:$src5, i32imm:$src6), - opName, pattern ->; - -class VOP3_64 op, string opName, list pattern> : VOP3 < - op, (outs VReg_64:$dst), - (ins VSrc_64:$src0, VReg_64:$src1, VReg_64:$src2, - i32imm:$src3, i32imm:$src4, i32imm:$src5, i32imm:$src6), - opName, pattern ->; - multiclass VOP1_Helper op, RegisterClass drc, RegisterClass src, string opName, list pattern> { @@ -224,6 +210,20 @@ multiclass VOPC_64 op, string opName, ValueType vt = untyped, PatLeaf cond = COND_NULL> : VOPC_Helper ; +class VOP3_32 op, string opName, list pattern> : VOP3 < + op, (outs VReg_32:$dst), + (ins VSrc_32:$src0, VReg_32:$src1, VReg_32:$src2, + i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), + opName#" $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg", pattern +>; + +class VOP3_64 op, string opName, list pattern> : VOP3 < + op, (outs VReg_64:$dst), + (ins VSrc_64:$src0, VReg_64:$src1, VReg_64:$src2, + i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), + opName#" $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg", pattern +>; + //===----------------------------------------------------------------------===// // Vector I/O classes //===----------------------------------------------------------------------===// -- cgit v1.2.3-18-g5258 From f17d0d6f806e7e215c8fb17120ed18c22e957771 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:17:13 +0000 Subject: R600/SI: add the missing S_* asm operands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175752 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 52 +++++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 05325db4d0..56ca03a01c 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -85,41 +85,57 @@ include "SIInstrFormats.td" // Scalar classes //===----------------------------------------------------------------------===// -class SOP1_32 op, string opName, list pattern> - : SOP1 ; +class SOP1_32 op, string opName, list pattern> : SOP1 < + op, (outs SReg_32:$dst), (ins SSrc_32:$src0), + opName#" $dst, $src0", pattern +>; -class SOP1_64 op, string opName, list pattern> - : SOP1 ; +class SOP1_64 op, string opName, list pattern> : SOP1 < + op, (outs SReg_64:$dst), (ins SSrc_64:$src0), + opName#" $dst, $src0", pattern +>; -class SOP2_32 op, string opName, list pattern> - : SOP2 ; +class SOP2_32 op, string opName, list pattern> : SOP2 < + op, (outs SReg_32:$dst), (ins SSrc_32:$src0, SSrc_32:$src1), + opName#" $dst, $src0, $src1", pattern +>; -class SOP2_64 op, string opName, list pattern> - : SOP2 ; +class SOP2_64 op, string opName, list pattern> : SOP2 < + op, (outs SReg_64:$dst), (ins SSrc_64:$src0, SSrc_64:$src1), + opName#" $dst, $src0, $src1", pattern +>; -class SOPC_32 op, string opName, list pattern> - : SOPC ; +class SOPC_32 op, string opName, list pattern> : SOPC < + op, (outs SCCReg:$dst), (ins SSrc_32:$src0, SSrc_32:$src1), + opName#" $dst, $src0, $src1", pattern +>; -class SOPC_64 op, string opName, list pattern> - : SOPC ; +class SOPC_64 op, string opName, list pattern> : SOPC < + op, (outs SCCReg:$dst), (ins SSrc_64:$src0, SSrc_64:$src1), + opName#" $dst, $src0, $src1", pattern +>; -class SOPK_32 op, string opName, list pattern> - : SOPK ; +class SOPK_32 op, string opName, list pattern> : SOPK < + op, (outs SReg_32:$dst), (ins i16imm:$src0), + opName#" $dst, $src0", pattern +>; -class SOPK_64 op, string opName, list pattern> - : SOPK ; +class SOPK_64 op, string opName, list pattern> : SOPK < + op, (outs SReg_64:$dst), (ins i16imm:$src0), + opName#" $dst, $src0", pattern +>; multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { def _IMM : SMRD < op, 1, (outs dstClass:$dst), (ins GPR2Align:$sbase, i32imm:$offset), - asm, [] + asm#" $dst, $sbase, $offset", [] >; def _SGPR : SMRD < op, 0, (outs dstClass:$dst), (ins GPR2Align:$sbase, SReg_32:$soff), - asm, [] + asm#" $dst, $sbase, $soff", [] >; } -- cgit v1.2.3-18-g5258 From ee44118ef7a917b2fd94f40e5a07d8b5f420acf2 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Thu, 21 Feb 2013 15:17:17 +0000 Subject: R600/SI: add the missing M*BUF|IMG asm operands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König Reviewed-by: Tom Stellard Reviewed-by: Michel Dänzer git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@175753 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 56ca03a01c..99168ce1aa 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -250,7 +250,8 @@ class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBU (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), - asm, + asm#" $vdata, $offset, $offen, $idxen, $glc, $addr64, $dfmt," + #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []> { let mayStore = 1; let mayLoad = 0; @@ -262,7 +263,8 @@ class MUBUF_Load_Helper op, string asm, RegisterClass regClass> : MUBUF (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, i1imm:$lds, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), - asm, + asm#" $dst, $offset, $offen, $idxen, $glc, $addr64, " + #"$lds, $vaddr, $srsrc, $slc, $tfe, $soffset", []> { let mayLoad = 1; let mayStore = 0; @@ -274,7 +276,8 @@ class MTBUF_Load_Helper op, string asm, RegisterClass regClass> : MTBUF (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), - asm, + asm#" $dst, $offset, $offen, $idxen, $glc, $addr64, $dfmt," + #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []> { let mayLoad = 1; let mayStore = 0; @@ -286,7 +289,8 @@ class MIMG_Load_Helper op, string asm> : MIMG < (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128, i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr, GPR4Align:$srsrc, GPR4Align:$ssamp), - asm, + asm#" $vdata, $dmask, $unorm, $glc, $da, $r128," + #" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp", []> { let mayLoad = 1; let mayStore = 0; -- cgit v1.2.3-18-g5258 From 749428f852b63a98e872ba69b0c576b26b7b7518 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Tue, 26 Feb 2013 17:52:09 +0000 Subject: R600/SI: fix VOP3b encoding v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v2: document why we hardcode VCC for now. This is a candidate for the mesa-stable branch. Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176099 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 99168ce1aa..d68fbff667 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -51,6 +51,7 @@ class InlineImm : ImmLeaf : Operand { @@ -195,6 +196,29 @@ multiclass VOP2_32 op, string opName, list pattern> multiclass VOP2_64 op, string opName, list pattern> : VOP2_Helper ; +multiclass VOP2b_32 op, string opName, list pattern> { + + def _e32 : VOP2 < + op, (outs VReg_32:$dst), (ins VSrc_32:$src0, VReg_32:$src1), + opName#"_e32 $dst, $src0, $src1", pattern + >; + + def _e64 : VOP3b < + {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, + (outs VReg_32:$dst), + (ins VSrc_32:$src0, VReg_32:$src1, + i32imm:$abs, i32imm:$clamp, + i32imm:$omod, i32imm:$neg), + opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", [] + > { + let SRC2 = SIOperand.ZERO; + /* the VOP2 variant puts the carry out into VCC, the VOP3 variant + can write it into any SGPR. We currently don't use the carry out, + so for now hardcode it to VCC as well */ + let SDST = SIOperand.VCC; + } +} + multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, string opName, ValueType vt, PatLeaf cond> { -- cgit v1.2.3-18-g5258 From d3b5509b8099b72104bd8a0d9a998a69eb56ab2a Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Tue, 26 Feb 2013 17:52:23 +0000 Subject: R600/SI: add post ISel folding for SI v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Include immediate folding and SGPR limit handling for VOP3 instructions. v2: remove leftover hasExtraSrcRegAllocReq Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176101 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index d68fbff667..3a617b4d93 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -40,11 +40,10 @@ def IMM12bit : ImmLeaf < [{return isUInt<12>(Imm);}] >; -class InlineImm : ImmLeaf : PatLeaf <(vt imm), [{ + return ((const SITargetLowering &)TLI).analyzeImmediate(N) == 0; }]>; - //===----------------------------------------------------------------------===// // SI assembler operands //===----------------------------------------------------------------------===// @@ -181,7 +180,7 @@ multiclass VOP2_Helper op, RegisterClass vrc, RegisterClass arc, def _e64 : VOP3 < {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, (outs vrc:$dst), - (ins arc:$src0, vrc:$src1, + (ins arc:$src0, arc:$src1, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", [] @@ -206,7 +205,7 @@ multiclass VOP2b_32 op, string opName, list pattern> { def _e64 : VOP3b < {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, (outs VReg_32:$dst), - (ins VSrc_32:$src0, VReg_32:$src1, + (ins VSrc_32:$src0, VSrc_32:$src1, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", [] @@ -230,12 +229,12 @@ multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, def _e64 : VOP3 < {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, (outs SReg_64:$dst), - (ins arc:$src0, vrc:$src1, + (ins arc:$src0, arc:$src1, InstFlag:$abs, InstFlag:$clamp, InstFlag:$omod, InstFlag:$neg), opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", !if(!eq(!cast(cond), "COND_NULL"), [], - [(set SReg_64:$dst, (i1 (setcc (vt arc:$src0), vrc:$src1, cond)))] + [(set SReg_64:$dst, (i1 (setcc (vt arc:$src0), arc:$src1, cond)))] ) > { let SRC2 = SIOperand.ZERO; @@ -252,14 +251,14 @@ multiclass VOPC_64 op, string opName, class VOP3_32 op, string opName, list pattern> : VOP3 < op, (outs VReg_32:$dst), - (ins VSrc_32:$src0, VReg_32:$src1, VReg_32:$src2, + (ins VSrc_32:$src0, VSrc_32:$src1, VSrc_32:$src2, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#" $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg", pattern >; class VOP3_64 op, string opName, list pattern> : VOP3 < op, (outs VReg_64:$dst), - (ins VSrc_64:$src0, VReg_64:$src1, VReg_64:$src2, + (ins VSrc_64:$src0, VSrc_64:$src1, VSrc_64:$src2, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#" $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg", pattern >; -- cgit v1.2.3-18-g5258 From f767018b1048f228b0c2a71d7e4008750aff0ef5 Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Tue, 26 Feb 2013 17:52:42 +0000 Subject: R600/SI: add VOP mapping functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to map between e32 and e64 encoding opcodes. Signed-off-by: Christian König Reviewed-by: Tom Stellard git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176104 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index 3a617b4d93..d6c3f0623b 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -143,13 +143,17 @@ multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { // Vector ALU classes //===----------------------------------------------------------------------===// +class VOP { + string OpName = opName; +} + multiclass VOP1_Helper op, RegisterClass drc, RegisterClass src, string opName, list pattern> { - def _e32: VOP1 < + def _e32 : VOP1 < op, (outs drc:$dst), (ins src:$src0), opName#"_e32 $dst, $src0", pattern - >; + >, VOP ; def _e64 : VOP3 < {1, 1, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, @@ -158,7 +162,7 @@ multiclass VOP1_Helper op, RegisterClass drc, RegisterClass src, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#"_e64 $dst, $src0, $abs, $clamp, $omod, $neg", [] - > { + >, VOP { let SRC1 = SIOperand.ZERO; let SRC2 = SIOperand.ZERO; } @@ -175,7 +179,7 @@ multiclass VOP2_Helper op, RegisterClass vrc, RegisterClass arc, def _e32 : VOP2 < op, (outs vrc:$dst), (ins arc:$src0, vrc:$src1), opName#"_e32 $dst, $src0, $src1", pattern - >; + >, VOP ; def _e64 : VOP3 < {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, @@ -184,7 +188,7 @@ multiclass VOP2_Helper op, RegisterClass vrc, RegisterClass arc, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", [] - > { + >, VOP { let SRC2 = SIOperand.ZERO; } } @@ -200,7 +204,7 @@ multiclass VOP2b_32 op, string opName, list pattern> { def _e32 : VOP2 < op, (outs VReg_32:$dst), (ins VSrc_32:$src0, VReg_32:$src1), opName#"_e32 $dst, $src0, $src1", pattern - >; + >, VOP ; def _e64 : VOP3b < {1, 0, 0, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, @@ -209,7 +213,7 @@ multiclass VOP2b_32 op, string opName, list pattern> { i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#"_e64 $dst, $src0, $src1, $abs, $clamp, $omod, $neg", [] - > { + >, VOP { let SRC2 = SIOperand.ZERO; /* the VOP2 variant puts the carry out into VCC, the VOP3 variant can write it into any SGPR. We currently don't use the carry out, @@ -224,7 +228,7 @@ multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, def _e32 : VOPC < op, (ins arc:$src0, vrc:$src1), opName#"_e32 $dst, $src0, $src1", [] - >; + >, VOP ; def _e64 : VOP3 < {0, op{7}, op{6}, op{5}, op{4}, op{3}, op{2}, op{1}, op{0}}, @@ -236,7 +240,7 @@ multiclass VOPC_Helper op, RegisterClass vrc, RegisterClass arc, !if(!eq(!cast(cond), "COND_NULL"), [], [(set SReg_64:$dst, (i1 (setcc (vt arc:$src0), arc:$src1, cond)))] ) - > { + >, VOP { let SRC2 = SIOperand.ZERO; } } @@ -254,14 +258,14 @@ class VOP3_32 op, string opName, list pattern> : VOP3 < (ins VSrc_32:$src0, VSrc_32:$src1, VSrc_32:$src2, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#" $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg", pattern ->; +>, VOP ; class VOP3_64 op, string opName, list pattern> : VOP3 < op, (outs VReg_64:$dst), (ins VSrc_64:$src0, VSrc_64:$src1, VSrc_64:$src2, i32imm:$abs, i32imm:$clamp, i32imm:$omod, i32imm:$neg), opName#" $dst, $src0, $src1, $src2, $abs, $clamp, $omod, $neg", pattern ->; +>, VOP ; //===----------------------------------------------------------------------===// // Vector I/O classes @@ -319,4 +323,17 @@ class MIMG_Load_Helper op, string asm> : MIMG < let mayStore = 0; } +//===----------------------------------------------------------------------===// +// Vector instruction mappings +//===----------------------------------------------------------------------===// + +// Maps an opcode in e32 form to its e64 equivalent +def getVOPe64 : InstrMapping { + let FilterClass = "VOP"; + let RowFields = ["OpName"]; + let ColFields = ["Size"]; + let KeyCol = ["4"]; + let ValueCols = [["8"]]; +} + include "SIInstructions.td" -- cgit v1.2.3-18-g5258 From f4632b58c7df992e77a4be3927e7aa72c1235dff Mon Sep 17 00:00:00 2001 From: Christian Konig Date: Fri, 1 Mar 2013 09:46:17 +0000 Subject: R600/SI: remove GPR*AlignEncode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's much easier to specify the encoding with tablegen directly. Signed-off-by: Christian König git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176344 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/R600/SIInstrInfo.td | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'lib/Target/R600/SIInstrInfo.td') diff --git a/lib/Target/R600/SIInstrInfo.td b/lib/Target/R600/SIInstrInfo.td index d6c3f0623b..260c651dd4 100644 --- a/lib/Target/R600/SIInstrInfo.td +++ b/lib/Target/R600/SIInstrInfo.td @@ -53,16 +53,6 @@ def SIOperand { int VCC = 0x6A; } -class GPR4Align : Operand { - let EncoderMethod = "GPR4AlignEncode"; - let MIOperandInfo = (ops rc:$reg); -} - -class GPR2Align : Operand { - let EncoderMethod = "GPR2AlignEncode"; - let MIOperandInfo = (ops rc:$reg); -} - include "SIInstrFormats.td" //===----------------------------------------------------------------------===// @@ -128,13 +118,13 @@ class SOPK_64 op, string opName, list pattern> : SOPK < multiclass SMRD_Helper op, string asm, RegisterClass dstClass> { def _IMM : SMRD < op, 1, (outs dstClass:$dst), - (ins GPR2Align:$sbase, i32imm:$offset), + (ins SReg_64:$sbase, i32imm:$offset), asm#" $dst, $sbase, $offset", [] >; def _SGPR : SMRD < op, 0, (outs dstClass:$dst), - (ins GPR2Align:$sbase, SReg_32:$soff), + (ins SReg_64:$sbase, SReg_32:$soff), asm#" $dst, $sbase, $soff", [] >; } @@ -276,7 +266,7 @@ class MTBUF_Store_Helper op, string asm, RegisterClass regClass> : MTBU (outs), (ins regClass:$vdata, i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, - GPR4Align:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), + SReg_128:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), asm#" $vdata, $offset, $offen, $idxen, $glc, $addr64, $dfmt," #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", []> { @@ -288,7 +278,7 @@ class MUBUF_Load_Helper op, string asm, RegisterClass regClass> : MUBUF op, (outs regClass:$dst), (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, - i1imm:$lds, VReg_32:$vaddr, GPR4Align:$srsrc, i1imm:$slc, + i1imm:$lds, VReg_32:$vaddr, SReg_128:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), asm#" $dst, $offset, $offen, $idxen, $glc, $addr64, " #"$lds, $vaddr, $srsrc, $slc, $tfe, $soffset", @@ -301,7 +291,7 @@ class MTBUF_Load_Helper op, string asm, RegisterClass regClass> : MTBUF op, (outs regClass:$dst), (ins i16imm:$offset, i1imm:$offen, i1imm:$idxen, i1imm:$glc, i1imm:$addr64, - i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, GPR4Align:$srsrc, + i8imm:$dfmt, i8imm:$nfmt, VReg_32:$vaddr, SReg_128:$srsrc, i1imm:$slc, i1imm:$tfe, SSrc_32:$soffset), asm#" $dst, $offset, $offen, $idxen, $glc, $addr64, $dfmt," #" $nfmt, $vaddr, $srsrc, $slc, $tfe, $soffset", @@ -315,7 +305,7 @@ class MIMG_Load_Helper op, string asm> : MIMG < (outs VReg_128:$vdata), (ins i32imm:$dmask, i1imm:$unorm, i1imm:$glc, i1imm:$da, i1imm:$r128, i1imm:$tfe, i1imm:$lwe, i1imm:$slc, VReg_32:$vaddr, - GPR4Align:$srsrc, GPR4Align:$ssamp), + SReg_256:$srsrc, SReg_128:$ssamp), asm#" $vdata, $dmask, $unorm, $glc, $da, $r128," #" $tfe, $lwe, $slc, $vaddr, $srsrc, $ssamp", []> { -- cgit v1.2.3-18-g5258