This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Select negative arithmetic immediates in manual selector
ClosedPublic

Authored by paquette on Nov 9 2020, 4:12 PM.

Details

Summary

Previously, we only handled negative arithmetic immediates in the imported selector code.

Since we don't import code for, say, compares, we were missing opportunities for things like

%cst:gpr(s64) = G_CONSTANT i64 -10
%cmp:gpr(s32) = G_ICMP intpred(eq), %reg0(s64), %cst
->
%adds = ADDSXri %reg0, 10, 0, implicit-def $nzcv
%cmp = CSINCWr $wzr, $wzr, 1, implicit $nzcv

Instead, we would have to materialize the constant and emit a SUBS.

This adds support for selection like above for SUB, SUBS, ADD, and ADDS.

This is a 0.1% geomean code size improvement on SPECINT2000 at -Os.

Diff Detail