Skip to content

Refactor X86 binary encoding to support encoding form override - #6488

Merged
0xdaryl merged 6 commits into
eclipse-omr:masterfrom
BradleyWood:x86ops
May 10, 2022
Merged

0xdaryl merged 6 commits into
eclipse-omr:masterfrom
BradleyWood:x86ops

Conversation

@BradleyWood

@BradleyWood BradleyWood commented Apr 21, 2022 •

Copy link
Copy Markdown
Contributor

Issue #6107: encoding method sse/avx decision removed from binary encoding. Binary encoding tests can now be performed on hardware that does not support the instruction
Issue #6268: Now supports AVX-512 EVEX encoding of existing opcodes

@BradleyWood

Copy link
Copy Markdown
Contributor Author

@0xdaryl Can you take a look?

@0xdaryl 0xdaryl left a comment

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.

Looks pretty good. One minor comment.

Comment thread compiler/x/codegen/OMRInstOpCode.cpp Resolved

if ((getOpCode().isEvexInstruction() && getEncodingMethod() != OMR::X86::Legacy) || getEncodingMethod() >= OMR::X86::EVEX_L128)
{
toRealRegister(getTargetRegister())->setSource2ndRegisterFieldInEVEX(cursor - 4);

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.

I identified that this logic does not hold if the EVEX only supports 2-operands (such as movdqu).

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.

Added an instruction flag to indicate the the opcode is unary, even when EVEX encoded.

@BradleyWood
BradleyWood force-pushed the x86ops branch 2 times, most recently from 5ec3320 to 1a1571b Compare April 26, 2022 19:07
@BradleyWood
BradleyWood marked this pull request as ready for review April 26, 2022 19:09
@BradleyWood

Copy link
Copy Markdown
Contributor Author

@0xdaryl I added a number of tests and resolved and issue for EVEX encoded movdqu opcodes.

See the force-push

@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

BradleyWood added 3 commits May 4, 2022 11:40
Signed-off-by: BradleyWood <bradley.wood@ibm.com>
Signed-off-by: BradleyWood <bradley.wood@ibm.com>
Signed-off-by: BradleyWood <bradley.wood@ibm.com>
@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

@0xdaryl

0xdaryl commented May 6, 2022

Copy link
Copy Markdown
Contributor

Jenkins build osx,riscv

@0xdaryl 0xdaryl self-assigned this May 6, 2022
Comment thread compiler/x/codegen/OMRInstOpCode.hpp Outdated
#define IA32OpProp1_SetsCCForCompare 0x00000010
#define IA32OpProp1_SetsCCForTest 0x00000020
#define IA32OpProp1_SupportsLockPrefix 0x00000040
#define IA32OpProp1_SIMDUnary 0x00000080

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.

When does a "SIMDUnary" property apply to an opcode? Most of the opcodes you've applied this to would not be considered "unary" operations in the traditional sense (e.g., loads and stores). I'm worried either the name is confusing or is being applied too broadly. Can you comment on when you expect it to apply (and perhaps add that documentation as a comment here)?

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 it can be renamed, the point was to indicate that opcode cannot have a second source operand. Many of the opcodes binary opcodes are used with only two operands, but when they are VEX/EVEX encoded, the target becomes the second source. However, the instruction is illegal, if a second source is specified for the EVEX encoding variants when there shouldn't be one.

@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

Comment thread compiler/x/codegen/OMRInstOpCode.hpp Outdated
#define IA32OpProp1_SetsCCForCompare 0x00000010
#define IA32OpProp1_SetsCCForTest 0x00000020
#define IA32OpProp1_SupportsLockPrefix 0x00000040
#define IA32OpProp1_SIMDSingleSRC 0x00000080

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.

I like the name, but not the abbreviation. For consistency with the other defines that refer to the source operand can you expand it to "Source"? This define would then be the same length as the following one that does use the full word, so the abbreviation doesn't seem justified.

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.

See the force-push

BradleyWood added 3 commits May 10, 2022 07:54
Signed-off-by: BradleyWood <bradley.wood@ibm.com>
Some vector instructions (for int64 and double types)
need REX.W1 for EVEX encoding. The W bit is ignored
for AVX/AVX2 verserions.

Signed-off-by: BradleyWood <bradley.wood@ibm.com>
Signed-off-by: BradleyWood <bradley.wood@ibm.com>
@BradleyWood

Copy link
Copy Markdown
Contributor Author

Jenkins build all

@0xdaryl

0xdaryl commented May 10, 2022

Copy link
Copy Markdown
Contributor

Jenkins build zos,zlinux

@0xdaryl

0xdaryl commented May 10, 2022

Copy link
Copy Markdown
Contributor

Neither Z failure is related to this PR.

@0xdaryl
0xdaryl merged commit 50323d4 into eclipse-omr:master May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants