Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple issues in new subject for arm64 ldX instructions #1078

Open
rfalke opened this issue Sep 9, 2021 · 1 comment
Open

Multiple issues in new subject for arm64 ldX instructions #1078

rfalke opened this issue Sep 9, 2021 · 1 comment

Comments

@rfalke
Copy link

rfalke commented Sep 9, 2021

Version: 0.10.0.0

Subject: https://github.com/rfalke/decompiler-subjects/tree/master/from_holdec/arm64_ldX

reko_AArch64Dis.tests

// This file contains unit tests automatically generated by Reko decompiler.
// Please copy the contents of this file and report it on GitHub, using the 
// following URL: https://github.com/uxmal/reko/issues

// Reko: a decoder for the instruction 0070404C at address 0000000100002884 has not been implemented. (Nyi AdvancedSimdLdStMultiple L:opcode=1:0111)
[Test]
public void AArch64Dis_0070404C()
{
    AssertCode("@@@", "0070404C");
}
// Reko: a decoder for the instruction 007C404C at address 00000001000028E0 has not been implemented. (Nyi AdvancedSimdLdStMultiple L:opcode=1:0111)
[Test]
public void AArch64Dis_007C404C()
{
    AssertCode("@@@", "007C404C");
}
// Reko: a decoder for the instruction 007C400C at address 000000010000293C has not been implemented. (Nyi AdvancedSimdLdStMultiple L:opcode=1:0111)
[Test]
public void AArch64Dis_007C400C()
{
    AssertCode("@@@", "007C400C");
}
// Reko: a decoder for the instruction 00A0404C at address 0000000100002998 has not been implemented. (Nyi AdvancedSimdLdStMultiple L:opcode=1:1010)
[Test]
public void AArch64Dis_00A0404C()
{
    AssertCode("@@@", "00A0404C");
}
// Reko: a decoder for the instruction 0020404C at address 00000001000029F4 has not been implemented. (Nyi AdvancedSimdLdStMultiple L:opcode=1:0010)
[Test]
public void AArch64Dis_0020404C()
{
    AssertCode("@@@", "0020404C");
}
// Reko: a decoder for the instruction 0084400D at address 0000000100002B08 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=100)
[Test]
public void AArch64Dis_0084400D()
{
    AssertCode("@@@", "0084400D");
}
// Reko: a decoder for the instruction 0084404D at address 0000000100002B64 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=100)
[Test]
public void AArch64Dis_0084404D()
{
    AssertCode("@@@", "0084404D");
}
// Reko: a decoder for the instruction 0004604D at address 0000000100002E44 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_0004604D()
{
    AssertCode("@@@", "0004604D");
}
// Reko: a decoder for the instruction 0084600D at address 0000000100002EA0 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_0084600D()
{
    AssertCode("@@@", "0084600D");
}
// Reko: a decoder for the instruction 0084604D at address 0000000100002EFC has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_0084604D()
{
    AssertCode("@@@", "0084604D");
}
// Reko: a decoder for the instruction 00C0604D at address 0000000100002F58 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_00C0604D()
{
    AssertCode("@@@", "00C0604D");
}
// Reko: a decoder for the instruction 00C4600D at address 0000000100002FB4 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_00C4600D()
{
    AssertCode("@@@", "00C4600D");
}
// Reko: a decoder for the instruction 0024404D at address 0000000100003124 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=001)
[Test]
public void AArch64Dis_0024404D()
{
    AssertCode("@@@", "0024404D");
}
// Reko: a decoder for the instruction 00A4400D at address 0000000100003180 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=101)
[Test]
public void AArch64Dis_00A4400D()
{
    AssertCode("@@@", "00A4400D");
}
// Reko: a decoder for the instruction 00A4404D at address 00000001000031DC has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=101)
[Test]
public void AArch64Dis_00A4404D()
{
    AssertCode("@@@", "00A4404D");
}
// Reko: a decoder for the instruction 00E0404D at address 0000000100003238 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=111)
[Test]
public void AArch64Dis_00E0404D()
{
    AssertCode("@@@", "00E0404D");
}
// Reko: a decoder for the instruction 00E4400D at address 0000000100003294 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 0 opcode=111)
[Test]
public void AArch64Dis_00E4400D()
{
    AssertCode("@@@", "00E4400D");
}
// Reko: a decoder for the instruction 0024604D at address 0000000100003404 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_0024604D()
{
    AssertCode("@@@", "0024604D");
}
// Reko: a decoder for the instruction 00A4600D at address 0000000100003460 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_00A4600D()
{
    AssertCode("@@@", "00A4600D");
}
// Reko: a decoder for the instruction 00A4604D at address 00000001000034BC has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_00A4604D()
{
    AssertCode("@@@", "00A4604D");
}
// Reko: a decoder for the instruction 00E0604D at address 0000000100003518 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_00E0604D()
{
    AssertCode("@@@", "00E0604D");
}
// Reko: a decoder for the instruction 00E4600D at address 0000000100003574 has not been implemented. (Nyi AdvancedSimdLdStSingleStructure L:R=1 1)
[Test]
public void AArch64Dis_00E4600D()
{
    AssertCode("@@@", "00E4600D");
}

