Merge lp:~michaelh1/gcc-linaro/lp723185 into lp:gcc-linaro/4.6

Proposed by Michael Hope
Status: Merged
Approved by: Richard Sandiford
Approved revision: no longer in the source branch.
Merged at revision: 106761
Proposed branch: lp:~michaelh1/gcc-linaro/lp723185
Merge into: lp:gcc-linaro/4.6
Diff against target: 197 lines (+150/-18)
3 files modified
ChangeLog.linaro (+21/-0)
gcc/config/arm/arm.c (+128/-17)
gcc/config/arm/arm.md (+1/-1)
To merge this branch: bzr merge lp:~michaelh1/gcc-linaro/lp723185
Reviewer Review Type Date Requested Status
Richard Sandiford Approve
Review via email: mp+63965@code.launchpad.net

This proposal supersedes a proposal from 2011-06-08.

Description of the change

Backport r172297 from trunk to fix LP: #723185. Now pulls in the offset limit check.

To post a comment you must log in.
Revision history for this message
Linaro Toolchain Builder (cbuild) wrote : Posted in a previous version of this proposal

cbuild has taken a snapshot of this branch at r106755 and queued it for build.

The snapshot is available at:
 http://ex.seabright.co.nz/snapshots/gcc-linaro-4.6+bzr106755~michaelh1~lp723185.tar.xdelta3.xz

and will be built on the following builders:
 a9-builder i686 x86_64

You can track the build queue at:
 http://ex.seabright.co.nz/helpers/scheduler

cbuild-snapshot: gcc-linaro-4.6+bzr106755~michaelh1~lp723185
cbuild-ancestor: lp:gcc-linaro/4.6+bzr106754
cbuild-state: check

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote : Posted in a previous version of this proposal

cbuild successfully built this on i686-lucid-cbuild127-scorpius-i686r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106755~michaelh1~lp723185/logs/i686-lucid-cbuild127-scorpius-i686r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106754.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106755~michaelh1~lp723185/logs/i686-lucid-cbuild127-scorpius-i686r1/gcc-testsuite.txt

cbuild-checked: i686-lucid-cbuild127-scorpius-i686r1

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote : Posted in a previous version of this proposal

cbuild successfully built this on x86_64-maverick-cbuild127-crucis-x86_64r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106755~michaelh1~lp723185/logs/x86_64-maverick-cbuild127-crucis-x86_64r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106754.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106755~michaelh1~lp723185/logs/x86_64-maverick-cbuild127-crucis-x86_64r1/gcc-testsuite.txt

cbuild-checked: x86_64-maverick-cbuild127-crucis-x86_64r1

Revision history for this message
Richard Sandiford (rsandifo) wrote : Posted in a previous version of this proposal

I think you also need:

2011-04-20 Chung-Lin Tang <email address hidden>

 * config/arm/arm.c (arm_legitimize_reload_address): For NEON
 quad-word modes, reduce to 9-bit index range when above 1016 limit.

(fixes http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01635.html )

review: Needs Fixing
Revision history for this message
Ramana Radhakrishnan (ramana) wrote : Posted in a previous version of this proposal

On 9 June 2011 09:07, Richard Sandiford <email address hidden> wrote:
> Review: Needs Fixing
> I think you also need:

FTR, I had tried to backport the above mentioned fix to the FSF 4.6
branch and saw a few ICEs in the testsuite that I've posted about at
http://gcc.gnu.org/PR48250

cheers
Ramana

