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: [patch] Implement builtin folding for SPARC


[Sorry for the delay]

>   This patch implements builtin folding for some SPARC VIS builtins that
> seem to have no dependencies on the status register.  I didn't implement
> fmul8sux16, fmul8ulx16, fmuld8sux16, or fmuld8ulx16 as the definitions for
> those builtins may not be correct.

Could you elaborate on the second sentence?

>   Bootstrapped and regtested on sparc-linux, ok for mainline?

This looks good, except the types of the variables used to manipulate the 
constant values.  I think you should use HOST_WIDE_INT throughout the code
because TREE_INT_CST_LOW is a HOST_WIDE_INT.  As far I can see, the other 
port that folds its builtins (Alpha) always uses HOST_WIDE_INT.

While the above change might be superfluous in most cases, there is a real 
problem in

+      if (TREE_CODE (arg0) == VECTOR_CST
+	  && TREE_CODE (arg1) == VECTOR_CST
+	  && TREE_CODE (arg2) == INTEGER_CST)
+	{
+	  long long accum = TREE_INT_CST_LOW (arg2);
+	  tree elts0 = TREE_VECTOR_CST_ELTS (arg0);
+	  tree elts1 = TREE_VECTOR_CST_ELTS (arg1);
+
+	  accum |= ((long long)TREE_INT_CST_HIGH (arg2)) << 32;
+
+	  for (; elts0 && elts1;
+	       elts0 = TREE_CHAIN (elts0), elts1 = TREE_CHAIN (elts1))
+	    {
+	      int low0 = TREE_INT_CST_LOW (TREE_VALUE (elts0));
+	      int low1 = TREE_INT_CST_LOW (TREE_VALUE (elts1));
+	      accum += abs (low0 - low1);
+	    }
+
+	  return build_int_cst_wide (rtype, accum & 0xffffffff,
+				     (accum >> 32) && 0xffffffff);
+	}

because you're not guaranteed to have 'long long' available.

-- 
Eric Botcazou


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