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: [gomp4] Some progress on #pragma omp simd


On 06/17/13 12:23, Richard Henderson wrote:
On 06/17/2013 10:13 AM, Aldy Hernandez wrote:
-	  data.simduid = tree_low_cst (gimple_call_arg (stmt, 0), 1);
+	  data.simduid = gimple_call_arg (stmt, 0);

Doesn't this copy the ADDR_EXPR from the call into simduid?

  simduid_to_vf::hash (const value_type *p)
  {
-  return p->simduid;
+  return htab_hash_pointer (p->simduid);

... at which point this bit is meaningless since all ADDR_EXPRs must of course
have different pointers.

I think we should validate the DECL_P extracted from the call_arg, and store
that.  The hash should use DECL_UID to minimize hash variation due to memory
layout.

As discussed on IRC. Attached are these changes you requested, plus changing OMP_CLAUSE__SIMDUID__UID to OMP_CLAUSE__SIMDUID__DECL.

I will tackle the dot named builtins in the next iteration.

BTW, this patch bootstraps with no regressions. I also manually inspected the gimple generated by the test below, and made sure that inlining func() into both foo() and bar() have different temporaries. Without this patch, the same constant was used incorrectly as arguments to __builtin_GOMP.simd_vf and __builtin_GOMP.simd_lane.

How does this look?
Aldy

#define N 1000

static inline int func (int *p)
{
  int x = 0, i;
#pragma simd reduction (+:x)
  for (i = 0; i < 1000; i++)
    x += p[i];
  return x;
}

int array[55555];
int dork[5555];
foo()
{
  return func(array);
}

bar()
{
  return func(dork) + 666;
}

Attachment: curr
Description: Text document


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