-
Notifications
You must be signed in to change notification settings - Fork 396
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
Provide support for LZCNT and TZCNT in X86Ops.ins #6978
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for supporting the project, and congratulations on your first contribution! A project committer will shortly review your contribution. In the mean time, if you haven't had a chance please skim over the contribution guidelines which all pull requests must adhere to. If the ECA pull request check fails, have a look at the instructions for signing the ECA in the legal considerations section.
If you run into any problems our community will be happy to assist you in any way we can. There are a number of recommended ways to interact with the community. We encourage you to ask questions, or drop by to say hello.
@BradleyWood : please review |
Thanks for the contribution. Could you add encodings for the other register sizes as well please? i.e., 16, 32, and 64-bit |
Can you add binary encoding tests like the following?
Edit: You'll have to fix the formatting above |
Yes, I will add support for the 16 and 32- bit also. Current implementation is only supporting 64 bits. Thanks |
d172057
to
86b469f
Compare
86b469f
to
da54bc3
Compare
Hi Bradley, Also I have added the test cases for the instructions as suggested. Currently I have added EAX,ECX register pair(in the same order) for testing. Please let us know if we need some other test cases added. |
@@ -695,6 +695,14 @@ INSTANTIATE_TEST_CASE_P(AVX512MaskRegSimdEVEX512Test, XRegRegEncEncodingTest, :: | |||
std::make_tuple(TR::InstOpCode::VPMOVB2MRegReg, TR::RealRegister::k2, TR::RealRegister::xmm5, OMR::X86::EVEX_L128, "62f27e0829d5") | |||
))); | |||
|
|||
INSTANTIATE_TEST_CASE_P(GeneralPurposeRegRegTest, XRegRegEncEncodingTest, ::testing::ValuesIn(*TRTest::MakeVector<std::tuple<TR::InstOpCode::Mnemonic, TR::RealRegister::RegNum, TR::RealRegister::RegNum, OMR::X86::Encoding, TRTest::BinaryInstruction>>( | |||
std::make_tuple(TR::InstOpCode::LZCNT4RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f30fbdc1"), | |||
std::make_tuple(TR::InstOpCode::LZCNT8RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f34c0fbdc1"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f34c0fbdc1
equates to lzcnt r8,rcx
which does not match the specified registers
std::make_tuple(TR::InstOpCode::LZCNT8RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f34c0fbdc1"), | ||
|
||
std::make_tuple(TR::InstOpCode::TZCNT4RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f30fbcc1"), | ||
std::make_tuple(TR::InstOpCode::TZCNT8RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f34c0fbcc1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'f34c0fbcc1' equates to tzcnt r8,rcx
which does not match the specified registers
da54bc3
to
bbfea5c
Compare
Hi, |
Corrected the test cases' binary encoding string |
jenkins build all |
compiler/x/codegen/X86Ops.ins
Outdated
@@ -2545,6 +2545,21 @@ INSTRUCTION(LEA8RegMem, lea, | |||
PROPERTY0(IA32OpProp_ModifiesTarget), | |||
PROPERTY1(IA32OpProp1_LongSource | IA32OpProp1_LongTarget | IA32OpProp1_SourceIsMemRef), | |||
FEATURES(0)), | |||
INSTRUCTION(LZCNT2RegReg, lzcnt, | |||
BINARY(VEX_L___, VEX_vNONE, PREFIX_F3, REX__, ESCAPE_0F__, 0xbd, 0, ModRM_RM__, Immediate_0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This form should require the operand size override 0x66 prefix. Perhaps a question for @BradleyWood: in this encoding scheme, how does one encode an instruction that requires both a 0x66 and a 0xf3 prefix? Do we need a new PREFIX_66_F3 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look over the code, as it currently stands you cannot use both prefixes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR #7020 was merged which provides the capability of specifying multiple prefixes. @VidushiGit, you should pick up that change and use it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@0xdaryl Pulled the latest OMR code changes and added the support/usage for multiple instruction prefixes
compiler/x/codegen/X86Ops.ins
Outdated
@@ -5144,6 +5159,21 @@ INSTRUCTION(TEST8MemReg, test, | |||
PROPERTY0(IA32OpProp_ModifiesOverflowFlag | IA32OpProp_ModifiesSignFlag | IA32OpProp_ModifiesZeroFlag | IA32OpProp_ModifiesParityFlag | IA32OpProp_ModifiesCarryFlag | IA32OpProp_UsesTarget), | |||
PROPERTY1(IA32OpProp1_LongSource | IA32OpProp1_LongTarget | IA32OpProp1_FusableCompare), | |||
FEATURES(0)), | |||
INSTRUCTION(TZCNT2RegReg, tzcnt, | |||
BINARY(VEX_L___, VEX_vNONE, PREFIX_F3, REX__, ESCAPE_0F__, 0xbc, 0, ModRM_RM__, Immediate_0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above for the operand size prefix.
std::make_tuple(TR::InstOpCode::LZCNT8RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f3480fbdc1"), | ||
|
||
std::make_tuple(TR::InstOpCode::TZCNT4RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f30fbcc1"), | ||
std::make_tuple(TR::InstOpCode::TZCNT8RegReg, TR::RealRegister::eax, TR::RealRegister::ecx, OMR::X86::Default, "f3480fbcc1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add tests for the 16-bit versions as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for 16-bit version of the instruction
bbfea5c
to
7186e94
Compare
7186e94
to
1177897
Compare
jenkins build all |
MacOS failure is #6516 |
No description provided.