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

cmd/vendor/golang.org/x/arch/arm: several issues in ARM disassembler's plan9 syntax #23159

Open
benshi001 opened this issue Dec 17, 2017 · 7 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@benshi001
Copy link
Member

Though the ARM disassembler can decode most instruction binaries into gnu syntax correctly, there are several issues in plan9 syntax decoding.

  1. op name
    15f715e7| 1 plan9 SDIV R7, R5, R5
    It should be "DIV R7, R5, R5", and many others are also incorrect.
    MLA should be MULA
    UDIV should be DIVU
    ......

  2. LDM/STM
    ed003be9| 1 plan9 LDMDB [R0,R2-R3,R5-R7], R11!
    2.1 their op name should be MOVM
    2.2 () should be used instead of []
    2.3 The DB/IA/DA/IB suffixes should be decoded to .W/.P suffixes

  3. SWP/SWPB
    939007e1| 1 plan9 SWP [R7], R3, R9
    3.1. () should be used instead of []
    3.2 The parameter order is incorrect

  4. VMRS/VMSR
    109ae1ee| 1 plan9 VMSR R9, FPSCR
    The op name is incorrect

  5. FP instructions
    5.1 op name: VADD.F32->ADDF, VSUB.F64->SUBD, ......
    5.2 register name: S2->F1, S4->F2, ...
    5.3 vcvt has incorrect form
    5.4 vmov has incorrect form

  6. XTB/XTH/XTBU/XTHU should be MOVB/MOVH

  7. STREX/LDREX has incorrect parameter order

  8. XTAB/XTAH/XTABU/XTAHU has incorrect form

@ALTree ALTree added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 18, 2017
@ALTree ALTree added this to the Go1.11 milestone Dec 18, 2017
@benshi001
Copy link
Member Author

  1. VFMA/VNFMA like instructions are not support

    decode_test.go:66: Decode(002aa1ee|) [gnu] = error: unknown instruction, 0, want FMULF F0, F1, F2, 4
    decode_test.go:66: Decode(202aa1ee|) [gnu] = error: unknown instruction, 0, want FMULF S1, F1, F2, 4
    decode_test.go:66: Decode(802aa1ee|) [gnu] = error: unknown instruction, 0, want FMULF F0, S3, F2, 4
    decode_test.go:66: Decode(002ae1ee|) [gnu] = error: unknown instruction, 0, want FMULF F0, F1, S5, 4
    decode_test.go:66: Decode(035ba40e|) [gnu] = error: unknown instruction, 0, want FMULD.EQ F3, F4, F5, 4
    decode_test.go:66: Decode(002aa21e|) [gnu] = error: unknown instruction, 0, want FMULF.NE F0, F2, F2, 4
    decode_test.go:66: Decode(035ba5ee|) [gnu] = error: unknown instruction, 0, want FMULD F3, F5, F5, 4

The GNU tool chain support them.
8: eea12a00 vfma.f32 s4, s2, s0
c: eea12a20 vfma.f32 s4, s2, s1
10: eea12a80 vfma.f32 s4, s3, s0
14: eee12a00 vfma.f32 s5, s2, s0
18: eea45b03 vfma.f64 d5, d4, d3
1c: eea22a00 vfma.f32 s4, s4, s0
20: eea55b03 vfma.f64 d5, d5, d3

@benshi001
Copy link
Member Author

Most issues are fixed in https://go-review.googlesource.com/c/arch/+/85455, except

  1. LDM/STM -> MOVM
  2. plan9 name: MLA->MULA, UDIV->DIVU, ...
  3. VFMA/VNFMA support

@benshi001
Copy link
Member Author

Remaining issue after https://go-review.googlesource.com/c/arch/+/85455 is merged.

  1. LDM/STM -> MOVM
  2. plan9 name: MLA->MULA, UDIV->DIVU, ...
  3. VFMA/VNFMA support
  4. 0xe6a98877 is decoded to "SXTAB R7@>$16, R9, R8", with an unnecessary '$'

@benshi001 benshi001 modified the milestones: Go1.11, Unplanned May 21, 2018
@benshi001 benshi001 self-assigned this May 21, 2018
@benshi001
Copy link
Member Author

This issue is not quite critical, since normal arm developers still can understand with those minor inconsistency.

@smasher164
Copy link
Member

Do you mind if I take a look at adding VFMA/VNFMA support for Go 1.12?

@heisen-li
Copy link
Contributor

Do you accept the repair of these problems now?

@benshi001
Copy link
Member Author

benshi001 commented Jun 28, 2020

Do you accept the repair of these problems now?

Any fix is appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants