===================================================================
@@ -339,6 +339,11 @@ DEFPARAM(PARAM_MAX_COMPLETELY_PEELED_INSNS,
"max-completely-peeled-insns",
"The maximum number of insns of a completely peeled loop",
400, 0, 0)
+/* The default maximum number of insns of a peeled loop, with -O2. */
+DEFPARAM(PARAM_MAX_DEFAULT_COMPLETELY_PEELED_INSNS,
+ "max-default-completely-peeled-insns",
+ "The maximum number of insns of a completely peeled loop",
+ 200, 0, 0)
/* The maximum number of peelings of a single loop that is peeled completely. */
DEFPARAM(PARAM_MAX_COMPLETELY_PEEL_TIMES,
"max-completely-peel-times",
===================================================================
@@ -855,6 +855,18 @@ finish_options (struct gcc_options *opts, struct g
0, opts->x_param_values, opts_set->x_param_values);
}
+ /* Set PARAM_MAX_COMPLETELY_PEELED_INSNS to the default original value during
+ -O2 when -funroll-loops and -fpeel-loops are not set. */
+ if (optimize == 2 && !opts->x_flag_unroll_loops && !opts->x_flag_peel_loops
+ && !opts->x_flag_unroll_all_loops)
+
+ {
+ maybe_set_param_value
+ (PARAM_MAX_COMPLETELY_PEELED_INSNS,
+ PARAM_VALUE (PARAM_MAX_DEFAULT_COMPLETELY_PEELED_INSNS),
+ opts->x_param_values, opts_set->x_param_values);
+ }
+
/* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion
is disabled. */
if ((!opts->x_flag_tree_loop_vectorize && !opts->x_flag_tree_slp_vectorize)
===================================================================
@@ -467,7 +467,7 @@ tree_complete_unroll (void)
return tree_unroll_loops_completely (flag_unroll_loops
|| flag_peel_loops
- || optimize >= 3, true);
+ || optimize >= 2, true);
}
static bool
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-mbmi2 -O2 -dp" } */
+/* { dg-options "-mbmi2 -O2 -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi2-bzhi64-1.c"
===================================================================
@@ -3,4 +3,4 @@
#include "bmi2-pext32-1.c"
-/* { dg-final { scan-assembler-times "bmi2_pext_si3" 1 } } */
+/* { dg-final { scan-assembler "bmi2_pext_si3" } } */
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpaddb\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpaddb\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-blsr-2.c"
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpsubw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpsubw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpsrlw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpsrlw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -mbmi -fno-inline" } */
+/* { dg-options "-O2 -mbmi -fno-inline --param max-default-completely-peeled-insns=0" } */
#include "bmi-tzcnt-1.c"
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpaddw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpaddw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpsraw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpsraw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-blsi-2.c"
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-blsr-1.c"
===================================================================
@@ -3,4 +3,4 @@
#include "bmi-bextr-2.c"
-/* { dg-final { scan-assembler-times "bmi_bextr_si" 1 } } */
+/* { dg-final { scan-assembler "bmi_bextr_si" } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-blsi-1.c"
===================================================================
@@ -3,4 +3,4 @@
#include "bmi2-pext64-1.c"
-/* { dg-final { scan-assembler-times "bmi2_pext_di3" 1 } } */
+/* { dg-final { scan-assembler "bmi2_pext_di3" } } */
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpmullw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpmullw\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -3,4 +3,4 @@
#include "bmi2-pdep32-1.c"
-/* { dg-final { scan-assembler-times "bmi2_pdep_si3" 1 } } */
+/* { dg-final { scan-assembler "bmi2_pdep_si3" } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-andn-2.c"
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-mbmi2 -O2 -dp" } */
+/* { dg-options "-mbmi2 -O2 -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi2-bzhi32-1.c"
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-blsmsk-2.c"
===================================================================
@@ -31,4 +31,4 @@ void t3(void)
r[i] = sqrtf (a[i]);
}
-/* { dg-final { scan-assembler-times "vrsqrtps\[ \\t\]+\[^\n\]*%ymm" 3 } } */
+/* { dg-final { scan-assembler "vrsqrtps\[ \\t\]+\[^\n\]*%ymm" } } */
===================================================================
@@ -3,4 +3,4 @@
#include "bmi-bextr-1.c"
-/* { dg-final { scan-assembler-times "bmi_bextr_di" 1 } } */
+/* { dg-final { scan-assembler "bmi_bextr_di" } } */
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-andn-1.c"
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile { target { ! ia32 } } } */
-/* { dg-options "-O2 -mbmi -fno-inline -dp" } */
+/* { dg-options "-O2 -mbmi -fno-inline -dp --param max-default-completely-peeled-insns=0" } */
#include "bmi-blsmsk-1.c"
===================================================================
@@ -1,5 +1,5 @@
/* { dg-do compile } */
-/* { dg-options "-O2 -mbmi -fno-inline" } */
+/* { dg-options "-O2 -mbmi -fno-inline --param max-default-completely-peeled-insns=0" } */
#include "bmi-tzcnt-2.c"
===================================================================
@@ -8,5 +8,5 @@
#include "avx2-vpop-check.h"
-/* { dg-final { scan-assembler-times "vpsubb\[ \\t\]+\[^\n\]*%ymm\[0-9\]" 1 } } */
+/* { dg-final { scan-assembler "vpsubb\[ \\t\]+\[^\n\]*%ymm\[0-9\]" } } */
/* { dg-final { cleanup-saved-temps } } */
===================================================================
@@ -3,4 +3,4 @@
#include "bmi2-pdep64-1.c"
-/* { dg-final { scan-assembler-times "bmi2_pdep_di3" 1 } } */
+/* { dg-final { scan-assembler "bmi2_pdep_di3" } } */
===================================================================
@@ -154,3 +154,5 @@ fn12 (void)
fn11 (1);
fn11 (1);
}
+
+/* { dg-prune-output "array subscript is above array bounds" } */