diff mbox

PATCH: Support -mx32 in GCC tests

Message ID 20110707172953.GA6453@intel.com
State New
Headers show

Commit Message

H.J. Lu July 7, 2011, 5:29 p.m. UTC
Hi,

On Linux/x86-64, when we pass

RUNTESTFLAGS="--target_board='unix{-mx32}'"

to GCC tests, we can't check lp64/ilp32 for availability of 64bit x86
instructions.  This patch adds ia32 and x32 effetive targets.  OK for
trunk?

Thanks.


H.J.
---
2011-07-07  H.J. Lu  <hongjiu.lu@intel.com>

	* lib/target-supports.exp (check_effective_target_ia32): New.
	(check_effective_target_x32): Likewise.
	(check_effective_target_vect_cmdline_needed): Also check x32.

Comments

Mike Stump July 7, 2011, 5:57 p.m. UTC | #1
On Jul 7, 2011, at 10:29 AM, H.J. Lu wrote:
> On Linux/x86-64, when we pass
> 
> RUNTESTFLAGS="--target_board='unix{-mx32}'"
> 
> to GCC tests, we can't check lp64/ilp32 for availability of 64bit x86
> instructions.  This patch adds ia32 and x32 effetive targets.  OK for
> trunk?

Ok.
H.J. Lu July 7, 2011, 6:26 p.m. UTC | #2
On Thu, Jul 7, 2011 at 10:57 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Jul 7, 2011, at 10:29 AM, H.J. Lu wrote:
>> On Linux/x86-64, when we pass
>>
>> RUNTESTFLAGS="--target_board='unix{-mx32}'"
>>
>> to GCC tests, we can't check lp64/ilp32 for availability of 64bit x86
>> instructions.  This patch adds ia32 and x32 effetive targets.  OK for
>> trunk?
>
> Ok.
>

Checked in.

This is the followup patch to use ia32 and x32 effective targets.  It
uses ia32 effective target for 32bit x86 instructions and x32 for 64bit
x86 instructions.  OK for trunk?

Thanks.
Mike Stump July 7, 2011, 8:27 p.m. UTC | #3
On Jul 7, 2011, at 11:26 AM, H.J. Lu wrote:
> -/* { dg-do compile { target { { i?86-*-* rs6000-*-* alpha*-*-* x86_64-*-* } || { powerpc*-*-* && ilp32 } } } } */
> +/* { dg-do compile { target { { i?86-*-* rs6000-*-* alpha*-*-* x86_64-*-* } || { powerpc*-*-* && ia32 } } } } */

powerpc doesn't have an ia32 product?

I think this shouldn't change?

> -/* Disable the test entirely for 16-bit targets.  */
> -#if __INT_MAX__ > 32767
> +/* Disable the test entirely for 16-bit and x32 targets.  */
> +#if __INT_MAX__ > 32767 && (!defined __x86_64__ || defined __LP64__)

While not too important, might a dg-skip-if line be easier to read and understand?

> -/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */
> +/* { dg-do compile { target { { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } && { ! x32 } } } } */


Hum, I worry about x86 walking away with large amounts of symbol space.  Please change to x86 && x32 or x86_x32.

> -/* { dg-do compile } */
> +/* { dg-do compile { target { x32 || lp64 } } } */

Likewise.


> OK for trunk?

Aside from the points above points, Ok.  Please give Uros a day or two to weigh in with his comments.  I'm expecting that he's fine with the patch.
H.J. Lu July 7, 2011, 8:56 p.m. UTC | #4
On Thu, Jul 7, 2011 at 1:27 PM, Mike Stump <mikestump@comcast.net> wrote:
> On Jul 7, 2011, at 11:26 AM, H.J. Lu wrote:
>> -/* { dg-do compile { target { { i?86-*-* rs6000-*-* alpha*-*-* x86_64-*-* } || { powerpc*-*-* && ilp32 } } } } */
>> +/* { dg-do compile { target { { i?86-*-* rs6000-*-* alpha*-*-* x86_64-*-* } || { powerpc*-*-* && ia32 } } } } */
>
> powerpc doesn't have an ia32 product?
>
> I think this shouldn't change?

Fixed.

>> -/* Disable the test entirely for 16-bit targets.  */
>> -#if __INT_MAX__ > 32767
>> +/* Disable the test entirely for 16-bit and x32 targets.  */
>> +#if __INT_MAX__ > 32767 && (!defined __x86_64__ || defined __LP64__)
>
> While not too important, might a dg-skip-if line be easier to read and understand?

Done.

>> -/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */
>> +/* { dg-do compile { target { { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } && { ! x32 } } } } */
>
>
> Hum, I worry about x86 walking away with large amounts of symbol space.  Please change to x86 && x32 or x86_x32.

gcc.dg/lower-subreg-1.c tests long long using on ilp32 targets.  It
should be skipped on x32 similar to ia64, spu and mips.  I don''t
know how x86 && x32 or x86_x32 will help here.

>> -/* { dg-do compile } */
>> +/* { dg-do compile { target { x32 || lp64 } } } */
>
> Likewise.

gcc.dg/pr44194-1.c is tested if a target returns structures in register.
Can you tell me how I can enable it for x32?

Thanks.
H.J. Lu July 7, 2011, 8:57 p.m. UTC | #5
On Thu, Jul 7, 2011 at 1:56 PM, H.J. Lu <hjl.tools@gmail.com> wrote:

>
>>> -/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */
>>> +/* { dg-do compile { target { { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } && { ! x32 } } } } */
>>
>>
>> Hum, I worry about x86 walking away with large amounts of symbol space.  Please change to x86 && x32 or x86_x32.
>
> gcc.dg/lower-subreg-1.c tests long long using on ilp32 targets.  It
> should be skipped on x32 similar to ia64, spu and mips.  I don''t
> know how x86 && x32 or x86_x32 will help here.
>
>>> -/* { dg-do compile } */
>>> +/* { dg-do compile { target { x32 || lp64 } } } */
>>
>> Likewise.
>
> gcc.dg/pr44194-1.c is tested if a target returns structures in register.
> Can you tell me how I can enable it for x32?
>

I will fix them.
H.J. Lu July 7, 2011, 9:12 p.m. UTC | #6
On Thu, Jul 7, 2011 at 1:57 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Jul 7, 2011 at 1:56 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>
>>
>>>> -/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */
>>>> +/* { dg-do compile { target { { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } && { ! x32 } } } } */
>>>
>>>
>>> Hum, I worry about x86 walking away with large amounts of symbol space.  Please change to x86 && x32 or x86_x32.
>>
>> gcc.dg/lower-subreg-1.c tests long long using on ilp32 targets.  It
>> should be skipped on x32 similar to ia64, spu and mips.  I don''t
>> know how x86 && x32 or x86_x32 will help here.
>>
>>>> -/* { dg-do compile } */
>>>> +/* { dg-do compile { target { x32 || lp64 } } } */
>>>
>>> Likewise.
>>
>> gcc.dg/pr44194-1.c is tested if a target returns structures in register.
>> Can you tell me how I can enable it for x32?
>>
>
> I will fix them.

Here is the updated patch.  I will wait for Uros's comments.

Thanks.
Mike Stump July 7, 2011, 9:58 p.m. UTC | #7
On Jul 7, 2011, at 2:12 PM, H.J. Lu wrote:
> Here is the updated patch.  I will wait for Uros's comments.

Please remove ChangeLog for lower-subreg-1.c and pr44194-1.c, as I don't think those files are modified anymore.
H.J. Lu July 7, 2011, 11:03 p.m. UTC | #8
On Thu, Jul 7, 2011 at 2:12 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Thu, Jul 7, 2011 at 1:57 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>> On Thu, Jul 7, 2011 at 1:56 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
>>
>>>
>>>>> -/* { dg-do compile { target { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } } } */
>>>>> +/* { dg-do compile { target { { { { ! mips64 } && { ! ia64-*-* } } && { ! spu-*-* } } && { ! x32 } } } } */
>>>>
>>>>
>>>> Hum, I worry about x86 walking away with large amounts of symbol space.  Please change to x86 && x32 or x86_x32.
>>>
>>> gcc.dg/lower-subreg-1.c tests long long using on ilp32 targets.  It
>>> should be skipped on x32 similar to ia64, spu and mips.  I don''t
>>> know how x86 && x32 or x86_x32 will help here.
>>>
>>>>> -/* { dg-do compile } */
>>>>> +/* { dg-do compile { target { x32 || lp64 } } } */
>>>>
>>>> Likewise.
>>>
>>> gcc.dg/pr44194-1.c is tested if a target returns structures in register.
>>> Can you tell me how I can enable it for x32?
>>>
>>
>> I will fix them.
>
> Here is the updated patch.  I will wait for Uros's comments.
>

I attached the wrong file.  Here is the updated patch.
diff mbox

Patch

diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 7db156f..b5b8782 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1512,6 +1512,28 @@  proc check_effective_target_ilp32 { } {
     }]
 }
 
+# Return 1 if we're generating ia32 code using default options, 0
+# otherwise.
+
+proc check_effective_target_ia32 { } {
+    return [check_no_compiler_messages ia32 object {
+	int dummy[sizeof (int) == 4
+		  && sizeof (void *) == 4
+		  && sizeof (long) == 4 ? 1 : -1] = { __i386__ };
+    }]
+}
+
+# Return 1 if we're generating x32 code using default options, 0
+# otherwise.
+
+proc check_effective_target_x32 { } {
+    return [check_no_compiler_messages x32 object {
+	int dummy[sizeof (int) == 4
+		  && sizeof (void *) == 4
+		  && sizeof (long) == 4 ? 1 : -1] = { __x86_64__ };
+    }]
+}
+
 # Return 1 if we're generating 32-bit or larger integers using default
 # options, 0 otherwise.
 
@@ -1713,7 +1735,8 @@  proc check_effective_target_vect_cmdline_needed { } {
 	if { [istarget alpha*-*-*]
 	     || [istarget ia64-*-*]
 	     || (([istarget x86_64-*-*] || [istarget i?86-*-*])
-		 && [check_effective_target_lp64])
+		 && ([check_effective_target_x32]
+		     || [check_effective_target_lp64]))
 	     || ([istarget powerpc*-*-*]
 		 && ([check_effective_target_powerpc_spe]
 		     || [check_effective_target_powerpc_altivec]))