Changeset 1660 in CLRX


Ignore:
Timestamp:
Nov 5, 2015, 7:26:28 PM (5 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Accepts expressions for the register numbers inside [] (for example: v[xreg:xreg+1]).

Location:
CLRadeonExtender/trunk
Files:
4 edited

Legend:

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

    r1551 r1660  
    13891389                    stack.pop();
    13901390                }
    1391                 if (stack.empty() || stack.top().op != AsmExprOp::CHOICE_START ||
     1391                if (stack.empty())
     1392                {
     1393                    linePtr--; // go back to ':'
     1394                    expectedToken = XT_OP;
     1395                    doExit = true;
     1396                    break;
     1397                }
     1398                else if (stack.top().op != AsmExprOp::CHOICE_START ||
    13921399                        stack.top().priority != priority)
    13931400                {   // not found
  • CLRadeonExtender/trunk/amdasm/GCNAsmHelpers.cpp

    r1527 r1660  
    9999    {   // many registers
    100100        ++linePtr;
    101         cxuint value1, value2;
     101        uint64_t value1, value2;
    102102        skipSpacesToEnd(linePtr, end);
    103         value1 = cstrtobyte(linePtr, end);
     103        if (!getAbsoluteValueArg(asmr, value1, linePtr, true))
     104            return false;
    104105        skipSpacesToEnd(linePtr, end);
    105106        if (linePtr == end || (*linePtr!=':' && *linePtr!=']'))
     
    111112        {
    112113            skipCharAndSpacesToEnd(linePtr, end);
    113             value2 = cstrtobyte(linePtr, end);
     114            if (!getAbsoluteValueArg(asmr, value2, linePtr, true))
     115                return false;
    114116        }
    115117        else
     
    127129        {   // error (illegal register range)
    128130            asmr.printError(vgprRangePlace, "Illegal vector register range");
     131            return false;
     132        }
     133        if (value1 >= 256 || value2 >= 256)
     134        {
     135            asmr.printError(vgprRangePlace, "Some vector register number out of range");
    129136            return false;
    130137        }
     
    322329    {   // many registers
    323330        ++linePtr;
    324         cxuint value1, value2;
     331        uint64_t value1, value2;
    325332        skipSpacesToEnd(linePtr, end);
    326         value1 = cstrtobyte(linePtr, end);
     333        if (!getAbsoluteValueArg(asmr, value1, linePtr, true))
     334            return false;
    327335        skipSpacesToEnd(linePtr, end);
    328336        if (linePtr == end || (*linePtr!=':' && *linePtr!=']'))
     
    336344        {
    337345            skipCharAndSpacesToEnd(linePtr, end);
    338             value2 = cstrtobyte(linePtr, end);
     346            if (!getAbsoluteValueArg(asmr, value2, linePtr, true))
     347                return false;
    339348        }
    340349        else
  • CLRadeonExtender/trunk/tests/amdasm/AsmExprParse.cpp

    r1282 r1660  
    373373    { "1+8(*9", "", false, 0, "<stdin>:1:4: Error: Expected operator\n", "" },
    374374    { "1+8*9;", "1 8 9 * +", true, 73, "", ";" }, // no error
    375     { "1+8*9:", "", false, 0, "<stdin>:1:6: Error: Missing '?' before ':'\n"
    376         "<stdin>:1:7: Error: Unterminated expression\n", "" },
     375    { "1+8*9:", "1 8 9 * +", true, 73, "", ":" }, // no error
     376    { "1+8*9    :  ", "1 8 9 * +", true, 73, "", ":  " }, // no error
    377377    { "1+8*9'", "1 8 9 * +", true, 73, "", "'" }, // no error
    378378    { "1+8*9#", "1 8 9 * +", true, 73, "", "" }, // no error
     
    393393        "<stdin>:1:11: Error: Missing ')'\n"
    394394        "<stdin>:1:11: Error: Unterminated expression\n", "" },
    395     { "a*(a?b+c):x", "", false, 0, "<stdin>:1:10: Error: Missing '?' before ':'\n", "" },
    396395    { "a*a?(b+c:x)", "", false, 0, "<stdin>:1:9: Error: Missing '?' before ':'\n"
    397396        "<stdin>:1:4: Error: Missing ':' for '?'\n", "" },
     
    402401    /* random */
    403402    { "a+?5:cd:4%2Qf:hab<;<@", "", false, 0,
    404         "<stdin>:1:3: Error: Expected primary expression before operator\n"
    405         "<stdin>:1:5: Error: Missing '?' before ':'\n"
    406         "<stdin>:1:8: Error: Missing '?' before ':'\n", "Qf:hab<;<@" },
     403        "<stdin>:1:3: Error: Expected primary expression before operator\n",
     404        ":cd:4%2Qf:hab<;<@" },
    407405    { "( ala + .,. )", "", false, 0, "<stdin>:1:11: Error: Garbages at end of expression\n"
    408406        "<stdin>:1:12: Error: Garbages at end of expression\n", "" },
  • CLRadeonExtender/trunk/tests/amdasm/GCNAsmOpc11.cpp

    r1571 r1660  
    3838    { "    s_add_u32  s[21:21], s4, s61", 0x80153d04U, 0, false, true, "" },
    3939    { "    s_add_u32  s[21], s[4], s[61]", 0x80153d04U, 0, false, true, "" },
     40    { "zx=21; ss=2; b=60;s_add_u32  s[zx], s[ss*2], s[b+1]",
     41            0x80153d04U, 0, false, true, "" },
    4042    { "    s_add_u32  s21, s4, 0", 0x80158004U, 0, false, true, "" },
    4143    { "    s_add_u32  s21, s4, 1", 0x80158104U, 0, false, true, "" },
     
    7072    /* 64-bit registers and literals */
    7173    { "    s_xor_b64 s[22:23], s[4:5], s[62:63]\n", 0x89963e04U, 0, false, true, "" },
     74    { "s1=22; s2=4;s3=62;s_xor_b64 s[s1:s1+1], s[s2:s2+1], s[s3:s3+1]\n",
     75        0x89963e04U, 0, false, true, "" },
    7276    { "    s_xor_b64 vcc, s[4:5], s[62:63]\n", 0x89ea3e04U, 0, false, true, "" },
    7377    { "    s_xor_b64 tba, s[4:5], s[62:63]\n", 0x89ec3e04U, 0, false, true, "" },
     
    113117        "test.s:1:16: Error: Illegal TTMPRegister range\n" },
    114118    { "    s_add_u32  s[z], s4, s61", 0, 0, false, false,
    115         "test.s:1:18: Error: Missing number\n"
    116         "test.s:1:18: Error: Expected ',' before argument\n" },
     119        "test.s:1:18: Error: Expression have unresolved symbol 'z'\n"
     120        "test.s:1:19: Error: Expected ',' before argument\n" },
    117121    { "    s_add_u32  ttmp[z], s4, s61", 0, 0, false, false,
    118         "test.s:1:21: Error: Missing number\n"
    119         "test.s:1:21: Error: Expected ',' before argument\n" },
     122        "test.s:1:21: Error: Expression have unresolved symbol 'z'\n"
     123        "test.s:1:22: Error: Expected ',' before argument\n" },
    120124    { "    s_add_u32  sxzz, s4, s61", 0, 0, false, false,
    121125        "test.s:1:16: Error: Expected 1 scalar register\n"
     
    575579        "test.s:1:32: Error: Required 1 vector register\n" },
    576580    { "    v_cndmask_b32   v[154:, v21, v107, vcc", 0, 0, false, false,
    577         "test.s:1:27: Error: Missing number\n" },
     581        "test.s:1:27: Error: Expected expression\n" },
    578582    { "    v_cndmask_b32   v[14, v21, v107, vcc", 0, 0, false, false,
    579583        "test.s:1:21: Error: Unterminated vector register range\n" },
     
    584588        "test.s:1:24: Error: Expected ',' before argument\n" },
    585589    { "    v_cndmask_b32   v[255:256], v21, v107, vcc", 0, 0, false, false,
    586         "test.s:1:29: Error: Number is too big\n"
    587         "test.s:1:29: Error: Expected ',' before argument\n" },
     590        "test.s:1:21: Error: Some vector register number out of range\n" },
    588591    { "    v_add_f32  v154, v21, v107 mul,", 0, 0, false, false,
    589592        "test.s:1:35: Error: Expected ':' before multiplier number\n"
     
    898901        "test.s:1:5: Error: Literal in VOP3 encoding is illegal\n" },
    899902    { "    v_rcp_f64  v[158:], v[79:80]", 0, 0, false, false,
    900         "test.s:1:22: Error: Missing number\n"
     903        "test.s:1:22: Error: Expected expression\n"
    901904        "test.s:1:22: Error: Expected ',' before argument\n" },
    902905    { "    v_rcp_f64  v[158:159, v[79:80]", 0, 0, false, false,
Note: See TracChangeset for help on using the changeset viewer.