This is an archive of the discontinued LLVM Phabricator instance.

[libc] Silence integer shortening warnings on NVPTX masks
ClosedPublic

Authored by jhuber6 on Aug 9 2023, 2:02 PM.

Details

Summary

Nvidia uses a 32-bit mask, but we store it in a common 64-bit integer to
provide it with a compatible ABI with the AMD implementaiton which may
use a 64-bit mask. Silence these warnings by explicitly casting to the
smaller value, we know this is always legal as the result will always
fit into the smaller value if it was generated on NVPTX.

Diff Detail

Event Timeline

jhuber6 created this revision.Aug 9 2023, 2:02 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 9 2023, 2:02 PM
jhuber6 requested review of this revision.Aug 9 2023, 2:02 PM
sivachandra accepted this revision.Aug 9 2023, 2:20 PM
sivachandra added inline comments.
libc/src/__support/GPU/nvptx/utils.h
119

May be cast the return value of this builtin also?

This revision is now accepted and ready to land.Aug 9 2023, 2:20 PM
jhuber6 added inline comments.Aug 9 2023, 3:17 PM
libc/src/__support/GPU/nvptx/utils.h
119

This should return a 32-bit value on the target.

This revision was automatically updated to reflect the committed changes.