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/internal/obj/arm: optimize MVN/MOVW #20493

Closed
benshi001 opened this issue May 25, 2017 · 5 comments
Closed

cmd/internal/obj/arm: optimize MVN/MOVW #20493

benshi001 opened this issue May 25, 2017 · 5 comments
Milestone

Comments

@benshi001
Copy link
Member

benshi001 commented May 25, 2017

As discussion in issue #19844, optimization can be get with "MOVW $imm-16, Reg". But there is also a "MVN $imme-16, Reg" introduced in ARMV7, which may do potential optimization.

For example, "MOVW $0xffffaaaa, R1" will use constant pool, but it can optimize to a single word "MVN $0x5555, R1".

I create this issue and will try it in go-1.10.

@cherrymui cherrymui added this to the Go1.10 milestone May 25, 2017
@benshi001
Copy link
Member Author

The second issue, "MVN $0xffffffaa, R0" is assembled to
"MVN $0x55, R11
MVN R11, R1"
Actually a single "MOVW $0x55, R1" is more efficient.

@benshi001
Copy link
Member Author

MOVT is worthy to try again.

@benshi001
Copy link
Member Author

  1. MVN $imm-16, Reg
  2. "MVN $0xffffffaa, R0" -> "MOVW $0x55, R1"
  3. MOVT $imm-16, Reg

Try them again in Go1.10.

@benshi001
Copy link
Member Author

Sorry, it is my fault. There is no form "MVN $imm-16, Reg".

We need try only

  1. "MVN $0xffffffaa, Rx" -> "MOVW $0x55, Rx"
  2. "MOVW $imm32, Rx" -> "MOVW $lower-16-bits, Rx" & ""MOVT $upper-16-bits, Rx"

@benshi001 benshi001 changed the title cmd/internal/obj/arm: optimize with "MVN $imm-16, Reg" cmd/internal/obj/arm: optimize MVN/MOVW Jul 5, 2017
@benshi001
Copy link
Member Author

fixed in commit 75cb22c

@golang golang locked and limited conversation to collaborators Aug 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants