Changeset 4783 in CLRX


Ignore:
Timestamp:
Jul 15, 2019, 12:27:30 PM (9 months ago)
Author:
matszpk
Message:

CLRadeonExtender: GCNDisasm: Fixed printing addr for FLAT SCRATCH instructions (GFX10). Add FLAT SCRATCH testcases for GFX10.

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/GCNDisasmDecode.cpp

    r4782 r4783  
    25562556
    25572557// routine to print FLAT address including 'off' for GCN 1.4
    2558 void GCNDisasmUtils::printFLATAddr(cxuint flatMode, char*& bufPtr, uint32_t insnCode2)
     2558void GCNDisasmUtils::printFLATAddr(cxuint flatMode, char*& bufPtr, uint32_t insnCode2,
     2559                                   cxuint nullCode)
    25592560{
    25602561    const cxuint vaddr = insnCode2&0xff;
     
    25672568    else if (flatMode == GCN_FLAT_SCRATCH)
    25682569    {
    2569         if (((insnCode2>>16)&0x7f) == 0x7f)
     2570        if (((insnCode2>>16)&0x7f) == nullCode)
    25702571            decodeGCNVRegOperand(vaddr, 1, bufPtr); // addr
    25712572        else // no vaddr
     
    25782579            uint32_t insnCode2)
    25792580{
    2580     const bool isGCN14 = ((arch&ARCH_GCN_1_4_5)!=0);
     2581    const bool isGCN14 = ((arch&ARCH_GCN_1_4)!=0);
    25812582    const bool isGCN15 = ((arch&ARCH_GCN_1_5)!=0);
    25822583    FastOutputBuffer& output = dasm.output;
     
    25922593    const cxuint flatMode = gcnInsn.mode & GCN_FLAT_MODEMASK;
    25932594    // add tfe extra register if needed
    2594     dstRegsNum = (!isGCN14 && (insnCode2 & 0x800000U)) ? dstRegsNum+1 : dstRegsNum;
    2595    
     2595    dstRegsNum = (!isGCN14 && !isGCN15 && (insnCode2 & 0x800000U)) ?
     2596                        dstRegsNum+1 : dstRegsNum;
     2597   
     2598    const cxuint nullCode = isGCN15 ? 0x7d : 0x7f;
    25962599    bool printAddr = false;
    25972600    if ((gcnInsn.mode & GCN_FLAT_ADST) == 0)
     
    26012604        decodeGCNVRegOperand(insnCode2>>24, dstRegsNum, bufPtr);
    26022605        putCommaSpace(bufPtr);
    2603         printFLATAddr(flatMode, bufPtr, insnCode2);
     2606        printFLATAddr(flatMode, bufPtr, insnCode2, nullCode);
    26042607        printAddr = true;
    26052608    }
     
    26072610    {
    26082611        /* two vregs, because 64-bitness stored in PTR32 mode (at runtime) */
    2609         printFLATAddr(flatMode, bufPtr, insnCode2);
     2612        printFLATAddr(flatMode, bufPtr, insnCode2, nullCode);
    26102613        printAddr = true;
    26112614        if ((gcnInsn.mode & GCN_FLAT_NODST) == 0)
     
    26442647    const cxint instOffset = (flatMode != 0 && (insnCode&0x1000) != 0 && !isGCN15) ?
    26452648                -4096+(insnCode&offsetMask) : insnCode&offsetMask;
    2646     if (isGCN14 && instOffset != 0)
     2649    if ((isGCN14 || isGCN15) && instOffset != 0)
    26472650    {
    26482651        putChars(bufPtr, " inst_offset:", 13);
     
    26512654   
    26522655    // print other modifers
    2653     if (isGCN14 && !isGCN15 && (insnCode & 0x2000U))
     2656    if (isGCN14 && (insnCode & 0x2000U))
    26542657        putChars(bufPtr, " lds", 4);
    26552658    if (isGCN15 && (insnCode & 0x1000U))
     
    26612664    if (insnCode2 & 0x800000U)
    26622665    {
    2663         if (!isGCN14)
     2666        if (!isGCN14 && !isGCN15)
    26642667            putChars(bufPtr, " tfe", 4);
    26652668        else
  • CLRadeonExtender/trunk/amdasm/GCNDisasmInternals.h

    r4757 r4783  
    122122             uint32_t insnCode2);
    123123
    124     static void printFLATAddr(cxuint flatMode, char*& bufPtr, uint32_t insnCode2);
     124    static void printFLATAddr(cxuint flatMode, char*& bufPtr, uint32_t insnCode2,
     125                              cxuint nullCode);
    125126   
    126127    static void decodeFLATEncoding(GCNDisassembler& dasm, cxuint spacesToAdd,
  • CLRadeonExtender/trunk/tests/amdasm/GCNDisasmOpc15.cpp

    r4782 r4783  
    34643464    { 0xdd9f0000U, 0x2f7d00bbU, true, "        FLAT_ill_103    "
    34653465                "v47, v[187:188], v0 glc slc\n" },
    3466     /*{ 0xdc234000U, 0x2f7d00bbU, true, "        scratch_load_ubyte "
    3467                 "v47, v[187:188] glc slc\n" },*/
     3466    /* FLAT SCRATCH encoding */
     3467    { 0xdc234000U, 0x2f7d00bbU, true, "        scratch_load_ubyte "
     3468                "v47, v187, off glc slc\n" },
     3469    { 0xdc234000U, 0x2f5300bbU, true, "        scratch_load_ubyte "
     3470                "v47, off, s83 glc slc\n" },
     3471    { 0xdc234563U, 0x2f530000U, true, "        scratch_load_ubyte "
     3472                "v47, off, s83 inst_offset:1379 glc slc\n" },
     3473    { 0xdc234d63U, 0x2f530000U, true, "        scratch_load_ubyte "
     3474                "v47, off, s83 inst_offset:1379 glc slc\n" },
     3475    /* FLAT SCRATCH instructions */
     3476    { 0xdc274000U, 0x2f7d00bbU, true, "        scratch_load_sbyte "
     3477                "v47, v187, off glc slc\n" },
     3478    { 0xdc2b4000U, 0x2f7d00bbU, true, "        scratch_load_ushort "
     3479                "v47, v187, off glc slc\n" },
     3480    { 0xdc2f4000U, 0x2f7d00bbU, true, "        scratch_load_sshort "
     3481                "v47, v187, off glc slc\n" },
     3482    { 0xdc334000U, 0x2f7d00bbU, true, "        scratch_load_dword "
     3483                "v47, v187, off glc slc\n" },
     3484    { 0xdc374000U, 0x2f7d00bbU, true, "        scratch_load_dwordx2 "
     3485                "v[47:48], v187, off glc slc\n" },
     3486    { 0xdc3b4000U, 0x2f7d00bbU, true, "        scratch_load_dwordx4 "
     3487                "v[47:50], v187, off glc slc\n" },
     3488    { 0xdc3f4000U, 0x2f7d00bbU, true, "        scratch_load_dwordx3 "
     3489                "v[47:49], v187, off glc slc\n" },
     3490    { 0xdc634000U, 0x007d39bbU, true, "        scratch_store_byte "
     3491                "v187, v57, off glc slc\n" },
     3492    { 0xdc674000U, 0x007d39bbU, true, "        scratch_store_byte_d16_hi "
     3493                "v187, v57, off glc slc\n" },
     3494    { 0xdc6b4000U, 0x007d39bbU, true, "        scratch_store_short "
     3495                "v187, v57, off glc slc\n" },
     3496    { 0xdc6f4000U, 0x007d39bbU, true, "        scratch_store_short_d16_hi "
     3497                "v187, v57, off glc slc\n" },
     3498    { 0xdc734000U, 0x007d39bbU, true, "        scratch_store_dword "
     3499                "v187, v57, off glc slc\n" },
     3500    { 0xdc774000U, 0x007d39bbU, true, "        scratch_store_dwordx2 "
     3501                "v187, v[57:58], off glc slc\n" },
     3502    { 0xdc7b4000U, 0x007d39bbU, true, "        scratch_store_dwordx4 "
     3503                "v187, v[57:60], off glc slc\n" },
     3504    { 0xdc7f4000U, 0x007d39bbU, true, "        scratch_store_dwordx3 "
     3505                "v187, v[57:59], off glc slc\n" },
     3506    { 0xdc834000U, 0x2f7d00bbU, true, "        scratch_load_ubyte_d16 "
     3507                "v47, v187, off glc slc\n" },
     3508    { 0xdc874000U, 0x2f7d00bbU, true, "        scratch_load_ubyte_d16_hi "
     3509                "v47, v187, off glc slc\n" },
     3510    { 0xdc8b4000U, 0x2f7d00bbU, true, "        scratch_load_sbyte_d16 "
     3511                "v47, v187, off glc slc\n" },
     3512    { 0xdc8f4000U, 0x2f7d00bbU, true, "        scratch_load_sbyte_d16_hi "
     3513                "v47, v187, off glc slc\n" },
     3514    { 0xdc934000U, 0x2f7d00bbU, true, "        scratch_load_short_d16 "
     3515                "v47, v187, off glc slc\n" },
     3516    { 0xdc974000U, 0x2f7d00bbU, true, "        scratch_load_short_d16_hi "
     3517                "v47, v187, off glc slc\n" },
    34683518    { 0, 0, false, nullptr }
    34693519};
Note: See TracChangeset for help on using the changeset viewer.