Skip to content

x86: Fix register field encoding in VEX/EVEX prefix - #7564

Merged
0xdaryl merged 2 commits into
eclipse-omr:masterfrom
BradleyWood:reg_encoding
Dec 7, 2024
Merged

x86: Fix register field encoding in VEX/EVEX prefix#7564
0xdaryl merged 2 commits into
eclipse-omr:masterfrom
BradleyWood:reg_encoding

Conversation

@BradleyWood

Copy link
Copy Markdown
Contributor

No description provided.

@BradleyWood

Copy link
Copy Markdown
Contributor Author

@Spencer-Comin This change should fix the issues with pdep/pext instructions

@BradleyWood

Copy link
Copy Markdown
Contributor Author

jenkins build xlinux, x32linux

Comment thread compiler/x/amd64/codegen/OMRRealRegister.hpp
Comment thread compiler/x/amd64/codegen/OMRRealRegister.hpp
Comment thread compiler/x/amd64/codegen/OMRRealRegister.hpp
void setSource2ndRegisterFieldInEVEX(uint8_t *opcodeByte)
{
uint8_t regNum = ((_fullRegisterBinaryEncodings[_registerNumber].needsRexForByte << 3) | _fullRegisterBinaryEncodings[_registerNumber].id);
uint8_t regNum = ((_fullRegisterBinaryEncodings[_registerNumber].needsRexPlusRXB << 3) | _fullRegisterBinaryEncodings[_registerNumber].id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This change makes sense to me if you are updating the vvvv bits in P1. However, the code below seems to suggest that P1 is one byte beyond the opcodeByte, so now I am confused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Perhaps opcodeByte is poorly named. opcodeByte points to EVEX P1 in the instruction where vvvv bits are, not the literal opcode value.

uint8_t *evexP1 = opcodeByte + 1; should be P2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you do that renaming now as part of this PR please?

Bradley Wood added 2 commits December 5, 2024 12:52
Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
Signed-off-by: Bradley Wood <bradley.wood@ibm.com>
@BradleyWood

Copy link
Copy Markdown
Contributor Author

Fixed the 32-bit encoding, improved naming.

@0xdaryl

0xdaryl commented Dec 7, 2024

Copy link
Copy Markdown
Contributor

Jenkins build xlinux,win,osx,x32linux

@0xdaryl
0xdaryl merged commit 96d6a1d into eclipse-omr:master Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants