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

CodeGen: Use more efficient lowering for UNM_* #1177

Closed
wants to merge 1 commit into from
Closed

Conversation

zeux
Copy link
Collaborator

@zeux zeux commented Mar 2, 2024

UNM_NUM and UNM_VEC were both implemented assuming SSE-style restrictions (2-argument form), but using AVX that doesn't have them. There's no need to copy source to destination separately - we can just vxorpd into destination.

Most occurrences of UNM_NUM/UNM_VEC followed the self-xor path, but this saves a couple instructions in trig benchmark and makes it execute ~0.1% fewer instructions (the actual runtime delta is within the noise).

UNM_NUM and UNM_VEC were both implemented assuming SSE-style
restrictions (2-argument form), but using AVX that doesn't have them.
There's no need to copy source to destination separately - we can just
vxorpd into destination.

Most occurrences of UNM_NUM/UNM_VEC followed the self-xor path, but this
saves a couple instructions in trig benchmark and makes it execute ~0.1%
fewer instructions (the actual runtime delta is within the noise).
build.vxorpd(inst.regX64, inst.regX64, build.f64(-0.0));
}

build.vxorpd(inst.regX64, regOp(inst.a), build.f64(-0.0));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please flag the changes, as we are raising code flagging requirements internally.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing this, feel free to make this change internally.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have added these changes internally.

@zeux zeux closed this Mar 4, 2024
@zeux zeux deleted the unm-opt branch March 4, 2024 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants