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]

[PATCH][Committed] Add new ppc fma test


I committed this test case as obvious to make sure some common code for FFT's
continues to generate two FMA instructions, instead of a common multiply and
then add/subtract.

2010-11-30  Michael Meissner  <meissner@linux.vnet.ibm.com>

	* gcc.target/powerpc/ppc-fma-7.c: New file, test that (a*b)+c and
	(a*b)-c generates two fma instructions, instead of separate
	multiply, add, and subtract.

Index: gcc/testsuite/gcc.target/powerpc/ppc-fma-7.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/ppc-fma-7.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/ppc-fma-7.c	(revision 0)
@@ -0,0 +1,18 @@
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-skip-if "" { powerpc*-*-darwin* } { "*" } { "" } } */
+/* { dg-require-effective-target powerpc_altivec_ok } */
+/* { dg-options "-O3 -ftree-vectorize -mcpu=power6 -ffast-math" } */
+/* { dg-final { scan-assembler-times "fmadd" 1 } } */
+/* { dg-final { scan-assembler-times "fmsub " 1 } } */
+/* { dg-final { scan-assembler-not "fmul" } } */
+/* { dg-final { scan-assembler-not "fadd " } } */
+
+/* Check whether the common FFT idiom (a*b)+c and (a*b)-c generates two fma
+   instructions, instead of a multiply, add, and subtract.  */
+
+void
+fft (double *result, double a, double b, double c)
+{
+  result[0] = (a*b) + c;
+  result[1] = (a*b) - c;
+}

-- 
Michael Meissner, IBM
5 Technology Place Drive, M/S 2757, Westford, MA 01886-3141, USA
meissner@linux.vnet.ibm.com	fax +1 (978) 399-6899


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