jsdec icon indicating copy to clipboard operation
jsdec copied to clipboard

Support RISC-V floating-point extensions (F, D, Q) in decompiler

Open dnpetrov-sc opened this issue 3 years ago • 0 comments

Floating-point instructions are currently decompiled to __asm statements. Example (from Whetstone benchmark):

    a2 = 0;
label_0:
    a4 = a1;
    do {
        __asm ("fadd.d ft2, ft1, ft2");
        __asm ("fadd.d ft2, ft2, ft0");
        __asm ("fsub.d ft2, ft2, ft3");
        __asm ("fmul.d ft2, ft2, fa0");
        __asm ("fsub.d ft1, ft1, ft0");
        __asm ("fadd.d ft1, ft1, ft3");
        __asm ("fadd.d ft1, ft1, ft2");
        __asm ("fmul.d ft1, ft1, fa0");
        __asm ("fadd.d ft0, ft3, ft0");
        __asm ("fadd.d ft0, ft0, ft2");
        __asm ("fsub.d ft0, ft0, ft1");
        __asm ("fmul.d ft0, ft0, fa0");
        __asm ("fsub.d ft3, ft3, ft2");
        __asm ("fadd.d ft3, ft3, ft1");
        __asm ("fadd.d ft3, ft3, ft0");
        a4 += -1;
        __asm ("fmul.d ft3, ft3, fa0");
    } while (a4 != 0);
    a2++;
    __asm ("fsub.d fa0, ft4, fa0");
    if (a2 != a0) {
        goto label_0;
    }

dnpetrov-sc avatar Apr 28 '22 10:04 dnpetrov-sc