User account creation filtered due to spam.

Bug 15191 - [3.4 only] -maltivec -mabi=no-altivec results in mis-aligned lvx and stvx
Summary: [3.4 only] -maltivec -mabi=no-altivec results in mis-aligned lvx and stvx
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.1
Assignee: Alan Modra
URL:
Keywords: wrong-code
Depends on:
Blocks: 15106
  Show dependency treegraph
 
Reported: 2004-04-28 14:44 UTC by Alan Modra
Modified: 2005-07-23 22:49 UTC (History)
2 users (show)

See Also:
Host:
Target: powerpc64-linux
Build:
Known to work: 4.0.0
Known to fail: 3.4.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Modra 2004-04-28 14:44:34 UTC
Compiling the following with -m64 -O1 -maltivec -mabi=no-altivec
results in misaligned lvx data accesses in bar.
-m32 -O1 -maltivec -mabi=no-altivec results in misaligned stvx data accesses in f.

#define vector __attribute__ ((vector_size (16)))
vector int v1;
extern void bar (int, vector int, vector int, vector int,
		 vector int, vector int);
void f (void)
{
  bar (2, v1, v1, v1, v1, v1);
}

void bar (int a, vector int b, vector int c, vector int d,
	  vector int e, vector int f)
{
  v1 = b + c + d + e + f;
}
Comment 1 Alan Modra 2004-04-28 14:45:32 UTC
prototype patch at http://gcc.gnu.org/ml/gcc/2004-04/msg01316.html
Comment 2 Alan Modra 2004-05-11 04:03:47 UTC
Changes by:	amodra@gcc.gnu.org	2004-05-07 02:01:13

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.h sysv4.h 

Log message:
	* config/rs6000/rs6000.h (STACK_BOUNDARY): Use 128 bit for either
	TARGET_ALTIVEC or TARGET_ALTIVEC_ABI.
	* config/rs6000/sysv4.h (ABI_STACK_BOUNDARY): Likewise.
	(STACK_BOUNDARY): Delete.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3591&r2=2.3592
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&r1=1.321&r2=1.322
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/sysv4.h.diff?cvsroot=gcc&r1=1.148&r2=1.149

Changes by:	amodra@gcc.gnu.org	2004-05-09 23:48:38

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c 

Log message:
	* config/rs6000/rs6000.c (function_arg_boundary): Align for ABI_V4
	when size is 8 bytes.
	(function_arg_advance): Account for stack space used by AltiVec
	args when -mabi=altivec.  Simplify alignment calculations.  For
	ABI_V4, pass AltiVec vectors by reference when -mabi=no-altivec.
	(function_arg): Similarly.
	(function_arg_pass_by_reference): True for ABI_V4 AltiVec when
	not AltiVec ABI.
	(rs6000_va_arg): Correct fp arg test.  Adjust for AltiVec change.
	Correct alignment, and align before testing reg count.  Remove
	TREE_THIS_VOLATILE from reg.  Don't emit unused labels.
	(rs6000_complex_function_value): Check TARGET_HARD_FLOAT and
	TARGET_FPRS here..
	(rs6000_function_value): .. not here before call.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3613&r2=2.3614
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.637&r2=1.638

Changes by:	amodra@gcc.gnu.org	2004-05-10 14:26:51

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c 

Log message:
	* config/rs6000/rs6000.c (function_arg_boundary): Always align
	AltiVec vectors.
	(function_arg_advance): Pass TARGET_32BIT -mabi=no-altivec AltiVec
	vectors by refererence.  Align the same for TARGET_64BIT to a 16
	byte boundary.  Remove useless code.  Add function comment.
	(function_arg): Similarly.  Move gpr rs6000_mixed_function_arg
	call to where it belongs.
	(function_arg_partial_nregs): Return true for all TARGET_32BIT
	-mabi=no-altivec AltiVec vectors.  Fix debug output.
	(rs6000_va_arg): Adjust for AltiVec change.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3615&r2=2.3616
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&r1=1.638&r2=1.639

Branch: 	hammer-3_3-branch
Changes by:	amodra@gcc.gnu.org	2004-05-11 02:21:19

Modified files:
	gcc            : ChangeLog.hammer 
	gcc/config/rs6000: rs6000.c rs6000.h sysv4.h 

