Bug 59909 - Quad memory bootstrap issues on little endian powerpc64 power8 systems
Summary: Quad memory bootstrap issues on little endian powerpc64 power8 systems
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.9.0
: P3 major
Target Milestone: ---
Assignee: Michael Meissner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-22 18:08 UTC by Michael Meissner
Modified: 2014-04-04 14:42 UTC (History)
4 users (show)

See Also:
Host: powerpc64le-linux
Target: powerpc64le-linux
Build: powerpc64le-linux
Known to work:
Known to fail:
Last reconfirmed: 2014-01-22 00:00:00


Attachments
Proposed patch to fix the problem (4.02 KB, patch)
2014-01-22 18:20 UTC, Michael Meissner
Details | Diff
Patch back ported to the ibm/gcc-4_8-branch (3.40 KB, patch)
2014-01-22 18:23 UTC, Michael Meissner
Details | Diff
Patch that was checked into the trunk, subversion id 207020. (3.91 KB, patch)
2014-01-24 02:38 UTC, Michael Meissner
Details | Diff
Patch that was checked into the ibm/gcc-4_8-branch, subversion id 207022. (3.37 KB, patch)
2014-01-24 02:39 UTC, Michael Meissner
Details | Diff
ChangeLog message for changes (986 bytes, text/plain)
2014-01-24 02:40 UTC, Michael Meissner
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Meissner 2014-01-22 18:08:11 UTC
Using the current sources, the GCC 4.9 compiler will not bootstrap if the default target is power8 on a little endian system.  The cause is the new quad word load/store support does not deal with swapping words after doing the load, and before doing the store.
Comment 1 Michael Meissner 2014-01-22 18:20:23 UTC
Created attachment 31922 [details]
Proposed patch to fix the problem

Split quad-memory support into two options, -mquad-memory for non-atomic load/stores, -mquad-memory-atomic for atomic load/stores.  Don't allow non-atomic quad load/stores in little endian mode.  Swap double words in little endian mode for atomic loads/stores.
Comment 2 Michael Meissner 2014-01-22 18:23:36 UTC
Created attachment 31923 [details]
Patch back ported to the ibm/gcc-4_8-branch

Back ported patch to ibm/gcc-4_8-branch.
Comment 3 Michael Meissner 2014-01-24 01:57:20 UTC
Author: meissner
Date: Fri Jan 24 01:56:48 2014
New Revision: 207020

URL: http://gcc.gnu.org/viewcvs?rev=207020&root=gcc&view=rev
Log:
[gcc]
2014-01-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/59909
	* doc/invoke.texi (RS/6000 and PowerPC Options): Document
	-mquad-memory-atomic.  Update -mquad-memory documentation to say
	it is only used for non-atomic loads/stores.

	* config/rs6000/predicates.md (quad_int_reg_operand): Allow either
	-mquad-memory or -mquad-memory-atomic switches.

	* config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Add
	-mquad-memory-atomic to ISA 2.07 support.

	* config/rs6000/rs6000.opt (-mquad-memory-atomic): Add new switch
	to separate support of normal quad word memory operations (ldq,
	stq) from the atomic quad word memory operations.

	* config/rs6000/rs6000.c (rs6000_option_override_internal): Add
	support to separate non-atomic quad word operations from atomic
	quad word operations.  Disable non-atomic quad word operations in
	little endian mode so that we don't have to swap words after the
	load and before the store.
	(quad_load_store_p): Add comment about atomic quad word support.
	(rs6000_opt_masks): Add -mquad-memory-atomic to the list of
	options printed with -mdebug=reg.

	* config/rs6000/rs6000.h (TARGET_SYNC_TI): Use
	-mquad-memory-atomic as the test for whether we have quad word
	atomic instructions.
	(TARGET_SYNC_HI_QI): If either -mquad-memory-atomic,
	-mquad-memory, or -mp8-vector are used, allow byte/half-word
	atomic operations.

	* config/rs6000/sync.md (load_lockedti): Insure that the address
	is a proper indexed or indirect address for the lqarx instruction.
	On little endian systems, swap the hi/lo registers after the lqarx
	instruction.
	(load_lockedpti): Use indexed_or_indirect_operand predicate to
	insure the address is valid for the lqarx instruction.
	(store_conditionalti): Insure that the address is a proper indexed
	or indirect address for the stqcrx. instruction.  On little endian
	systems, swap the hi/lo registers before doing the stqcrx.
	instruction.
	(store_conditionalpti): Use indexed_or_indirect_operand predicate to
	insure the address is valid for the stqcrx. instruction.

	* gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
	Define __QUAD_MEMORY__ and __QUAD_MEMORY_ATOMIC__ based on what
	type of quad memory support is available.

