[AArch64] PR target/78362: Make sure to only take REGNO of a register

PR target/78362
	* config/aarch64/aarch64.md (add<mode>3): Extract inner expression
	from a subreg in operands[1] and don't call REGNO on a non-reg
	expression when deciding to force operands[2] into a reg.

	* gcc.c-torture/compile/pr78362.c: New test.

From-SVN: r243011
This commit is contained in:
Kyrylo Tkachov 2016-11-30 12:18:47 +00:00 committed by Kyrylo Tkachov
parent ac02e9a821
commit 35323bd865
4 changed files with 28 additions and 1 deletions

View File

@ -1,3 +1,10 @@
2016-11-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/78362
* config/aarch64/aarch64.md (add<mode>3): Extract inner expression
from a subreg in operands[1] and don't call REGNO on a non-reg
expression when deciding to force operands[2] into a reg.
2016-11-30 Claudiu Zissulescu <claziss@synopsys.com>
Andrew Burgess <andrew.burgess@embecosm.com>

View File

@ -1611,11 +1611,15 @@
(match_operand:GPI 2 "aarch64_pluslong_operand" "")))]
""
{
/* If operands[1] is a subreg extract the inner RTX. */
rtx op1 = REG_P (operands[1]) ? operands[1] : SUBREG_REG (operands[1]);
/* If the constant is too large for a single instruction and isn't frame
based, split off the immediate so it is available for CSE. */
if (!aarch64_plus_immediate (operands[2], <MODE>mode)
&& can_create_pseudo_p ()
&& !REGNO_PTR_FRAME_P (REGNO (operands[1])))
&& (!REG_P (op1)
|| !REGNO_PTR_FRAME_P (REGNO (op1))))
operands[2] = force_reg (<MODE>mode, operands[2]);
})

View File

@ -1,3 +1,8 @@
2016-11-30 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/78362
* gcc.c-torture/compile/pr78362.c: New test.
2016-11-30 Andrew Burgess <andrew.burgess@embecosm.com>
* lib/target-supports.exp (check_effective_target_freorder): Check

View File

@ -0,0 +1,11 @@
/* PR target/78362. */
long a;
void
foo (void)
{
for (;; a--)
if ((int) a)
break;
}