[PATCH] R600: improve dump of S_WAITCNT
Vincent Lejeune
vljn at ovi.com
Thu Oct 10 09:30:34 PDT 2013
Here is an updated version.
----- Mail original -----
> De : Tom Stellard <tom at stellard.net>
> À : Vincent Lejeune <vljn at ovi.com>
> Cc : llvm-commits at cs.uiuc.edu
> Envoyé le : Jeudi 10 octobre 2013 15h57
> Objet : Re: [PATCH] R600: improve dump of S_WAITCNT
>
> On Thu, Oct 10, 2013 at 12:05:06AM +0200, Vincent Lejeune wrote:
>> ---
>> lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp | 11 +++++++++++
>> lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h | 1 +
>> lib/Target/R600/SIInstructions.td | 4 +++-
>> 3 files changed, 15 insertions(+), 1 deletion(-)
>
> Can you add a check for the new assembly format in one of the .ll tests.
>
>>
>> diff --git a/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
> b/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
>> index fac3c39..d91eda6 100644
>> --- a/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
>> +++ b/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.cpp
>> @@ -255,4 +255,15 @@ void AMDGPUInstPrinter::printKCache(const MCInst *MI,
> unsigned OpNo,
>> }
>> }
>>
>> +void AMDGPUInstPrinter::printWaitFlag(const MCInst *MI, unsigned OpNo,
>> + raw_ostream &O) {
>> + unsigned SImm16 = MI->getOperand(OpNo).getImm();
>> + unsigned VMCount = SImm16 & 15;
>> + unsigned ExportWrite = (SImm16 >> 4) & 15;
>> + unsigned LGKMCnt = (SImm16 >> 8) & 15;
>> + O << "vmcount(" << VMCount << ")
> ";
>> + O << "& ExportWrite(" << ExportWrite <<
> ") ";
>> + O << "& LGKM_CNT(" << LGKMCnt <<
> ")";
>> +}
>> +
>
> I think we should try to match the assembly output used by the shader
> analyzer. This means changing:
>
> vmcount => vmcnt
> ExportWrite => expcnt
> LGMK_CNT => lgkmcnt
>
> Also, if all the bits for one of the fields are set, it should be omitted.
>
> -Tom
>
>
>> #include "AMDGPUGenAsmWriter.inc"
>> diff --git a/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h
> b/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h
>> index 4c1dfa6..3524b30 100644
>> --- a/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h
>> +++ b/lib/Target/R600/InstPrinter/AMDGPUInstPrinter.h
>> @@ -52,6 +52,7 @@ private:
>> void printRSel(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>> void printCT(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>> void printKCache(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>> + void printWaitFlag(const MCInst *MI, unsigned OpNo, raw_ostream &O);
>> };
>>
>> } // End namespace llvm
>> diff --git a/lib/Target/R600/SIInstructions.td
> b/lib/Target/R600/SIInstructions.td
>> index 99fedcb..4dfaa16 100644
>> --- a/lib/Target/R600/SIInstructions.td
>> +++ b/lib/Target/R600/SIInstructions.td
>> @@ -25,6 +25,8 @@ def InterpSlot : Operand<i32> {
>> def isSI : Predicate<"Subtarget.getGeneration() "
>> "==
> AMDGPUSubtarget::SOUTHERN_ISLANDS">;
>>
>> +def WAIT_FLAG : InstFlag<"printWaitFlag">;
>> +
>> let Predicates = [isSI] in {
>>
>> let neverHasSideEffects = 1 in {
>> @@ -815,7 +817,7 @@ def S_BARRIER : SOPP <0x0000000a, (ins),
> "S_BARRIER",
>> let mayStore = 1;
>> }
>>
>> -def S_WAITCNT : SOPP <0x0000000c, (ins i32imm:$simm16), "S_WAITCNT
> $simm16",
>> +def S_WAITCNT : SOPP <0x0000000c, (ins WAIT_FLAG:$simm16),
> "S_WAITCNT $simm16",
>> []
>> >;
>> } // End hasSideEffects
>> --
>> 1.8.3.1
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-R600-improve-dump-of-S_WAITCNT.patch
Type: text/x-patch
Size: 4676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131010/3871d2df/attachment.bin>
More information about the llvm-commits
mailing list