On Tue, Aug 25, 2015 at 5:37 PM, Andre Vieira <andre.simoesdiasvie...@arm.com> wrote: > Conditional branches have a maximum range of [-1048576, 1048572]. Any > destination further away can not be reached by these. > To be able to have conditional branches in very large functions, we invert > the condition and change the destination to jump over an unconditional > branch to the original, far away, destination. > > gcc/ChangeLog: > 2015-08-07 Ramana Radhakrishnan <ramana.radhakrish...@arm.com> > Andre Vieira <andre.simoesdiasvie...@arm.com> > > * config/aarch64/aarch64.md (*condjump): Handle functions > 1 > Mib. > (*cb<optab><mode>1): Idem. > (*tb<optab><mode>1): Idem. > (*cb<optab><mode>1): Idem. > * config/aarch64/iterators.md (inv_cb): New code attribute. > (inv_tb): Idem. > * config/aarch64/aarch64.c (aarch64_gen_far_branch): New. > * config/aarch64/aarch64-protos.h (aarch64_gen_far_branch): New. > > gcc/testsuite/ChangeLog: > 2015-08-07 Andre Vieira <andre.simoesdiasvie...@arm.com> > > * gcc.target/aarch64/long-branch.c: New test.
Just a few comments about the testcase. You could improve the size (on disk) of the testcase by using the preprocessor some more: Something like: #define CASE_ENTRY2 (x) CASE_ENTRY ((x)) CASE_ENTRY ((x)+1) #define CASE_ENTRY4 (x) CASE_ENTRY2 ((x)) CASE_ENTRY2 ((x)+2+1) #define CASE_ENTRY8 (x) CASE_ENTRY4 ((x)) CASE_ENTRY4 ((x)+4+1) #define CASE_ENTRY16 (x) CASE_ENTRY8 ((x)) CASE_ENTRY8 ((x)+8+1) #define CASE_ENTRY32 (x) CASE_ENTRY16 ((x)) CASE_ENTRY16 ((x)+16) #define CASE_ENTRY64 (x) CASE_ENTRY32 ((x)) CASE_ENTRY32 ((x)+32+1) #define CASE_ENTRY128 (x) CASE_ENTRY64 ((x)) CASE_ENTRY16 ((x)+64+1) #define CASE_ENTRY256 (x) CASE_ENTRY128 ((x)) CASE_ENTRY128 ((x)+128+1) And then use CASE_ENTRY256 (1) You can do the same trick to reduce the size of CASE_ENTRY too. Thanks, Andrew Pinski