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 to solve PR39856


H.J. Lu wrote:
On Thu, May 21, 2009 at 7:10 AM, Richard Guenther
<richard.guenther@gmail.com> wrote:
On Fri, Apr 24, 2009 at 6:05 PM, Vladimir Makarov <vmakarov@redhat.com> wrote:
The following patch solves the PR39856. The details of the PR can be found
on

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856

The patch was successfully  bootstrapped on x86 with default options and
with -march=586 -fomit-frame-pointer -msse3.

Ok to commit into the trunk and gcc-4.4 branch?
Ok.

We should include the testcase at


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39856#c4


Thanks, Richard. I've just committed the patch to the branch and the trunk.

As for the test. How about the following patch:

2009-05-22 Vladimir Makarov <vmakarov@redhat.com>

   * testsuite/gcc.target/i386/i386.exp (check_effective_target_sse3):
       New proc.
   * testsuite/gcc.target/i386/pr39856.c: New test.

Is it ok to commit to the branch and trunk? I've checked it on x86 and x86_64.


Index: gcc/testsuite/gcc.target/i386/i386.exp
===================================================================
--- gcc/testsuite/gcc.target/i386/i386.exp	(revision 147800)
+++ gcc/testsuite/gcc.target/i386/i386.exp	(working copy)
@@ -24,6 +24,19 @@ if { ![istarget i?86*-*-*] && ![istarget
 # Load support procs.
 load_lib gcc-dg.exp
 
+# Return 1 if sse3 instructions can be compiled.
+proc check_effective_target_sse3 { } {
+    return [check_no_compiler_messages sse3 object {
+	typedef long long __m128i __attribute__ ((__vector_size__ (16)));
+	typedef float __v4sf __attribute__ ((__vector_size__ (16)));
+
+	__m128i _mm_addpsubps_epi32 (__m128i __X, __m128i __Y)
+	{
+	    return (__m128i) __builtin_ia32_addsubps ((__v4sf)__X, (__v4sf)__Y);
+	}
+    } "-O2 -msse3" ]
+}
+
 # Return 1 if ssse3 instructions can be compiled.
 proc check_effective_target_ssse3 { } {
     return [check_no_compiler_messages ssse3 object {
Index: gcc/testsuite/gcc.target/i386/pr39856.c
===================================================================
--- gcc/testsuite/gcc.target/i386/pr39856.c	(revision 0)
+++ gcc/testsuite/gcc.target/i386/pr39856.c	(revision 0)
@@ -0,0 +1,31 @@
+/* PR target/39856 */
+/* { dg-do compile } */
+/* { dg-require-effective-target sse3 } */
+/* { dg-options "-O3 -fomit-frame-pointer -m32 -msse3 -march=i586" } */
+extern double pow (double, double);
+extern double fabs (double);
+void foo (double *);
+void bar (double *);
+
+static double
+baz (double x, double e)
+{
+  if ((int) e == 1)
+    return x;
+  return pow (x, e);
+}
+
+void
+test (double *x, double *y)
+{
+  double P[3], r;
+
+  bar (P);
+  if (P[2] != 0)
+    baz (fabs (P[2]), y[2]);
+  if (fabs (P[0]) > fabs (P[1]))
+    r = baz (fabs (P[1] / P[0]), y[0]);
+  if (P[2])
+    P[2] *= (1 + r);
+  foo (x);
+}

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