This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Change boolean content type to 0 or 1
ClosedPublic

Authored by arsenm on Nov 14 2019, 4:14 AM.

Details

Reviewers
rampitec
Summary

The usage of target boolean checks is overly inflexible, since sext
and zext of a compare are equally cheap. The choice is arbitrary, but
using 0/1 to some degree is the choice of lower resistance since
that's what most targets use. This enables a few combines that don't
bother to support ZeroOrNegativeOneBooleanContent.

Diff Detail

Event Timeline

arsenm created this revision.Nov 14 2019, 4:14 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2019, 4:14 AM

What about patterns like these:

def : GCNPat <
  (i1 (add i1:$src0, (i1 -1))),
  (S_NOT_B64 $src0)
>;

def : GCNPat <
  (i1 (sub i1:$src0, (i1 -1))),
  (S_NOT_B64 $src0)
>;

will -1 still be generated or will we get 1's now and miss these patterns?

What about patterns like these:

def : GCNPat <
  (i1 (add i1:$src0, (i1 -1))),
  (S_NOT_B64 $src0)
>;

def : GCNPat <
  (i1 (sub i1:$src0, (i1 -1))),
  (S_NOT_B64 $src0)
>;

will -1 still be generated or will we get 1's now and miss these patterns?

The target boolean content doesn't influence this context. There's no extension here.

rampitec accepted this revision.Nov 14 2019, 11:49 PM

LGTM then.

This revision is now accepted and ready to land.Nov 14 2019, 11:49 PM