alexcrichton opened PR #6060 from x64fix-avx2-but-no-avx
to main
:
This commit fixes a corner case in the emission of the
vbroadcasts{s,d}
instructions. The memory-to-xmm form of these instructions was available with the AVX instruction set, but the xmm-to-xmm form of these instructions wasn't available until AVX2. The instruction requirement for these are listed as AVX but the lowering rules are appropriately annotated to use either AVX2 or AVX when appropriate.While this should work in practice this didn't work for the assertion about enabled features for each instruction. The
vbroadcastss
instruction was listed as requiring AVX but could get emitted when AVX2 was enabled (due to the reg-to-reg form being available). This caused an issue for the fuzzer where AVX2 was enabled but AVX was disabled.One possible fix would be to add more opcodes, one for reg-to-reg and one for mem-to-reg. That seemed like somewhat overkill for a pretty niche situation that shouldn't actually come up in practice anywhere. Instead this commit changes all the
has_avx
accessors to theuse_avx_simd
predicate already available in the target flags. Theuse_avx2_simd
predicate was then updated to additionally requirehas_avx
, so if AVX2 is enabled and AVX is disabled then thevbroadcastss
instruction won't get emitted any more.Closes #6059
<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
cfallin submitted PR review.
abrown submitted PR review.
alexcrichton updated PR #6060 from x64fix-avx2-but-no-avx
to main
.
alexcrichton has enabled auto merge for PR #6060.
alexcrichton merged PR #6060.
Last updated: Nov 22 2024 at 16:03 UTC