This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Handle Octeon 3 not supporting MIPS paired-single instructions


On Fri, Jan 8, 2016 at 4:05 PM, Joseph Myers <joseph@codesourcery.com> wrote:
> The Octeon 3 processor does not support the MIPS paired-single
> instructions.  This results in illegal instruction errors in the
> testsuite when vectorization tests try to use those instructions.
>
> This patch teaches the compiler about that lack of support, so that
> warnings are given when -mpaired-single (or something implying it) is
> used when compiling for such a processor.  I chose to test
> TARGET_OCTEON as the simplest conditional; since the older Octeon
> processors don't support hard float at all, I don't think the choice
> matters for them.  Tests that then failed with the warning were
> updated to disable them for Octeon.
>
> Tested with no regressions for cross to mips64el-linux-gnu (Octeon
> 3).  OK to commit?

This is ok from my point of view.  I did not think about doing this at
the time I added Octeon 3 support.

Thanks,
Andrew Pinski

>
> gcc:
> 2016-01-09  Joseph Myers  <joseph@codesourcery.com>
>
>         * config/mips/mips.h (ISA_HAS_PAIRED_SINGLE): Require
>         !TARGET_OCTEON.
>
> gcc/testsuite:
> 2016-01-09  Joseph Myers  <joseph@codesourcery.com>
>
>         * gcc.target/mips/mips-3d-1.c: Use forbid_cpu=octeon.* in
>         dg-options.
>         * gcc.target/mips/mips-3d-2.c: Likewise.
>         * gcc.target/mips/mips-3d-3.c: Likewise.
>         * gcc.target/mips/mips-3d-4.c: Likewise.
>         * gcc.target/mips/mips-3d-5.c: Likewise.
>         * gcc.target/mips/mips-3d-6.c: Likewise.
>         * gcc.target/mips/mips-3d-7.c: Likewise.
>         * gcc.target/mips/mips-3d-8.c: Likewise.
>         * gcc.target/mips/mips-3d-9.c: Likewise.
>         * gcc.target/mips/mips-ps-1.c: Likewise.
>         * gcc.target/mips/mips-ps-2.c: Likewise.
>         * gcc.target/mips/mips-ps-3.c: Likewise.
>         * gcc.target/mips/mips-ps-4.c: Likewise.
>         * gcc.target/mips/mips-ps-5.c: Likewise.
>         * gcc.target/mips/mips-ps-6.c: Likewise.
>         * gcc.target/mips/mips-ps-7.c: Likewise.
>         * gcc.target/mips/mips-ps-type.c: Likewise.
>         * gcc.target/mips/mips-ps-type-2.c: Likewise.
>         * gcc.target/mips/mips16-attributes-6.c: Likewise.
>
> Index: gcc/config/mips/mips.h
> ===================================================================
> --- gcc/config/mips/mips.h      (revision 232142)
> +++ gcc/config/mips/mips.h      (working copy)
> @@ -1014,9 +1014,10 @@
>  #define ISA_HAS_LXC1_SXC1      ISA_HAS_FP4
>
>  /* ISA has paired-single instructions.  */
> -#define ISA_HAS_PAIRED_SINGLE  (ISA_MIPS64                             \
> -                                || (mips_isa_rev >= 2                  \
> -                                    && mips_isa_rev <= 5))
> +#define ISA_HAS_PAIRED_SINGLE  ((ISA_MIPS64                            \
> +                                 || (mips_isa_rev >= 2                 \
> +                                     && mips_isa_rev <= 5))            \
> +                                && !TARGET_OCTEON)
>
>  /* ISA has conditional trap instructions.  */
>  #define ISA_HAS_COND_TRAP      (!ISA_MIPS1                             \
> Index: gcc/testsuite/gcc.target/mips/mips-3d-8.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-8.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-8.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D absolute compare and conditional move builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-type-2.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-type-2.c      (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-type-2.c      (working copy)
> @@ -1,7 +1,7 @@
>  /* Test v2sf calculations.  The nmadd and nmsub patterns need
>     -ffinite-math-only.  */
>  /* { dg-do compile } */
> -/* { dg-options "(HAS_MADDPS) -mgp32 -mpaired-single -ffinite-math-only" } */
> +/* { dg-options "(HAS_MADDPS) -mgp32 -mpaired-single -ffinite-math-only forbid_cpu=octeon.*" } */
>  /* { dg-skip-if "nmadd and nmsub need combine" { *-*-* } { "-O0" } { "" } } */
>  /* { dg-final { scan-assembler "\tcvt.ps.s\t" } } */
>  /* { dg-final { scan-assembler "\tmov.ps\t" } } */
> Index: gcc/testsuite/gcc.target/mips/mips-ps-1.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-1.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-1.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mpaired-single" } */
> +/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
>
>  /* Test v2sf calculations */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-3d-1.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-1.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-1.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-3d-9.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-9.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-9.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Matrix Multiplications */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-2.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-2.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-2.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mpaired-single" } */
> +/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
>
>  /* Test MIPS paired-single builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-3d-2.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-2.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-2.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D branch-if-any-two builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-type.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-type.c        (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-type.c        (working copy)
> @@ -1,7 +1,7 @@
>  /* Test v2sf calculations.  The nmadd and nmsub patterns need
>     -ffinite-math-only.  */
>  /* { dg-do compile } */
> -/* { dg-options "-mpaired-single -mgp64 -ffinite-math-only" } */
> +/* { dg-options "-mpaired-single -mgp64 -ffinite-math-only forbid_cpu=octeon.*" } */
>  /* { dg-skip-if "nmadd and nmsub need combine" { *-*-* } { "-O0" } { "" } } */
>  /* { dg-final { scan-assembler "\tcvt.ps.s\t" } } */
>  /* { dg-final { scan-assembler "\tmov.ps\t" } } */
> Index: gcc/testsuite/gcc.target/mips/mips-ps-3.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-3.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-3.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mpaired-single" } */
> +/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
>
>  /* Test MIPS paired-single conditional move */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-3d-3.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-3.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-3.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D absolute compare builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-4.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-4.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-4.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mpaired-single" } */
> +/* { dg-options "-mpaired-single forbid_cpu=octeon.*" } */
>
>  /* Test MIPS paired-single comparisons */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-3d-4.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-4.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-4.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D branch-if-any-four builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-5.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-5.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-5.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-mpaired-single -mgp64 -ftree-vectorize" } */
> +/* { dg-options "-mpaired-single -mgp64 -ftree-vectorize forbid_cpu=octeon.*" } */
>  /* { dg-skip-if "requires vectorization" { *-*-* } { "-O0" "-Os" } { "" } } */
>
>  extern float a[] __attribute__ ((aligned (8)));
> Index: gcc/testsuite/gcc.target/mips/mips-3d-5.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-5.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-5.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D absolute-compare & branch-if-any-four builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-6.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-6.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-6.c   (working copy)
> @@ -1,7 +1,7 @@
>  /* mips-ps-2.c with an extra -ffinite-math-only option.  This option
>     changes the way that abs.ps is handled.  */
>  /* { dg-do run } */
> -/* { dg-options "-mpaired-single -ffinite-math-only" } */
> +/* { dg-options "-mpaired-single -ffinite-math-only forbid_cpu=octeon.*" } */
>
>  /* Test MIPS paired-single builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-3d-6.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-6.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-6.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D absolute compare (floats) builtin functions */
>  #include <stdlib.h>
> Index: gcc/testsuite/gcc.target/mips/mips-ps-7.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-ps-7.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-ps-7.c   (working copy)
> @@ -1,6 +1,6 @@
>  /* mips-ps-5.c with -mgp32 instead of -mgp64.  */
>  /* { dg-do compile } */
> -/* { dg-options "-mgp32 -mpaired-single -ftree-vectorize" } */
> +/* { dg-options "-mgp32 -mpaired-single -ftree-vectorize forbid_cpu=octeon.*" } */
>  /* { dg-skip-if "requires vectorization" { *-*-* } { "-O0" "-Os" } { "" } } */
>
>  extern float a[] __attribute__ ((aligned (8)));
> Index: gcc/testsuite/gcc.target/mips/mips16-attributes-6.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips16-attributes-6.c (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips16-attributes-6.c (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do compile } */
> -/* { dg-options "-mips16 addressing=absolute -mips3d" } */
> +/* { dg-options "-mips16 addressing=absolute -mips3d forbid_cpu=octeon.*" } */
>
>  static inline NOMIPS16 float
>  i1 (float f)
> Index: gcc/testsuite/gcc.target/mips/mips-3d-7.c
> ===================================================================
> --- gcc/testsuite/gcc.target/mips/mips-3d-7.c   (revision 232142)
> +++ gcc/testsuite/gcc.target/mips/mips-3d-7.c   (working copy)
> @@ -1,5 +1,5 @@
>  /* { dg-do run } */
> -/* { dg-options "-mips3d" } */
> +/* { dg-options "-mips3d forbid_cpu=octeon.*" } */
>
>  /* Test MIPS-3D absolute compare (doubles) builtin functions */
>  #include <stdlib.h>
>
> --
> Joseph S. Myers
> joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]