[gcc/testsuite]
2014-01-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/59909
	* gcc.target/powerpc/quad-atomic.c: New file to test power8 quad
	word atomic functions at runtime.


Added:
    trunk/gcc/testsuite/gcc.target/powerpc/quad-atomic.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/rs6000/predicates.md
    trunk/gcc/config/rs6000/rs6000-c.c
    trunk/gcc/config/rs6000/rs6000-cpus.def
    trunk/gcc/config/rs6000/rs6000.c
    trunk/gcc/config/rs6000/rs6000.h
    trunk/gcc/config/rs6000/rs6000.opt
    trunk/gcc/config/rs6000/sync.md
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog
Comment 4 Michael Meissner 2014-01-24 02:32:08 UTC
Author: meissner
Date: Fri Jan 24 02:31:36 2014
New Revision: 207022

URL: http://gcc.gnu.org/viewcvs?rev=207022&root=gcc&view=rev
Log:
[gcc]
2014-01-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/59909
	* doc/invoke.texi (RS/6000 and PowerPC Options): Document
	-mquad-memory-atomic.  Update -mquad-memory documentation to say
	it is only used for non-atomic loads/stores.

	* config/rs6000/predicates.md (quad_int_reg_operand): Allow either
	-mquad-memory or -mquad-memory-atomic switches.

	* config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Add
	-mquad-memory-atomic to ISA 2.07 support.

	* config/rs6000/rs6000.opt (-mquad-memory-atomic): Add new switch
	to separate support of normal quad word memory operations (ldq,
	stq) from the atomic quad word memory operations.

	* config/rs6000/rs6000.c (rs6000_option_override_internal): Add
	support to separate non-atomic quad word operations from atomic
	quad word operations.  Disable non-atomic quad word operations in
	little endian mode so that we don't have to swap words after the
	load and before the store.
	(quad_load_store_p): Add comment about atomic quad word support.
	(rs6000_opt_masks): Add -mquad-memory-atomic to the list of
	options printed with -mdebug=reg.

	* config/rs6000/rs6000.h (TARGET_SYNC_TI): Use
	-mquad-memory-atomic as the test for whether we have quad word
	atomic instructions.
	(TARGET_SYNC_HI_QI): If either -mquad-memory-atomic,
	-mquad-memory, or -mp8-vector are used, allow byte/half-word
	atomic operations.

	* config/rs6000/sync.md (load_lockedti): Insure that the address
	is a proper indexed or indirect address for the lqarx instruction.
	On little endian systems, swap the hi/lo registers after the lqarx
	instruction.
	(load_lockedpti): Use indexed_or_indirect_operand predicate to
	insure the address is valid for the lqarx instruction.
	(store_conditionalti): Insure that the address is a proper indexed
	or indirect address for the stqcrx. instruction.  On little endian
	systems, swap the hi/lo registers before doing the stqcrx.
	instruction.
	(store_conditionalpti): Use indexed_or_indirect_operand predicate to
	insure the address is valid for the stqcrx. instruction.

	* gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
	Define __QUAD_MEMORY__ and __QUAD_MEMORY_ATOMIC__ based on what
	type of quad memory support is available.

[gcc/testsuite]
2014-01-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/59909
	* gcc.target/powerpc/quad-atomic.c: New file to test power8 quad
	word atomic functions at runtime.


Added:
    branches/ibm/gcc-4_8-branch/gcc/testsuite/gcc.target/powerpc/quad-atomic.c
      - copied unchanged from r207020, trunk/gcc/testsuite/gcc.target/powerpc/quad-atomic.c
Modified:
    branches/ibm/gcc-4_8-branch/gcc/ChangeLog.ibm
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/predicates.md
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/rs6000-c.c
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/rs6000-cpus.def
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/rs6000.c
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/rs6000.h
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/rs6000.opt
    branches/ibm/gcc-4_8-branch/gcc/config/rs6000/sync.md
    branches/ibm/gcc-4_8-branch/gcc/doc/invoke.texi
    branches/ibm/gcc-4_8-branch/gcc/testsuite/ChangeLog.ibm
