]> git.ipfire.org Git - thirdparty/gcc.git/commit
[arm] Early split simple DImode equality comparisons
authorrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Oct 2019 19:03:27 +0000 (19:03 +0000)
committerrearnsha <rearnsha@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 18 Oct 2019 19:03:27 +0000 (19:03 +0000)
commit1790ea25c003bac0d71094c4b2c0ca2ec9ddad29
tree046cab757eff2ab960fd3733a3d1e35630c3bacf
parent263f9e4d0ee3c4908cc083d5075b48d775ba9f74
[arm] Early split simple DImode equality comparisons

This is the first step of early splitting all the DImode comparison
operations.  We start by factoring the DImode handling out of
arm_gen_compare_reg into its own function.

Simple DImode equality comparisions (such as equality with zero, or
equality with a constant that is zero in one of the two word values
that it comprises) can be done using a single subtract followed by an
ORRS instruction.  This avoids the need for conditional execution.

For example, (r0 != 5) can be written as

SUB Rt, R0, #5
ORRS Rt, Rt, R1

The ORRS is now expanded using an SImode pattern that already exists
in the MD file and this gives the register allocator more freedom to
select registers (consecutive pairs are no-longer required).
Furthermore, we can then delete the arm_cmpdi_zero pattern as it is
no-longer required.  We use SUB for the value adjustment as this has a
generally more flexible range of immediates than XOR and what's more
has the opportunity to be relaxed in thumb2 to a 16-bit SUBS
instruction.

* config/arm/arm.c (arm_select_cc_mode): For DImode equality tests
return CC_Zmode if comparing against a constant where one word is
zero.
(arm_gen_compare_reg): Split DImode handling to ...
(arm_gen_dicompare_reg): ... here.  Handle equality comparisons
against simple constants.
* config/arm/arm.md (arm_cmpdi_zero): Delete pattern.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@277177 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ChangeLog
gcc/config/arm/arm.c
gcc/config/arm/arm.md