Patchwork Add check for x32 support

login
register
mail settings
Submitter Jack Howarth
Date Nov. 2, 2012, 4:28 p.m.
Message ID <20121102162839.GA24831@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/196592/
State New
Headers show

Comments

Jack Howarth - Nov. 2, 2012, 4:28 p.m.
Currently on targets like x86_64 darwin which don't support -mx32 -maddress-mode=short,
tests that pass those on dg-options fail with excessive errors at -m64. The attached patch
resolves this by adding a check_effective_target_maybe_x32 proc to test if the -mx32
-maddress-mode=short flags are supported. Tested on x86_64-apple-darwin12. Okay for
gcc trunk?
         Jack

2012-11-02  H.J. Lu  <hjl.tools@gmail.com>
	    Jack Howarth  <howarth@bromo.med.uc.edu>

	* lib/target-supports.exp (check_effective_target_maybe_x32): New proc.
	* gcc.target/i386/pr54457.c: Use dg-require-effective-target maybe_x32.
	* gcc.target/i386/pr53249.c: Likewise.
H.J. Lu - Nov. 2, 2012, 10:14 p.m.
On Fri, Nov 2, 2012 at 9:28 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>   Currently on targets like x86_64 darwin which don't support -mx32 -maddress-mode=short,
> tests that pass those on dg-options fail with excessive errors at -m64. The attached patch
> resolves this by adding a check_effective_target_maybe_x32 proc to test if the -mx32
> -maddress-mode=short flags are supported. Tested on x86_64-apple-darwin12. Okay for
> gcc trunk?
>          Jack
>
> 2012-11-02  H.J. Lu  <hjl.tools@gmail.com>
>             Jack Howarth  <howarth@bromo.med.uc.edu>
>
>         * lib/target-supports.exp (check_effective_target_maybe_x32): New proc.
>         * gcc.target/i386/pr54457.c: Use dg-require-effective-target maybe_x32.
>         * gcc.target/i386/pr53249.c: Likewise.
>
>
> Index: gcc/testsuite/gcc.target/i386/pr54457.c
> ===================================================================
> --- gcc/testsuite/gcc.target/i386/pr54457.c     (revision 193097)
> +++ gcc/testsuite/gcc.target/i386/pr54457.c     (working copy)
> @@ -1,4 +1,5 @@
>  /* { dg-do compile { target { ! { ia32 } } } } */
> +/* { dg-require-effective-target maybe_x32 } */
>  /* { dg-options "-O2 -mx32 -maddress-mode=short" } */
>
>  extern char array[40];
> Index: gcc/testsuite/gcc.target/i386/pr53249.c
> ===================================================================
> --- gcc/testsuite/gcc.target/i386/pr53249.c     (revision 193097)
> +++ gcc/testsuite/gcc.target/i386/pr53249.c     (working copy)
> @@ -1,4 +1,5 @@
>  /* { dg-do compile { target { ! { ia32 } } } } */
> +/* { dg-require-effective-target maybe_x32 } */
>  /* { dg-options "-O2 -mx32 -ftls-model=initial-exec -maddress-mode=short" } */
>
>  struct gomp_task
> Index: gcc/testsuite/lib/target-supports.exp
> ===================================================================
> --- gcc/testsuite/lib/target-supports.exp       (revision 193097)
> +++ gcc/testsuite/lib/target-supports.exp       (working copy)
> @@ -4608,6 +4608,14 @@ proc check_effective_target_lto { } {
>      return [info exists ENABLE_LTO]
>  }
>
> +# Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
> +
> +proc check_effective_target_maybe_x32 { } {
> +    return [check_no_compiler_messages maybe_x32 object {
> +        void foo (void) {}
> +    } "-mx32 -maddress-mode=short"]
> +}
> +
>  # Return 1 if this target supports the -fsplit-stack option, 0
>  # otherwise.
>

Looks good to me.  But I can't approve it.
Mike Stump - Nov. 2, 2012, 11:16 p.m.
On Nov 2, 2012, at 9:28 AM, Jack Howarth <howarth@bromo.med.uc.edu> wrote:
>  Currently on targets like x86_64 darwin which don't support -mx32 -maddress-mode=short,
> tests that pass those on dg-options fail with excessive errors at -m64. The attached patch
> resolves this by adding a check_effective_target_maybe_x32 proc to test if the -mx32
> -maddress-mode=short flags are supported. Tested on x86_64-apple-darwin12. Okay for
> gcc trunk?

Ok.

Patch

Index: gcc/testsuite/gcc.target/i386/pr54457.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr54457.c	(revision 193097)
+++ gcc/testsuite/gcc.target/i386/pr54457.c	(working copy)
@@ -1,4 +1,5 @@ 
 /* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-O2 -mx32 -maddress-mode=short" } */
 
 extern char array[40];
Index: gcc/testsuite/gcc.target/i386/pr53249.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr53249.c	(revision 193097)
+++ gcc/testsuite/gcc.target/i386/pr53249.c	(working copy)
@@ -1,4 +1,5 @@ 
 /* { dg-do compile { target { ! { ia32 } } } } */
+/* { dg-require-effective-target maybe_x32 } */
 /* { dg-options "-O2 -mx32 -ftls-model=initial-exec -maddress-mode=short" } */
 
 struct gomp_task
Index: gcc/testsuite/lib/target-supports.exp
===================================================================
--- gcc/testsuite/lib/target-supports.exp	(revision 193097)
+++ gcc/testsuite/lib/target-supports.exp	(working copy)
@@ -4608,6 +4608,14 @@  proc check_effective_target_lto { } {
     return [info exists ENABLE_LTO]
 }
 
+# Return 1 if -mx32 -maddress-mode=short can compile, 0 otherwise.
+
+proc check_effective_target_maybe_x32 { } {
+    return [check_no_compiler_messages maybe_x32 object {
+        void foo (void) {}
+    } "-mx32 -maddress-mode=short"]
+}
+
 # Return 1 if this target supports the -fsplit-stack option, 0
 # otherwise.