>
> 2011-04-20  Chung-Lin Tang  <email address hidden>
>
>        * config/arm/arm.c (arm_legitimize_reload_address): For NEON
>        quad-word modes, reduce to 9-bit index range when above 1016 limit.
>
> (fixes http://gcc.gnu.org/ml/gcc-patches/2011-04/msg01635.html )
>
>
> --
> https://code.launchpad.net/~michaelh1/gcc-linaro/lp723185/+merge/63937
> Your team Linaro Toolchain Developers is subscribed to branch lp:gcc-linaro/4.6.
>

Revision history for this message
Michael Hope (michaelh1) wrote :

I'm running this to see if the ICEs that Ramana saw occur.

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild has taken a snapshot of this branch at r106756 and queued it for build.

The snapshot is available at:
 http://ex.seabright.co.nz/snapshots/gcc-linaro-4.6+bzr106756~michaelh1~lp723185.tar.xdelta3.xz

and will be built on the following builders:
 a9-builder i686 x86_64

You can track the build queue at:
 http://ex.seabright.co.nz/helpers/scheduler

cbuild-snapshot: gcc-linaro-4.6+bzr106756~michaelh1~lp723185
cbuild-ancestor: lp:gcc-linaro/4.6+bzr106754
cbuild-state: check

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on x86_64-maverick-cbuild127-crucis-x86_64r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/x86_64-maverick-cbuild127-crucis-x86_64r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106754.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/x86_64-maverick-cbuild127-crucis-x86_64r1/gcc-testsuite.txt

cbuild-checked: x86_64-maverick-cbuild127-crucis-x86_64r1

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on armv7l-maverick-cbuild127-ursa4-cortexa9r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/armv7l-maverick-cbuild127-ursa4-cortexa9r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106754.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/armv7l-maverick-cbuild127-ursa4-cortexa9r1/gcc-testsuite.txt

cbuild-checked: armv7l-maverick-cbuild127-ursa4-cortexa9r1

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on i686-lucid-cbuild127-scorpius-i686r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/i686-lucid-cbuild127-scorpius-i686r1

The test suite results were unchanged compared to the branch point lp:gcc-linaro/4.6+bzr106754.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/i686-lucid-cbuild127-scorpius-i686r1/gcc-testsuite.txt

cbuild-checked: i686-lucid-cbuild127-scorpius-i686r1

Revision history for this message
Michael Hope (michaelh1) wrote :

The -mthumb -mfpu=neon build bootstrapped fine with no regressions. I'm running a -marm -mfpu=neon and -mthumb -fpu=vfpv3-d16 as well.

Revision history for this message
Chung-Lin Tang (cltang) wrote :

On 2011/6/10 07:51 AM, Michael Hope wrote:
> The -mthumb -mfpu=neon build bootstrapped fine with no regressions. I'm running a -marm -mfpu=neon and -mthumb -fpu=vfpv3-d16 as well.

This patch actually only affects ARM mode. The original ICE should not
have occurred in Thumb-2, IIRC.

Revision history for this message
Michael Hope (michaelh1) wrote :

Cortex-A9+NEON+ARM bootstraps fine. The testsuite comes out cleaner due to being in ARM mode.

Cortex-A8+VFP+Thumb2 bootstraps fine. The testsuite seems OK, but it's hard to tell due to the NEON vs non-NEON differences.

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on armv7l-maverick-cbuild128-ursa3-cortexa8r1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/armv7l-maverick-cbuild128-ursa3-cortexa8r1

The test suite was not checked as the branch point lp:gcc-linaro/4.6+bzr106754 has nothing to compare against.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/armv7l-maverick-cbuild128-ursa3-cortexa8r1/gcc-testsuite.txt

cbuild-checked: armv7l-maverick-cbuild128-ursa3-cortexa8r1

Revision history for this message
Linaro Toolchain Builder (cbuild) wrote :

cbuild successfully built this on armv7l-maverick-cbuild128-ursa4-cortexa9armr1.

The build results are available at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/armv7l-maverick-cbuild128-ursa4-cortexa9armr1

The test suite was not checked as the branch point lp:gcc-linaro/4.6+bzr106754 has nothing to compare against.

The full testsuite results are at:
 http://ex.seabright.co.nz/build/gcc-linaro-4.6+bzr106756~michaelh1~lp723185/logs/armv7l-maverick-cbuild128-ursa4-cortexa9armr1/gcc-testsuite.txt

cbuild-checked: armv7l-maverick-cbuild128-ursa4-cortexa9armr1

Revision history for this message
Michael Hope (michaelh1) wrote :

Any thoughts on this? GCC bootstraps in Thumb-2 NEON, Thumb-2 VFP, and ARM NEON modes.

Revision history for this message
Richard Sandiford (rsandifo) wrote :

Looks good. Sorry for the slow response.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ChangeLog.linaro'
--- ChangeLog.linaro 2011-06-07 11:18:20 +0000
+++ ChangeLog.linaro 2011-06-09 09:02:19 +0000
@@ -1,3 +1,24 @@
12011-06-09 Michael Hope <michael.hope@linaro.org>
2
3 gcc/
4 Backport from mainline:
5
6 Chung-Lin Tang <cltang@codesourcery.com>
7 Richard Earnshaw <rearnsha@arm.com>
8
9 PR target/48250
10 * config/arm/arm.c (arm_legitimize_reload_address): Update cases
11 to use sign-magnitude offsets. Reject unsupported unaligned
12 cases. Add detailed description in comments.
13 * config/arm/arm.md (reload_outdf): Disable for ARM mode; change
14 condition from TARGET_32BIT to TARGET_ARM.
15
16 Chung-Lin Tang <cltang@codesourcery.com>
17
18 * config/arm/arm.c (arm_legitimize_reload_address): For NEON
19 quad-word modes, reduce to 9-bit index range when above 1016
20 limit.
21
12011-06-07 Andrew Stubbs <ams@codesourcery.com>222011-06-07 Andrew Stubbs <ams@codesourcery.com>
223
3 Backport from FSF:24 Backport from FSF:
425
=== modified file 'gcc/config/arm/arm.c'
--- gcc/config/arm/arm.c 2011-05-11 14:49:48 +0000
+++ gcc/config/arm/arm.c 2011-06-09 09:02:19 +0000
@@ -6419,23 +6419,134 @@
6419 HOST_WIDE_INT val = INTVAL (XEXP (*p, 1));6419 HOST_WIDE_INT val = INTVAL (XEXP (*p, 1));
6420 HOST_WIDE_INT low, high;6420 HOST_WIDE_INT low, high;
64216421
6422 if (mode == DImode || (mode == DFmode && TARGET_SOFT_FLOAT))6422 /* Detect coprocessor load/stores. */
6423 low = ((val & 0xf) ^ 0x8) - 0x8;6423 bool coproc_p = ((TARGET_HARD_FLOAT
6424 else if (TARGET_MAVERICK && TARGET_HARD_FLOAT)6424 && (TARGET_VFP || TARGET_FPA || TARGET_MAVERICK)
6425 /* Need to be careful, -256 is not a valid offset. */6425 && (mode == SFmode || mode == DFmode
6426 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff);6426 || (mode == DImode && TARGET_MAVERICK)))
6427 else if (mode == SImode6427 || (TARGET_REALLY_IWMMXT
6428 || (mode == SFmode && TARGET_SOFT_FLOAT)6428 && VALID_IWMMXT_REG_MODE (mode))
6429 || ((mode == HImode || mode == QImode) && ! arm_arch4))6429 || (TARGET_NEON
6430 /* Need to be careful, -4096 is not a valid offset. */6430 && (VALID_NEON_DREG_MODE (mode)
6431 low = val >= 0 ? (val & 0xfff) : -((-val) & 0xfff);6431 || VALID_NEON_QREG_MODE (mode))));
6432 else if ((mode == HImode || mode == QImode) && arm_arch4)6432
6433 /* Need to be careful, -256 is not a valid offset. */6433 /* For some conditions, bail out when lower two bits are unaligned. */
6434 low = val >= 0 ? (val & 0xff) : -((-val) & 0xff);6434 if ((val & 0x3) != 0
6435 else if (GET_MODE_CLASS (mode) == MODE_FLOAT6435 /* Coprocessor load/store indexes are 8-bits + '00' appended. */
6436 && TARGET_HARD_FLOAT && TARGET_FPA)6436 && (coproc_p
6437 /* Need to be careful, -1024 is not a valid offset. */6437 /* For DI, and DF under soft-float: */
6438 low = val >= 0 ? (val & 0x3ff) : -((-val) & 0x3ff);6438 || ((mode == DImode || mode == DFmode)
6439 /* Without ldrd, we use stm/ldm, which does not
6440 fair well with unaligned bits. */
6441 && (! TARGET_LDRD
6442 /* Thumb-2 ldrd/strd is [-1020,+1020] in steps of 4. */
6443 || TARGET_THUMB2))))
6444 return false;
6445
6446 /* When breaking down a [reg+index] reload address into [(reg+high)+low],
6447 of which the (reg+high) gets turned into a reload add insn,
6448 we try to decompose the index into high/low values that can often
6449 also lead to better reload CSE.
6450 For example:
6451 ldr r0, [r2, #4100] // Offset too large
6452 ldr r1, [r2, #4104] // Offset too large
6453
6454 is best reloaded as:
6455 add t1, r2, #4096
6456 ldr r0, [t1, #4]
6457 add t2, r2, #4096
6458 ldr r1, [t2, #8]
6459
6460 which post-reload CSE can simplify in most cases to eliminate the
6461 second add instruction:
6462 add t1, r2, #4096
6463 ldr r0, [t1, #4]
6464 ldr r1, [t1, #8]
6465
6466 The idea here is that we want to split out the bits of the constant
6467 as a mask, rather than as subtracting the maximum offset that the
6468 respective type of load/store used can handle.
6469
6470 When encountering negative offsets, we can still utilize it even if
6471 the overall offset is positive; sometimes this may lead to an immediate
6472 that can be constructed with fewer instructions.
6473 For example:
6474 ldr r0, [r2, #0x3FFFFC]
6475
6476 This is best reloaded as:
6477 add t1, r2, #0x400000
6478 ldr r0, [t1, #-4]
6479
6480 The trick for spotting this for a load insn with N bits of offset
6481 (i.e. bits N-1:0) is to look at bit N; if it is set, then chose a
6482 negative offset that is going to make bit N and all the bits below
6483 it become zero in the remainder part.
6484
6485 The SIGN_MAG_LOW_ADDR_BITS macro below implements this, with respect
6486 to sign-magnitude addressing (i.e. separate +- bit, or 1's complement),
6487 used in most cases of ARM load/store instructions. */
6488
6489#define SIGN_MAG_LOW_ADDR_BITS(VAL, N) \
6490 (((VAL) & ((1 << (N)) - 1)) \
6491 ? (((VAL) & ((1 << ((N) + 1)) - 1)) ^ (1 << (N))) - (1 << (N)) \
6492 : 0)
6493
6494 if (coproc_p)
6495 {
6496 low = SIGN_MAG_LOW_ADDR_BITS (val, 10);
6497
6498 /* NEON quad-word load/stores are made of two double-word accesses,
6499 so the valid index range is reduced by 8. Treat as 9-bit range if
6500 we go over it. */
6501 if (TARGET_NEON && VALID_NEON_QREG_MODE (mode) && low >= 1016)
6502 low = SIGN_MAG_LOW_ADDR_BITS (val, 9);
6503 }
6504 else if (GET_MODE_SIZE (mode) == 8)
6505 {
6506 if (TARGET_LDRD)
6507 low = (TARGET_THUMB2
6508 ? SIGN_MAG_LOW_ADDR_BITS (val, 10)
6509 : SIGN_MAG_LOW_ADDR_BITS (val, 8));
6510 else
6511 /* For pre-ARMv5TE (without ldrd), we use ldm/stm(db/da/ib)
6512 to access doublewords. The supported load/store offsets are
6513 -8, -4, and 4, which we try to produce here. */
6514 low = ((val & 0xf) ^ 0x8) - 0x8;
6515 }
6516 else if (GET_MODE_SIZE (mode) < 8)
6517 {
6518 /* NEON element load/stores do not have an offset. */
6519 if (TARGET_NEON_FP16 && mode == HFmode)
6520 return false;
6521
6522 if (TARGET_THUMB2)
6523 {
6524 /* Thumb-2 has an asymmetrical index range of (-256,4096).
6525 Try the wider 12-bit range first, and re-try if the result
6526 is out of range. */
6527 low = SIGN_MAG_LOW_ADDR_BITS (val, 12);
6528 if (low < -255)
6529 low = SIGN_MAG_LOW_ADDR_BITS (val, 8);
6530 }
6531 else
6532 {
6533 if (mode == HImode || mode == HFmode)
6534 {
6535 if (arm_arch4)
6536 low = SIGN_MAG_LOW_ADDR_BITS (val, 8);
6537 else
6538 {
6539 /* The storehi/movhi_bytes fallbacks can use only
6540 [-4094,+4094] of the full ldrb/strb index range. */
6541 low = SIGN_MAG_LOW_ADDR_BITS (val, 12);
6542 if (low == 4095 || low == -4095)
6543 return false;
6544 }
6545 }
6546 else
6547 low = SIGN_MAG_LOW_ADDR_BITS (val, 12);
6548 }
6549 }
6439 else6550 else
6440 return false;6551 return false;
64416552
64426553
=== modified file 'gcc/config/arm/arm.md'
--- gcc/config/arm/arm.md 2011-06-02 15:58:33 +0000
+++ gcc/config/arm/arm.md 2011-06-09 09:02:19 +0000
@@ -6245,7 +6245,7 @@
6245 [(match_operand:DF 0 "arm_reload_memory_operand" "=o")6245 [(match_operand:DF 0 "arm_reload_memory_operand" "=o")
6246 (match_operand:DF 1 "s_register_operand" "r")6246 (match_operand:DF 1 "s_register_operand" "r")
6247 (match_operand:SI 2 "s_register_operand" "=&r")]6247 (match_operand:SI 2 "s_register_operand" "=&r")]
6248 "TARGET_32BIT"6248 "TARGET_THUMB2"
6249 "6249 "
6250 {6250 {
6251 enum rtx_code code = GET_CODE (XEXP (operands[0], 0));6251 enum rtx_code code = GET_CODE (XEXP (operands[0], 0));

Subscribers

People subscribed via source and target branches