Log message:
	Backport from mainline.
	2004-05-10  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.c (function_arg_boundary): Always align
	AltiVec vectors.
	(function_arg_advance): Pass TARGET_32BIT -mabi=no-altivec AltiVec
	vectors by refererence.  Align the same for TARGET_64BIT to a 16
	byte boundary.  Remove useless code.  Add function comment.
	(function_arg): Similarly.  Move gpr rs6000_mixed_function_arg
	call to where it belongs.
	(function_arg_partial_nregs): Return true for all TARGET_32BIT
	-mabi=no-altivec AltiVec vectors.  Fix debug output.
	(rs6000_va_arg): Adjust for AltiVec change.
	
	2004-05-10  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.c (function_arg_boundary): Align for ABI_V4
	when size is 8 bytes.
	(function_arg_advance): Account for stack space used by AltiVec
	args when -mabi=altivec.  Simplify alignment calculations.  For
	ABI_V4, pass AltiVec vectors by reference when -mabi=no-altivec.
	(function_arg): Similarly.
	(function_arg_pass_by_reference): True for ABI_V4 AltiVec when
	not AltiVec ABI.
	(rs6000_va_arg): Correct fp arg test.  Adjust for AltiVec change.
	Correct alignment, and align before testing reg count.  Remove
	TREE_THIS_VOLATILE from reg.  Don't emit unused labels.
	(rs6000_complex_function_value): Check TARGET_HARD_FLOAT and
	TARGET_FPRS here..
	(rs6000_function_value): .. not here before call.
	
	2004-05-07  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.h (STACK_BOUNDARY): Use 128 bit for either
	TARGET_ALTIVEC or TARGET_ALTIVEC_ABI.
	* config/rs6000/sysv4.h (ABI_STACK_BOUNDARY): Likewise.
	(STACK_BOUNDARY): Delete.
	
	2004-05-07  Fariborz Jahanian  <fjahanian@apple.com>
	* config/rs6000/rs6000.c (rs6000_mixed_function_arg): Generate
	appropriate parallels for vector arguments passed to vararg functions.
	(function_arg): Make the call to rs6000_mixed_function_arg for
	vector args as needed.
	
	2004-02-23  Fariborz Jahanian <fjahanian@apple.com>
	* config/rs6000/rs6000.c (function_arg): Call to
	rs6000_mixed_function_arg for DFmode moved to allow
	normal DFmode incoming register assignment.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.hammer.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.2.398&r2=1.1.2.399
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.397.2.38&r2=1.397.2.39
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.234.2.25&r2=1.234.2.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/sysv4.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.113.2.11&r2=1.113.2.12
Comment 3 Alan Modra 2004-05-11 16:29:18 UTC
Branch: 	hammer-3_3-branch
Changes by:	amodra@gcc.gnu.org	2004-05-11 15:59:19

Modified files:
	gcc            : ChangeLog.hammer calls.c defaults.h function.c 
	gcc/config/sparc: sparc.h 

Log message:
	Backport from mainline.
	2003-10-08  Geoffrey Keating  <geoffk@apple.com>
	* function.c (pad_to_arg_alignment): Move 'boundary_in_bytes'
	definition to above SPARC_STACK_BOUNDARY_HACK.
	
	2003-10-07  Geoffrey Keating  <geoffk@apple.com>
	* function.c (pad_to_arg_alignment): Take STACK_POINTER_OFFSET into
	account	when aligning arguments.
	* calls.c (STACK_POINTER_OFFSET): Move default from here ...
	* defaults.h (STACK_POINTER_OFFSET): ... to here.
	* config/sparc/sparc.h (STACK_BOUNDARY): Add comment about how
	it's wrong when TARGET_ARCH64 && TARGET_STACK_BIAS.
	(SPARC_STACK_BOUNDARY_HACK): Define.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.hammer.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.1.2.400&r2=1.1.2.401
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/calls.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.242.2.24&r2=1.242.2.25
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/defaults.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.96.2.3&r2=1.96.2.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.387.2.25&r2=1.387.2.26
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/sparc/sparc.h.diff?cvsroot=gcc&only_with_tag=hammer-3_3-branch&r1=1.215.2.5&r2=1.215.2.6
Comment 4 CVS Commits 2004-06-10 06:39:53 UTC
Subject: Bug 15191

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	amodra@gcc.gnu.org	2004-06-10 06:39:50

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.c rs6000.h sysv4.h 

Log message:
	PR target/15191
	2004-05-15  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.c (rs6000_va_arg <ABI_V4>): Don't use
	UNITS_PER_WORD to calculate gpr size.  Re-instate code to set reg
	count to 8 to handle n_reg > 2.
	2004-05-10  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.c (function_arg_boundary): Always align
	AltiVec vectors.
	(function_arg_advance): Pass TARGET_32BIT -mabi=no-altivec AltiVec
	vectors by refererence.  Align the same for TARGET_64BIT to a 16
	byte boundary.  Remove useless code.  Add function comment.
	(function_arg): Similarly.  Move gpr rs6000_mixed_function_arg
	call to where it belongs.
	(function_arg_partial_nregs): Return true for all TARGET_32BIT
	-mabi=no-altivec AltiVec vectors.  Fix debug output.
	(rs6000_va_arg): Adjust for AltiVec change.
	2004-05-10  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.c (function_arg_boundary): Align for ABI_V4
	when size is 8 bytes.
	(function_arg_advance): Account for stack space used by AltiVec
	args when -mabi=altivec.  Simplify alignment calculations.  For
	ABI_V4, pass AltiVec vectors by reference when -mabi=no-altivec.
	(function_arg): Similarly.
	(function_arg_pass_by_reference): True for ABI_V4 AltiVec when
	not AltiVec ABI.
	(rs6000_va_arg): Correct fp arg test.  Adjust for AltiVec change.
	Correct alignment, and align before testing reg count.  Remove
	TREE_THIS_VOLATILE from reg.  Don't emit unused labels.
	(rs6000_complex_function_value): Check TARGET_HARD_FLOAT and
	TARGET_FPRS here..
	(rs6000_function_value): .. not here before call.
	2004-05-07  Alan Modra  <amodra@bigpond.net.au>
	* config/rs6000/rs6000.h (STACK_BOUNDARY): Use 128 bit for either
	TARGET_ALTIVEC or TARGET_ALTIVEC_ABI.
	* config/rs6000/sysv4.h (ABI_STACK_BOUNDARY): Likewise.
	(STACK_BOUNDARY): Delete.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.487&r2=2.2326.2.488
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.576.2.22&r2=1.576.2.23
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.306.4.6&r2=1.306.4.7
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/sysv4.h.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.144.4.2&r2=1.144.4.3

Comment 5 Alan Modra 2004-06-10 06:45:59 UTC
Fixed.