reko_AArch64Rw.tests

// This file contains unit tests automatically generated by Reko decompiler.
// Please copy the contents of this file and report it on GitHub, using the 
// following URL: https://github.com/uxmal/reko/issues

        [Test]
        public void AArch64Rw_Nyi()
        {
            Given_HexString("0070404C");
            AssertCode(     // Nyi
                "0|L--|0000000100002884(4): 1 instructions",
                "1|L--|@@@");
        }

        [Test]
        public void AArch64Rw_ld1()
        {
            Given_HexString("0000400D");
            AssertCode(     // ld1	{v0.b}[0],[x0]
                "0|L--|0000000100002A50(4): 1 instructions",
                "1|L--|@@@");
        }

incomplete _main

The code contains 1.5 test but there are 38 tests.

Simplify __cmeq(q0, q0)

It is true and therefore 0xfff...

Remove call to __cmeq(q0, q0) if value is unused

Eq_2 _full_load_with_ldr(Eq_1346 (** x0)[], struct Eq_25 * x1, struct Eq_26 * x2, Eq_2 q0, Eq_2 q1, Eq_2 q2, Eq_2 q3, union Eq_2 & q2Out, union Eq_2 & q3Out)
{
	__cmeq(q0, q0);
...

Generate warning in generated source code about unknown instruction

Generated source code:

void _full_load_with_byte_wise_ld1(Eq_2 q0, Eq_2 q1, Eq_2 q2, Eq_2 q3)
{
	__cmeq(q0, q0);
	__cmeq(q1, q1);
	__cmeq(q2, q2);
	__cmeq(q3, q3);
}

Output:

0000000100002884: warning: AArch64 instruction Nyi is not supported yet.

Asm:

0000000100002874 <_full_load_with_byte_wise_ld1>:
100002874: 00 8c 20 6e  cmeq.16b        v0, v0, v0
100002878: 21 8c 21 6e  cmeq.16b        v1, v1, v1
10000287c: 42 8c 22 6e  cmeq.16b        v2, v2, v2
100002880: 63 8c 23 6e  cmeq.16b        v3, v3, v3
100002884: 00 70 40 4c  ld1.16b { v0 }, [x0]

IMHO Reko should generate a warning in the source code:

void _full_load_with_byte_wise_ld1(Eq_2 q0, Eq_2 q1, Eq_2 q2, Eq_2 q3)
{
	__cmeq(q0, q0);
	__cmeq(q1, q1);
	__cmeq(q2, q2);
	__cmeq(q3, q3);
       // WARNING: decompilation incomplete because of unknown instruction
}
@rfalke
Copy link
Author

rfalke commented Sep 10, 2023

Status for version 0.11.4.0-931ca7d

incomplete _main

The code now contains 5.5 tests which is more than the previous 1.5 but still missing a lot since there are 38 tests in the source code.

Simplify __cmeq(q0, q0)

It is true and therefore 0xfff...

Is still an issue.

Remove call to __cmeq(q0, q0) if value is unused

This seems fixed.

Should generate warning in generated source code about unknown instruction

This is still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant