On 04/04/17 11:30, Thomas Preudhomme wrote:
> Small multiply variants of ARM Cortex-M0, Cortex-M0+ and Cortex-M1 were
> relying on the old cost model to work when optimizing for speed. These
> stopped being used in r241965 which led to these cores starting to use
> mul instructions instead of synthetizing the multiplications. This was
> not caught by the testsuite because the test only run if RUNTESTFLAGS
> targets one of the small multiply implementations.
> 
> This commit add the small multiply cost logic to the new speed cost
> model and change the dejagnu directives to only skip the corresponding
> tests if targeting another CPU. This means running the testsuite without
> targeting any CPU will let these tests run.
> 
> ChangeLog entries are as follow:
> 
> *** gcc/ChangeLog ***
> 
> 2017-03-31  Thomas Preud'homme  <thomas.preudho...@arm.com>
> 
>     PR target/80307
>     * config/arm/arm.c (thumb1_rtx_costs): Give a cost of 32
>     instructions for small multiply cores.
> 
> 
> *** gcc/testsuite/ChangeLog ***
> 
> 2017-03-31  Thomas Preud'homme  <thomas.preudho...@arm.com>
> 
>     PR target/80307
>     * gcc.target/arm/small-multiply-m0-1.c: Do not skip test if not
>     targeting any CPU or architecture.
>     * gcc.target/arm/small-multiply-m0-2.c: Likewise.
>     * gcc.target/arm/small-multiply-m0-3.c: Likewise.
>     * gcc.target/arm/small-multiply-m0plus-1.c: Likewise.
>     * gcc.target/arm/small-multiply-m0plus-2.c: Likewise.
>     * gcc.target/arm/small-multiply-m0plus-3.c: Likewise.
>     * gcc.target/arm/small-multiply-m1-1.c: Likewise.
>     * gcc.target/arm/small-multiply-m1-2.c: Likewise.
>     * gcc.target/arm/small-multiply-m1-3.c: Likewise.
> 
> Testing: With this patch the tests now all PASS if not targeting a
> special architecture or CPU. They were all UNSUPPORTED before in the
> same situation and the -1 tests were FAILing if targeting small
> multiply cores.
> 
> Is this ok for stage4?
> 

OK.

R.

> Best regards,
> 
> Thomas
> 
> fix_pr80307_arm_small_multiply.patch
> 
> 
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 
> b24143e32e2f100000f3b150f7ed0df4fabb3cc8..33146d1f0b54bad16cdaca1902d0f0a06a18c89d
>  100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -8727,6 +8727,9 @@ thumb1_rtx_costs (rtx x, enum rtx_code code, enum 
> rtx_code outer)
>        return COSTS_N_INSNS (1);
>  
>      case MULT:
> +      if (arm_arch6m && arm_m_profile_small_mul)
> +     return COSTS_N_INSNS (32);
> +
>        if (CONST_INT_P (XEXP (x, 1)))
>       {
>         int cycles = 0;
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c
> index 
> 49132e3e83d42874385523a3d0f05522a5974113..52c652c1cba3729c121d613bdb8c9f3524b04c98
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0-1.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m0.small-multiply" { arm*-*-* } 
> { "*" } { "-mcpu=cortex-m0.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m0.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m0.small-multiply -mthumb -O2" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c
> index 
> 7f1bf7bd604fcd6ef63f8dcb1fda0645d4803e87..10d49e9eace6141a5d3c906e235b6bbddaed8b4e
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0-2.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m0.small-multiply" { arm*-*-* } 
> { "*" } { "-mcpu=cortex-m0.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m0.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m0.small-multiply -mthumb -Os" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c
> index 
> aca39d746dc83ec94dce4d690bf1b87370192e94..b4af511af86c88a6d98a2779b3dc808d2163380c
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0-3.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m0.small-multiply" { arm*-*-* } 
> { "*" } { "-mcpu=cortex-m0.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m0.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m0.small-multiply -mthumb -Os" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c
> index 
> 12e8839753c3cd01e466cf61860236ff425c4e90..59dba7cf4abc814f0ee2cf9c4776d76d644a07fc
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-1.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m0plus.small-multiply" { 
> arm*-*-* } { "*" } { "-mcpu=cortex-m0plus.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m0plus.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m0plus.small-multiply -mthumb -O2" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c
> index 
> 3e3c9b26e3c78379c439547e304cd9073fdfd36c..685ef44077669e6bc7152dd64b94d99056b93dd2
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-2.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m0plus.small-multiply" { 
> arm*-*-* } { "*" } { "-mcpu=cortex-m0plus.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m0plus.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m0plus.small-multiply -mthumb -Os" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c
> index 
> 75e34321ec221550769bf3289bb0873bd9c44295..d24e720fe677fde0adf6865b24b3daf7bb2d286c
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m0plus-3.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m0plus.small-multiply" { 
> arm*-*-* } { "*" } { "-mcpu=cortex-m0plus.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m0plus.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m0plus.small-multiply -mthumb -Os" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c
> index 
> fbe90cc4a541e4477e1279be0e7e0785788381cf..d966ae955ce8d8d02b438441a4d53262f7479d5f
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m1-1.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m1.small-multiply" { arm*-*-* } 
> { "*" } { "-mcpu=cortex-m1.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m1.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m1.small-multiply -mthumb -O2" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c
> index 
> 6fca40564ee219b43aa5948dba1a749290a4dec2..60576bb9ed155d99851d6a00cd57eb3b78ea1a13
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m1-2.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m1.small-multiply" { arm*-*-* } 
> { "*" } { "-mcpu=cortex-m1.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m1.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m1.small-multiply -mthumb -Os" } */
>  
>  int
> diff --git a/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c 
> b/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c
> index 
> bc732c32346b1650220c59caa920ce34bd2d3518..c56479d18973373fd8cc100d4614c083fd1a8cce
>  100644
> --- a/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c
> +++ b/gcc/testsuite/gcc.target/arm/small-multiply-m1-3.c
> @@ -1,6 +1,6 @@
>  /* { dg-do compile } */
>  /* { dg-require-effective-target arm_thumb1_ok } */
> -/* { dg-skip-if "Test is specific to cortex-m1.small-multiply" { arm*-*-* } 
> { "*" } { "-mcpu=cortex-m1.small-multiply" } } */
> +/* { dg-skip-if "do not override -mcpu" { *-*-* } { "-mcpu=*" "-march=*" } { 
> "-mcpu=cortex-m1.small-multiply" } } */
>  /* { dg-options "-mcpu=cortex-m1.small-multiply -mthumb -Os" } */
>  
>  int
> 

Reply via email to