[PATCH 2/5][Arm] New pattern for CSINV instructions
authorSudi Das <sudi.das@arm.com>
Fri, 18 Sep 2020 14:47:46 +0000 (15:47 +0100)
committerOmar Tahir <omar.tahir@arm.com>
Fri, 18 Sep 2020 16:03:39 +0000 (17:03 +0100)
commitc2bb84be4a6e581bbf45891457ee632a07416982
treeef187c78b259df5dc5a7fee70d7b35ef0c90b383
parent3c7c5f1d4a4b8328fb4c07483cdbfe4ea7762155
[PATCH 2/5][Arm] New pattern for CSINV instructions

This patch adds a new pattern, *thumb2_csinv, for generating CSINV nstructions.

This pattern relies on a few general changes that will be used throughout
the following patches:
- A new macro, TARGET_COND_ARITH, which is only true on 8.1-M Mainline
  and represents the existence of these conditional instructions.
- A change to the cond exec hook, arm_have_conditional_execution, which
  now returns false if TARGET_COND_ARITH before reload. This allows for
  some ifcvt transformations when they would usually be disabled. I've
  written a rather verbose comment (with the risk of over-explaining)
  as it's a bit of a confusing change.
- One new predicate.
- *thumb2_movcond has been restricted to only match if !TARGET_COND_ARITH,
  otherwise it triggers undesirable combines.

gcc/ChangeLog:

* config/arm/arm.h (TARGET_COND_ARITH): New macro.
* config/arm/arm.c (arm_have_conditional_execution): Return false if
TARGET_COND_ARITH before reload.
* config/arm/predicates.md (arm_comparison_operation): Returns true if
comparing CC_REGNUM with constant zero.
* config/arm/thumb2.md (*thumb2_csinv): New.
(*thumb2_movcond): Don't match if TARGET_COND_ARITH.

gcc/testsuite/ChangeLog:

* gcc.target/arm/csinv-1.c: New test.

Co-authored-by: Omar Tahir <omar.tahir@arm.com>
gcc/config/arm/arm.c
gcc/config/arm/arm.h
gcc/config/arm/predicates.md
gcc/config/arm/thumb2.md
gcc/testsuite/gcc.target/arm/csinv-1.c [new file with mode: 0644]