This is an archive of the discontinued LLVM Phabricator instance.

[X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting `not Y` into DAG. [#61038]
ClosedPublic

Authored by goldstein.w.n on Feb 28 2023, 10:09 AM.

Details

Summary

Previously not inserting the -1 in not Y (xor Y, -1) into the
DAG. Not inserting -1 as a DAG node comes up as a bug when doing
(xor (shl 1, A), B) -> (btc A, B). btc requires B (dst) to be
a register.

Diff Detail

Event Timeline

goldstein.w.n created this revision.Feb 28 2023, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 10:09 AM
goldstein.w.n requested review of this revision.Feb 28 2023, 10:09 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2023, 10:09 AM
goldstein.w.n retitled this revision from Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting `not Y` into DAG. [#61038] to [X86] Fix `(shift X, (xor Y, N-1))` -> `(shift X, (not Y))` by properly inserting `not Y` into DAG. [#61038].Feb 28 2023, 10:10 AM
goldstein.w.n added reviewers: RKSimon, pengfei, meheff.
RKSimon accepted this revision.Feb 28 2023, 10:38 AM
RKSimon added inline comments.
llvm/test/CodeGen/X86/pr61038.ll
5

remove the unused CHECK prefix and replace CHECK-X64-SKX/CHECK-X64-V4 with CHECK-X64-BMI2

This revision is now accepted and ready to land.Feb 28 2023, 10:38 AM
goldstein.w.n marked an inline comment as done.Feb 28 2023, 1:19 PM

Fix common check

RKSimon added inline comments.Feb 28 2023, 1:46 PM
llvm/test/CodeGen/X86/pr61038.ll
5

Remove CHECK-SKX / CHECK-V4

goldstein.w.n marked an inline comment as done.Feb 28 2023, 2:16 PM

Remove unused check