This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/SI: Fix LowerParameter() for i16 arguments
ClosedPublic

Authored by tstellarAMD on Oct 3 2016, 10:35 AM.

Details

Summary

If we are loading an i16 value from a 32-bit memory location, then
we need to be able to truncate the loaded value to i16.

Event Timeline

tstellarAMD retitled this revision from to AMDGPU/SI: Fix LowerParameter() for i16 arguments.
tstellarAMD updated this object.
tstellarAMD added a reviewer: arsenm.
tstellarAMD added a subscriber: llvm-commits.
arsenm added inline comments.Oct 3 2016, 6:00 PM
lib/Target/AMDGPU/SIISelLowering.cpp
587–592

When is the trunc case necessary? Since the FP case only needs to handle extend this looks weird to me

tstellarAMD added inline comments.Oct 7 2016, 3:54 PM
lib/Target/AMDGPU/SIISelLowering.cpp
587–592

Trunc is required when VT is MVT::i16 and MemVT is MVT::i32.

lib/Target/AMDGPU/SIISelLowering.cpp
587–592

This happens for mesa, because 16-bit kernel arguments are stored as 32-bit values in the kernarg buffer.

arsenm added inline comments.Oct 13 2016, 6:56 PM
lib/Target/AMDGPU/SIISelLowering.cpp
587–592

So shouldn't it have the same problem with f16 and need to fptrunc it?

lib/Target/AMDGPU/SIISelLowering.cpp
587–592

No, because f16 values are always 16-bits in memory. i16/i8 are just a special case when using the mesa ABI, since those areguments are sign/zero extended by the runtime.

arsenm accepted this revision.Oct 17 2016, 9:12 AM
arsenm edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 17 2016, 9:12 AM
This revision was automatically updated to reflect the committed changes.