This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Use SOPK compare instructions
ClosedPublic

Authored by arsenm on Sep 6 2016, 9:35 AM.

Details

Diff Detail

Event Timeline

arsenm updated this revision to Diff 70423.Sep 6 2016, 9:35 AM
arsenm retitled this revision from to AMDGPU: Use SOPK compare instructions.
arsenm updated this object.
arsenm added a reviewer: tstellarAMD.
arsenm added subscribers: llvm-commits, Restricted Project.

Mostly looks good to me, but one question and I think there is a bug, see inline.

lib/Target/AMDGPU/SIShrinkInstructions.cpp
239–240

Why isn't there similar treatment for SOPKOpc == AMDGPU::S_CMPK_EQ_U32 or ..._LG_U32? Are only the I32 variants selected previously? If so, that should probably be mentioned in the comment.

255–258

I think you need a !TII->sopkIsZext test to go with the isKImmOperand test (consider what happens if you get s_cmp_lt_u32 op1, -1).

test/CodeGen/AMDGPU/sopk-compares.ll
336–341

This test looks wrong to me. -32768 is 0xffff8000, but s_cmpk_lt_u32 will not sign-extend.

arsenm updated this revision to Diff 71408.Sep 14 2016, 11:53 AM

Fix unsigned bug, add verifier check

arsenm marked 2 inline comments as done.Sep 14 2016, 11:53 AM
nhaehnle accepted this revision.Sep 16 2016, 2:14 PM
nhaehnle added a reviewer: nhaehnle.

LGTM

This revision is now accepted and ready to land.Sep 16 2016, 2:14 PM
arsenm closed this revision.Sep 16 2016, 2:57 PM

r281780