+2016-07-18 Yuri Rumyantsev <ysrumyan@gmail.com>
+
+ PR tree-optimization/71734
+ * tree-ssa-loop-im.c (ref_indep_loop_p_1): Add REF_LOOP argument which
+ contains REF, use it to check safelen, assume that safelen value
+ must be greater 1, fix style.
+ (ref_indep_loop_p_2): Add REF_LOOP argument.
+ (ref_indep_loop_p): Pass LOOP as additional argument to
+ ref_indep_loop_p_2.
+
2016-07-18 Dominik Vogt <vogt@linux.vnet.ibm.com>
* cfgexpand.c (expand_stack_vars): Implement synamic stack space
// { dg-do compile }
-// { dg-require-effective-target vect_simd_clones }
-// { dg-additional-options "-Ofast" }
-// { dg-additional-options "-mavx2 -fopenmp-simd" { target x86_64-*-* i?86-*-* } }
+// { dg-additional-options "-ffast-math -fopenmp-simd" }
+// { dg-additional-options "-msse2" { target x86_64-*-* i?86-*-* } }
#include <string.h>
#include <xmmintrin.h>
-inline void* my_alloc(size_t bytes) {return _mm_malloc(bytes, 128);}
-inline void my_free(void* memory) {_mm_free(memory);}
+inline void* my_alloc (size_t bytes) {return _mm_malloc (bytes, 128);}
+inline void my_free (void* memory) {_mm_free (memory);}
template <typename T>
class Vec
public:
- Vec (int n) : isize(n) {data = (T*)my_alloc(isize*sizeof(T));}
+ Vec (int n) : isize (n) {data = (T*)my_alloc (isize*sizeof (T));}
~Vec () {my_free(data);}
Vec& operator = (const Vec& other)
{
if (this != &other)
- memcpy(data, other.data, isize*sizeof(T));
+ memcpy (data, other.data, isize*sizeof (T));
return *this;
}
void Ss::foo (float *in, float w)
{
#pragma omp simd
- for (int i=0; i<S_n; i++)
+ for (int i = 0; i < S_n; i++)
{
float w1 = C2[S_n + i] * w;
v1.v_i[i] += (int)w1;
}
}
-// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" } }
+// { dg-final { scan-tree-dump "LOOP VECTORIZED" "vect" { target x86_64-*-* i?86-*-* } } }
loop = loop_outer (loop);
}
-/* Returns true if REF is independent on all other memory references in
- LOOP. */
+/* Returns true if REF in REF_LOOP is independent on all other memory
+ references in LOOP. */
static bool
-ref_indep_loop_p_1 (struct loop *loop, im_mem_ref *ref, bool stored_p)
+ref_indep_loop_p_1 (struct loop *ref_loop, struct loop *loop,
+ im_mem_ref *ref, bool stored_p)
{
bitmap refs_to_check;
unsigned i;
if (bitmap_bit_p (refs_to_check, UNANALYZABLE_MEM_ID))
return false;
- if (loop->safelen > 0)
+ if (ref_loop->safelen > 1)
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
- fprintf(dump_file,"Consider REF independent in loop#%d\n", loop->num);
- print_generic_expr(dump_file, ref->mem.ref, TDF_SLIM);
- fprintf(dump_file, "\n");
+ fprintf (dump_file,"REF is independent in ref_loop#%d\n",
+ ref_loop->num);
+ print_generic_expr (dump_file, ref->mem.ref, TDF_SLIM);
+ fprintf (dump_file, "\n");
}
return true;
}
return true;
}
-/* Returns true if REF is independent on all other memory references in
- LOOP. Wrapper over ref_indep_loop_p_1, caching its results. */
+/* Returns true if REF in REF_LOOP is independent on all other memory
+ references in LOOP. Wrapper over ref_indep_loop_p_1, caching its
+ results. */
static bool
-ref_indep_loop_p_2 (struct loop *loop, im_mem_ref *ref, bool stored_p)
+ref_indep_loop_p_2 (struct loop *ref_loop, struct loop *loop,
+ im_mem_ref *ref, bool stored_p)
{
stored_p |= (ref->stored && bitmap_bit_p (ref->stored, loop->num));
struct loop *inner = loop->inner;
while (inner)
{
- if (!ref_indep_loop_p_2 (inner, ref, stored_p))
+ if (!ref_indep_loop_p_2 (ref_loop, inner, ref, stored_p))
return false;
inner = inner->next;
}
- bool indep_p = ref_indep_loop_p_1 (loop, ref, stored_p);
+ bool indep_p = ref_indep_loop_p_1 (ref_loop, loop, ref, stored_p);
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, "Querying dependencies of ref %u in loop %d: %s\n",
{
gcc_checking_assert (MEM_ANALYZABLE (ref));
- return ref_indep_loop_p_2 (loop, ref, false);
+ return ref_indep_loop_p_2 (loop, loop, ref, false);
}
/* Returns true if we can perform store motion of REF from LOOP. */