Skip to content

Standardize vbitselect operand ordering across platforms - #7935

Merged
hzongaro merged 1 commit into
eclipse-omr:masterfrom
ehsankianifar:Z_FixVbitselectEvaluator
Nov 3, 2025
Merged

Standardize vbitselect operand ordering across platforms#7935
hzongaro merged 1 commit into
eclipse-omr:masterfrom
ehsankianifar:Z_FixVbitselectEvaluator

Conversation

@ehsankianifar

@ehsankianifar ehsankianifar commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

Standardized the operand ordering for the vbitselect opcode to match
the convention used by other select opcodes across all supported
platforms. In the new schema, child 1 is the selector, child 2 is the
value selected when the selector is set, and child 3 is the value
selected when the selector is unset.

@ehsankianifar

Copy link
Copy Markdown
Contributor Author

@r30shah when I was running the unit tests, I got a failure in vbitselect tests and created the #7910 issue. When investigating, I find that the result values are the opposite of what the tests expected and can be fixed by swapping the two source registers.
Please take a look and let me know if it can be merged. Thanks.

Comment thread compiler/z/codegen/OMRTreeEvaluator.cpp Outdated
TR::Register *returnVecReg = cg->allocateRegister(TR_VRF);

generateVRReInstruction(cg, TR::InstOpCode::VSEL, node, returnVecReg, firstVecReg, secondVecReg, vecSelectReg, 0,
generateVRReInstruction(cg, TR::InstOpCode::VSEL, node, returnVecReg, secondVecReg, firstVecReg, vecSelectReg, 0,

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 think it is incorrect to drive the evaluator behavior based on the test outcome. It should be driven by the vbitselect operation - Does the operation requires us to select the bits from first child for the bits set to one in third child and use the bits from second child for the bits set to 0.

To me it seems counter-intuitive to swap the children.

Please check what the opcode is suppose to do and fix accordingly.

This comment was marked as outdated.

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 updated the implementation to match other ternary evaluators

@ehsankianifar
ehsankianifar force-pushed the Z_FixVbitselectEvaluator branch from 692f7cc to ed0f6d8 Compare September 17, 2025 18:19
@ehsankianifar
ehsankianifar force-pushed the Z_FixVbitselectEvaluator branch from ed0f6d8 to b08699c Compare September 17, 2025 18:22
@ehsankianifar
ehsankianifar force-pushed the Z_FixVbitselectEvaluator branch from b08699c to 95e6ad1 Compare October 20, 2025 20:36
@ehsankianifar ehsankianifar changed the title Z: Swap vbitselectEvaluator sources Standardize vbitselect operand ordering across platforms Oct 20, 2025
@ehsankianifar

Copy link
Copy Markdown
Contributor Author

@gita-omr I updated the vselectbit opcode implementation on all platforms as we discussed earlier today. Could you please take a look and trigger the jenkins tests?

Standardized the operand ordering for the vbitselect opcode to match
the convention used by other select opcodes across all supported
platforms. In the new schema, child 1 is the selector, child 2 is the
value selected when the selector is set, and child 3 is the value
selected when the selector is unset.

signed-off-by: Ehsan Kiani Far <ehsan.kianifar@gmail.com>
@ehsankianifar
ehsankianifar force-pushed the Z_FixVbitselectEvaluator branch from 95e6ad1 to 340ffa3 Compare October 21, 2025 18:42
@gita-omr

Copy link
Copy Markdown
Contributor

Jenkins build all

@ehsankianifar

ehsankianifar commented Oct 21, 2025

Copy link
Copy Markdown
Contributor Author

@ehsankianifar

Copy link
Copy Markdown
Contributor Author

Hi @BradleyWood
Could you please take a look at the the changes for x86? Thanks.

@gita-omr

Copy link
Copy Markdown
Contributor

Reviewed all changes except Intel and they look good to me.

@BradleyWood BradleyWood 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.

I reviewed and approve from an x86 perspective.

@knn-k knn-k 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.

AArch64 part LGTM

@ehsankianifar

Copy link
Copy Markdown
Contributor Author

Hi @hzongaro,
Could you please take a look and merge if it looks good to you? thanks.

@hzongaro

Copy link
Copy Markdown
Contributor

Could you please take a look and merge if it looks good to you? thanks.

I'll rely on the reviews of the various platform experts rather than rereviewing myself.

@r30shah, have you had a chance to verify that your comment has been addressed? If so, and the pull request looks good to you, may I ask you to indicate your approval?

@gita-omr, I see that you indicated above that the changes looked good to you - may I ask you to mark your review as approved?

@r30shah r30shah 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.

LGTM - Thanks @ehsankianifar for taking this up and fix on all platform.

@hzongaro

hzongaro commented Nov 3, 2025

Copy link
Copy Markdown
Contributor

Failure running linux_ppc-64_le_gcc testing appears to be due to known issue #6571.
Failure running linux_riscv64 testing appears to be due to known issue #7971.
Failure running osx_x86-64 testing appears to be due to known issue #6516.

Merging.

@hzongaro
hzongaro merged commit 25ab585 into eclipse-omr:master Nov 3, 2025
11 of 14 checks passed
@ehsankianifar
ehsankianifar deleted the Z_FixVbitselectEvaluator branch August 17, 2026 14:27
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.

7 participants