Bug 56315 - ARM: Improve use of 64-bit constants in logical operations
Summary: ARM: Improve use of 64-bit constants in logical operations
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.8.0
: P4 enhancement
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-14 01:59 UTC by Joshua Conner
Modified: 2014-01-22 16:10 UTC (History)
1 user (show)

See Also:
Host:
Target: arm
Build:
Known to work:
Known to fail:
Last reconfirmed: 2013-03-04 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Conner 2013-02-14 01:59:02 UTC
In the ARM backend, support was added for recognizing addition with 64-bit constants that could be split up into two 32-bit literals that could be handled with immediates in the adds/adc operations.  However, this support is still not present for the logical operations.  For example, compiling this code with -O2:

  unsigned long long or64 (unsigned long long input)
  {
    return input | 0x200000004ULL;
  }

Gives us:

	mov	r2, #4
	mov	r3, #2
	orr	r0, r0, r2
	orr	r1, r1, r3

When it could produce:

	orr	r0, r0, #4
	orr	r1, r1, #2

The same improvement could be applied to & and ^ operations as well.
Comment 1 Richard Earnshaw 2013-03-04 09:12:26 UTC
Confirmed
Comment 2 Christophe Lyon 2013-09-05 12:38:05 UTC
Author: clyon
Date: Thu Sep  5 12:38:03 2013
New Revision: 202280

URL: http://gcc.gnu.org/viewcvs?rev=202280&root=gcc&view=rev
Log:
gcc/
2013-09-05  Christophe Lyon  <christophe.lyon@linaro.org>

	Backport from trunk r199527,199792,199814.
	2013-05-31  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	PR target/56315
	* config/arm/arm.c (const_ok_for_dimode_op): Handle IOR.
	* config/arm/arm.md (*iordi3_insn): Change to insn_and_split.
	* config/arm/neon.md (iordi3_neon): Remove.
	(neon_vorr<mode>): Generate iordi3 instead of iordi3_neon.
	* config/arm/predicates.md (imm_for_neon_logic_operand):
	Move to earlier in the file.
	(neon_logic_op2): Likewise.
	(arm_iordi_operand_neon): New predicate.

	2013-06-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* config/arm/constraints.md (Df): New constraint.
	* config/arm/arm.md (iordi3_insn): Use Df constraint instead of De.
	Correct length attribute for last two alternatives.

	2013-06-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	PR target/56315
	* config/arm/arm.md (*xordi3_insn): Change to insn_and_split.
	(xordi3): Change operand 2 constraint to arm_xordi_operand.
	* config/arm/arm.c (const_ok_for_dimode_op): Handle XOR.
	* config/arm/constraints.md (Dg): New constraint.
	* config/arm/neon.md (xordi3_neon): Remove.
	(neon_veor<mode>): Generate xordi3 instead of xordi3_neon.
	* config/arm/predicates.md (arm_xordi_operand): New predicate.

gcc/testsuite/
2013-09-05  Christophe Lyon  <christophe.lyon@linaro.org>

	Backport from trunk r199527,199814,201435.
	2013-05-31  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	PR target/56315
	* gcc.target/arm/iordi3-opt.c: New test.

	2013-06-07  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	PR target/56315
	* gcc.target/arm/xordi3-opt.c: New test.

	2013-08-02  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>

	* gcc.target/arm/neon-for-64bits-2.c: Delete.


Added:
    branches/linaro/gcc-4_8-branch/gcc/testsuite/gcc.target/arm/iordi3-opt.c
      - copied unchanged from r199527, trunk/gcc/testsuite/gcc.target/arm/iordi3-opt.c
    branches/linaro/gcc-4_8-branch/gcc/testsuite/gcc.target/arm/xordi3-opt.c
      - copied unchanged from r199814, trunk/gcc/testsuite/gcc.target/arm/xordi3-opt.c
Removed:
    branches/linaro/gcc-4_8-branch/gcc/testsuite/gcc.target/arm/neon-for-64bits-2.c
Modified:
    branches/linaro/gcc-4_8-branch/   (props changed)
    branches/linaro/gcc-4_8-branch/gcc/ChangeLog.linaro
    branches/linaro/gcc-4_8-branch/gcc/config/arm/arm.c
    branches/linaro/gcc-4_8-branch/gcc/config/arm/arm.md
    branches/linaro/gcc-4_8-branch/gcc/config/arm/constraints.md
    branches/linaro/gcc-4_8-branch/gcc/config/arm/neon.md
    branches/linaro/gcc-4_8-branch/gcc/config/arm/predicates.md
    branches/linaro/gcc-4_8-branch/gcc/testsuite/ChangeLog.linaro

Propchange: branches/linaro/gcc-4_8-branch/
            ('svn:mergeinfo' modified)
Comment 3 ktkachov 2014-01-22 12:05:48 UTC
This is now fixed on trunk, most probably with r199527.
Comment 4 Joshua Conner 2014-01-22 16:10:59 UTC
Excellent - thanks!