This is an archive of the discontinued LLVM Phabricator instance.

[SveEmitter] Fix encoding/decoding of SVETypeFlags
ClosedPublic

Authored by sdesmalen on Mar 23 2020, 8:17 AM.

Details

Summary

This issue was introduced when reworking D75861. The bug isn't
actually hit with current unit tests because the contiguous loads/stores
infer the EltType and the MemEltType from the pointer and result, rather
than using the flags. But it will be needed for other intrinsics, such as
gather/scatter.

Diff Detail

Event Timeline

sdesmalen created this revision.Mar 23 2020, 8:17 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 23 2020, 8:17 AM
andwar added a subscriber: andwar.Mar 23 2020, 11:29 AM

Cheers for the fix @sdesmalen !

clang/include/clang/Basic/TargetBuiltins.h
187

EltTypeShift and MemEltTypeShift are initialised twice in one constructor.

If removing them from the member initialisation list throws a warning, perhaps you could use in-class initialisers?

Patches with functional changes but without tests are a bit "suspicious". In this case, I see it might be tricky. You could argue that it should be incorporated in the patch that includes the tests, so we can see what's happening. But perhaps separating this out is cleaner, if the other patch is big. But can you at least make the next patch dependent on this one, so we know where this is used?

Patches with functional changes but without tests are a bit "suspicious". In this case, I see it might be tricky. You could argue that it should be incorporated in the patch that includes the tests, so we can see what's happening. But perhaps separating this out is cleaner, if the other patch is big. But can you at least make the next patch dependent on this one, so we know where this is used?

Yes you're right, the patch that I've made dependent needs this one to work properly.

Yes you're right, the patch that I've made dependent needs this one to work properly.

Ah ok, I may have missed that, will have a look

sdesmalen updated this revision to Diff 254148.Apr 1 2020, 3:29 AM
sdesmalen marked an inline comment as done.
  • Made Flags uint64_t instead of unsigned.
  • Simplified encoding of flags in SveEmitter and moved encoding of properties into the Flags variable to the constructor of Intrinsic.
  • Added (encoding of) MergeType as well.
SjoerdMeijer added inline comments.Apr 3 2020, 3:22 AM
clang/utils/TableGen/SveEmitter.cpp
247

Should V now be an uint64_t?

sdesmalen updated this revision to Diff 254832.Apr 3 2020, 9:00 AM
sdesmalen marked an inline comment as done.
  • Updated encode functions to take/return uint64_t instead of unsigned.
sdesmalen added inline comments.Apr 3 2020, 9:02 AM
clang/utils/TableGen/SveEmitter.cpp
247

Yes, good spot!

SjoerdMeijer accepted this revision.Apr 6 2020, 12:39 AM

Cheers, LGTM

This revision is now accepted and ready to land.Apr 6 2020, 12:39 AM
andwar added inline comments.Apr 6 2020, 3:17 AM
clang/utils/TableGen/SveEmitter.cpp
258

Shouldn't MT be uint64_t instead of unsigned?

sdesmalen updated this revision to Diff 255276.Apr 6 2020, 3:51 AM

Changed unsigned -> uint64_t for encodeMemoryElementType and encodeMergeType.

sdesmalen marked an inline comment as done.Apr 6 2020, 3:51 AM
andwar added a comment.Apr 6 2020, 4:04 AM

LGTM

This patch now implements a bit more than the original commit message would suggest. Could you please update? Thanks for working on this!

This revision was automatically updated to reflect the committed changes.