Skip to content

Conversation

@folkertdev
Copy link
Contributor

No description provided.

@rustbot
Copy link
Collaborator

rustbot commented Nov 27, 2025

r? @sayantn

rustbot has assigned @sayantn.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Comment on lines +5310 to +5314
// NOTE: `vflls` and `vldeb` are equivalent; our disassmbler prefers vflls.
#[cfg_attr(
all(test, target_feature = "vector-enhancements-1"),
assert_instr(vflls)
)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@uweigand

just checking, is that correct? this implementation produces vldeb on godbolt, so I really think it's the disassembler that is picking vflls here.

Choose a reason for hiding this comment

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

Yes, the two are equivalent; in fact the binary machine code is identical, it's just different assembler mnemonics for the same instruction. Both vldeb v1, v2 and vflls v1, v2 are simply extended mnemonics for the "base" instruction vfll v1, v2, 0, 0 (see the PoP chapter 24 under VECTOR FP LOAD LENGTHENED). It's a bit unfortunate to have two mnemonics for the same thing, but it's due to historical reasons (vflls is the more recent one, and probably should be preferred).

Comment on lines -5325 to +5327
simd_shuffle(
truncated,
truncated,
const { u32x4::from_array([0, 0, 1, 1]) },
)
simd_shuffle!(truncated, truncated, [0, 0, 1, 1])
Copy link
Contributor Author

Choose a reason for hiding this comment

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

and here, vec_floate does not specify what happens to the odd elements. clang + llvm end up using poison values, but rust does not have those. So, is there anything that can be done?

this is not all that important of course, but it's a bit of a wart.

Choose a reason for hiding this comment

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

Yes, it's deliberately left unspecified what happens to the odd elements. This matches the behavior of the underlying VECTOR FP LOAD ROUNDED instruction, which also states: "The data in the odd elements of the first operand is unpredictable." You could mask it to some defined value, but at extra runtime cost of course.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, well there is nothing we can do then. There is always inline assembly if someone really needs to emit the exact instruction.

@sayantn sayantn added this pull request to the merge queue Nov 30, 2025
Merged via the queue into rust-lang:main with commit 7fb504f Nov 30, 2025
73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants