From: Kyrylo Tkachov Date: Wed, 30 Nov 2016 12:18:47 +0000 (+0000) Subject: [AArch64] PR target/78362: Make sure to only take REGNO of a register X-Git-Tag: upstream/12.2.0~42861 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=35323bd8654c0223a0f1513099da11beb94b3360;p=platform%2Fupstream%2Fgcc.git [AArch64] PR target/78362: Make sure to only take REGNO of a register PR target/78362 * config/aarch64/aarch64.md (add3): 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f3c773..8fd098b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-11-30 Kyrylo Tkachov + + PR target/78362 + * config/aarch64/aarch64.md (add3): 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 Andrew Burgess diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md index 26982f6..bc6d8a2 100644 --- a/gcc/config/aarch64/aarch64.md +++ b/gcc/config/aarch64/aarch64.md @@ -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) && 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, operands[2]); }) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e89bca5..d2d80d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-11-30 Kyrylo Tkachov + + PR target/78362 + * gcc.c-torture/compile/pr78362.c: New test. + 2016-11-30 Andrew Burgess * lib/target-supports.exp (check_effective_target_freorder): Check diff --git a/gcc/testsuite/gcc.c-torture/compile/pr78362.c b/gcc/testsuite/gcc.c-torture/compile/pr78362.c new file mode 100644 index 0000000..66eea7d --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr78362.c @@ -0,0 +1,11 @@ +/* PR target/78362. */ + +long a; + +void +foo (void) +{ + for (;; a--) + if ((int) a) + break; +}