On Tue, Sep 20, 2016 at 8:07 AM, Fernando Endo <fernando.endo2@gmail.com> wrote:
> I'm using Linaro GCC 4.9-2015.01-3 for AArch64, and trying to disable the
> generation of guarded instructions. More specifically, I'd like not to see
> instructions such as 'cset', 'csinc', 'ccmp', 'fccmp', etc.
There are a lot of different optimization passes that can generate
these instructions, and probably not all of them can be disabled via
options. A better approach would be to disable the patterns that
generate the conditional move instructions. The compiler should still
work without them. In the gcc/config/aarch64/aarch64.md file, you
want to disable all of the patterns after the comment
;; ------------------------------------------------------------ -------
;; Store-flag and conditional select insns
;; ------------------------------------------------------------ -------
and before the Logical operations comment. You can disable a pattern
by modifying the first set of quotes from "" to "0", or if there is
already code there, change it to "0 && ..." where ... is the original
code. Or alternatively, you can just delete all of the patterns. I
see that there is one crc pattern mixed in among the csel patterns,
which is an odd place for it. That one should not be touched, though
it is only used if the code being compiled calls one of the crc
builtin functions, which is uncommon.
For the conditional compare instructions, this is a little more
complicated. You need to disable or delete the cbranchcc4,
ccmp<mode>, fccmp<mode>, and fccmpe<mode> patterns in the aarch64.md
file. And you also need to delete the #undef and #define in aarch64.c
for TARGET_GEN_CCMP_FIRST and TARGET_GEN_CCMP_NEXT.
If you want a more useful patch, you can add a compiler option, and
then make all of the patterns conditional on the compiler option, so
that they can be turned off and on via the command line instead of
needing two different compilers.
I haven't tried this myself, so there could be some issues that I
overlooked. I would expect this to work though.
Jim