This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add instruction selection for i1 to f16 conversion
ClosedPublic

Authored by critson on Sep 13 2018, 1:02 AM.

Details

Summary

This is required for GPUs with 16 bit instructions where f16 is a
legal register type and hence int_to_fp i1 to f16 is not lowered
by legalizing.

Change-Id: Ie4c0fd6ced7cf10ad612023c6879724d9ded5851

Diff Detail

Repository
rL LLVM

Event Timeline

critson created this revision.Sep 13 2018, 1:02 AM

What about sitofp?

Why the detour via V_CVT_F16_F32 instead of selecting an fp16 1.0 constant directly?

critson updated this revision to Diff 165512.Sep 14 2018, 8:04 AM
critson edited the summary of this revision. (Show Details)

Add support and test for sint_to_fp.

Why the detour via V_CVT_F16_F32 instead of selecting an fp16 1.0 constant directly?

It is not possible select an fp16 constant with V_CNDMASK_B32.
In principle the VOP2 version could be used to select an inline literal, but only when the i1 is vcc.

nhaehnle accepted this revision.Sep 17 2018, 3:08 AM

Why the detour via V_CVT_F16_F32 instead of selecting an fp16 1.0 constant directly?

It is not possible select an fp16 constant with V_CNDMASK_B32.
In principle the VOP2 version could be used to select an inline literal, but only when the i1 is vcc.

Oh yeah, that makes sense.

Thanks for the sitofp change, LGTM.

This revision is now accepted and ready to land.Sep 17 2018, 3:08 AM
This revision was automatically updated to reflect the committed changes.