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

GCC emits superfluous movt r#, 0x0 instructions #61

Open
jar opened this issue Dec 31, 2015 · 0 comments
Open

GCC emits superfluous movt r#, 0x0 instructions #61

jar opened this issue Dec 31, 2015 · 0 comments

Comments

@jar
Copy link

jar commented Dec 31, 2015

GCC emits the instruction pair...

mov r#, 0x####
movt r#, 0x####

for loading a 32-bit value into a register. When the compile-time value is less than 16-bits, the movt instruction is unnecessary since the mov (immediate) instruction will load the full value and zero the high bits.

For example, I find this pattern a lot in compiled code:

mov r#, 0x####
movt r#, 0x0

The emitted code for the movt is larger than necessary and performance takes a small hit.

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