This is an archive of the discontinued LLVM Phabricator instance.

[GSel]: Support Widening G_ICMP's destination operand.
ClosedPublic

Authored by aditya_nandakumar on Jul 21 2017, 2:10 PM.

Diff Detail

Event Timeline

Added support for G_FCMP as well.

volkan added a subscriber: volkan.Jul 26 2017, 3:50 AM

Could you add a test case or an explanation if it's not possible to add a test case?

lib/CodeGen/GlobalISel/LegalizerHelper.cpp
611

Could you use local variables for the operands to reduce duplication?

617

The result type is boolean. Why do we need to build a G_FPTRUNC instead of G_TRUNC?

630

Same here.

aditya_nandakumar marked an inline comment as done.Jul 26 2017, 3:04 PM
aditya_nandakumar added inline comments.
lib/CodeGen/GlobalISel/LegalizerHelper.cpp
617

Good point. I used G_FPTRUNC to be consistent - but I guess it makes more sense to use G_TRUNC here. I'll update it.

Updated based on feedback.

volkan edited edge metadata.

LGTM except:

  • Missing test case
  • The title needs be updated

Updated AArch64 G_ICMP/FCMP's destination to be widened to s16. Also updated the test cases.

t.p.northover edited edge metadata.Jul 28 2017, 7:11 PM

AArch64 has no 16-bit instructions (at least outside the SIMD unit). The first sensible type to legalize to is s32.

Updated to legalize to s32. (Based on Tim's comment).

t.p.northover accepted this revision.Jul 31 2017, 9:27 AM

Thanks. Looks reasonable to me.

This revision is now accepted and ready to land.Jul 31 2017, 9:27 AM

Landed in r309579