This is an archive of the discontinued LLVM Phabricator instance.

[X86] Ensure the _mm_test_all_ones macro does not reuse argument (PR60006)
ClosedPublic

Authored by RKSimon on Jan 24 2023, 7:55 AM.

Details

Summary

The macro _mm_test_all_ones(V) was defined as _mm_testc_si128((V), _mm_cmpeq_epi32((V), (V))) - which could cause side effects depending on the source of the V value.

The _mm_cmpeq_epi32((V), (V)) trick was just to materialize an all-ones value, which can be more safely generated with _mm_set1_epi32(-1) .

Fixes #60006

Diff Detail

Event Timeline

RKSimon created this revision.Jan 24 2023, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2023, 7:55 AM
RKSimon requested review of this revision.Jan 24 2023, 7:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 24 2023, 7:55 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
This revision is now accepted and ready to land.Jan 24 2023, 5:32 PM
This revision was landed with ongoing or failed builds.Jan 25 2023, 2:56 AM
This revision was automatically updated to reflect the committed changes.