From patchwork Mon Oct 8 16:16:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [mips,testsuite] Fix test to handle optimizations Date: Mon, 08 Oct 2012 06:16:46 -0000 From: Steve Ellcey X-Patchwork-Id: 190056 Message-Id: <102e63ea-6b28-45cf-a75b-10d19561500e@EXCHHUB01.MIPS.com> To: The gcc.target/mips/ext_ins.c was failing in little endian mode on MIPS because the compiler is smart enough now to see that 'c' is uninitialized and it can insert the field 'a' into 'c' with a shift and a full store instead of an insert because the store just overwrites unintialized data. I changed the code to force the compiler to preserve the other fields of 'c' and that makes it use the insert instruction in both big and little endian modes. Tested on mips-mti-elf. OK to checkin? Steve Ellcey sellcey@mips.com 2012-10-08 Steve Ellcey * gcc.target/ext_ins.c: Modify f2 to aviod uninitialized data. diff --git a/gcc/testsuite/gcc.target/mips/ext_ins.c b/gcc/testsuite/gcc.target/mips/ext_ins.c index f0169bc..36f0f3f 100644 --- a/gcc/testsuite/gcc.target/mips/ext_ins.c +++ b/gcc/testsuite/gcc.target/mips/ext_ins.c @@ -18,9 +18,8 @@ NOMIPS16 unsigned int f1 (struct A a) return a.j; } -NOMIPS16 void f2 (int i) +NOMIPS16 struct A f2 (struct A a, int i) { - struct A c; - c.j = i; - func (c); + a.j = i; + return a; }