This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Avoid creating redundant ubfx when selecting G_ZEXT
ClosedPublic

Authored by paquette on Jun 15 2020, 4:49 PM.

Details

Summary

When selecting 32 b -> 64 b G_ZEXTs, we don't have to always emit the extend.

If the instruction feeding into the G_ZEXT implicitly zero extends the high half of the register, we can just emit a SUBREG_TO_REG instead.

This gives some minor code size improvements on SPECINT2000:

test-suite...INT2000/164.gzip/164.gzip.test -0.7%
test-suite...T2000/300.twolf/300.twolf.test -0.2%
test-suite...T2000/256.bzip2/256.bzip2.test -0.1%
test-suite...000/186.crafty/186.crafty.test -0.1%
test-suite.../CINT2000/176.gcc/176.gcc.test -0.1%
test-suite.../CINT2000/175.vpr/175.vpr.test -0.1%
test-suite...0/253.perlbmk/253.perlbmk.test -0.1%
test-suite...000/197.parser/197.parser.test -0.1%
test-suite...000/255.vortex/255.vortex.test -0.1%
test-suite.../CINT2000/254.gap/254.gap.test -0.0%
test-suite.../CINT2000/252.eon/252.eon.test -0.0%
test-suite.../CINT2000/181.mcf/181.mcf.test 0.0%

Example of a function where this appears: https://godbolt.org/z/hFdLZB (extracted from 433.milc)

Diff Detail

Event Timeline

paquette created this revision.Jun 15 2020, 4:49 PM
aemerson accepted this revision.Jun 15 2020, 9:05 PM

LGTM.

This revision is now accepted and ready to land.Jun 15 2020, 9:05 PM
This revision was automatically updated to reflect the committed changes.