Comment 5 Michael Meissner 2014-01-24 02:38:34 UTC
Created attachment 31940 [details]
Patch that was checked into the trunk, subversion id 207020.
Comment 6 Michael Meissner 2014-01-24 02:39:37 UTC
Created attachment 31941 [details]
Patch that was checked into the ibm/gcc-4_8-branch, subversion id 207022.
Comment 7 Michael Meissner 2014-01-24 02:40:23 UTC
Created attachment 31942 [details]
ChangeLog message for changes
Comment 8 Michael Meissner 2014-01-24 02:41:06 UTC
Fixed in subversion id 207020 (trunk) and 207022 (ibm/gcc-4_8-branch).
Comment 9 Bill Schmidt 2014-04-04 14:42:49 UTC
Author: wschmidt
Date: Fri Apr  4 14:42:18 2014
New Revision: 209107

URL: http://gcc.gnu.org/viewcvs?rev=209107&root=gcc&view=rev
Log:
[gcc/testsuite]

2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Back port from mainline
	2014-01-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/59909
	* gcc.target/powerpc/quad-atomic.c: New file to test power8 quad
	word atomic functions at runtime.

[gcc]

2014-04-04  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>

	Back port from mainline
	2014-01-23  Michael Meissner  <meissner@linux.vnet.ibm.com>

	PR target/59909
	* doc/invoke.texi (RS/6000 and PowerPC Options): Document
	-mquad-memory-atomic.  Update -mquad-memory documentation to say
	it is only used for non-atomic loads/stores.

	* config/rs6000/predicates.md (quad_int_reg_operand): Allow either
	-mquad-memory or -mquad-memory-atomic switches.

	* config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Add
	-mquad-memory-atomic to ISA 2.07 support.

	* config/rs6000/rs6000.opt (-mquad-memory-atomic): Add new switch
	to separate support of normal quad word memory operations (ldq,
	stq) from the atomic quad word memory operations.

	* config/rs6000/rs6000.c (rs6000_option_override_internal): Add
	support to separate non-atomic quad word operations from atomic
	quad word operations.  Disable non-atomic quad word operations in
	little endian mode so that we don't have to swap words after the
	load and before the store.
	(quad_load_store_p): Add comment about atomic quad word support.
	(rs6000_opt_masks): Add -mquad-memory-atomic to the list of
	options printed with -mdebug=reg.

	* config/rs6000/rs6000.h (TARGET_SYNC_TI): Use
	-mquad-memory-atomic as the test for whether we have quad word
	atomic instructions.
	(TARGET_SYNC_HI_QI): If either -mquad-memory-atomic,
	-mquad-memory, or -mp8-vector are used, allow byte/half-word
	atomic operations.

	* config/rs6000/sync.md (load_lockedti): Insure that the address
	is a proper indexed or indirect address for the lqarx instruction.
	On little endian systems, swap the hi/lo registers after the lqarx
	instruction.
	(load_lockedpti): Use indexed_or_indirect_operand predicate to
	insure the address is valid for the lqarx instruction.
	(store_conditionalti): Insure that the address is a proper indexed
	or indirect address for the stqcrx. instruction.  On little endian
	systems, swap the hi/lo registers before doing the stqcrx.
	instruction.
	(store_conditionalpti): Use indexed_or_indirect_operand predicate to
	insure the address is valid for the stqcrx. instruction.

	* gcc/config/rs6000/rs6000-c.c (rs6000_target_modify_macros):
	Define __QUAD_MEMORY__ and __QUAD_MEMORY_ATOMIC__ based on what
	type of quad memory support is available.


Added:
    branches/gcc-4_8-branch/gcc/testsuite/gcc.target/powerpc/quad-atomic.c
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/config/rs6000/predicates.md
    branches/gcc-4_8-branch/gcc/config/rs6000/rs6000-c.c
    branches/gcc-4_8-branch/gcc/config/rs6000/rs6000-cpus.def
    branches/gcc-4_8-branch/gcc/config/rs6000/rs6000.c
    branches/gcc-4_8-branch/gcc/config/rs6000/rs6000.h
    branches/gcc-4_8-branch/gcc/config/rs6000/rs6000.opt
    branches/gcc-4_8-branch/gcc/config/rs6000/sync.md
    branches/gcc-4_8-branch/gcc/doc/invoke.texi
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog