diff mbox

[rs6000] Fold vector multiplies in GIMPLE

Message ID 1494517914.15163.33.camel@brimstone.rchland.ibm.com
State New
Headers show

Commit Message

will schmidt May 11, 2017, 3:51 p.m. UTC
Hi, 

Add support for some of the vector multiply (sp,dp) operations in
the gimple folding.  I missed these during an earlier pass that
added the other (mule, mulo) multiply operations.  This change is
covered by the existing testcases for vector folding
(gcc.target/powerpc/fold-vec-mul-*.c).
    
Bootstrapped and tested on powerpc64le-unknown-linux-gnu, and
powerpc-unknown-linux, (p7,p8le,p8be) with no regressions.
    
Is this OK for trunk?
    
[gcc]
    
    2017-05-10  Will Schmidt  <will_schmidt@vnet.ibm.com>
    
            * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add handling for
            early GIMPLE expansion of vector multiplies.

Comments

Segher Boessenkool May 11, 2017, 6:58 p.m. UTC | #1
Hi!

On Thu, May 11, 2017 at 10:51:54AM -0500, Will Schmidt wrote:
> Add support for some of the vector multiply (sp,dp) operations in
> the gimple folding.  I missed these during an earlier pass that
> added the other (mule, mulo) multiply operations.  This change is
> covered by the existing testcases for vector folding
> (gcc.target/powerpc/fold-vec-mul-*.c).
>     
> Bootstrapped and tested on powerpc64le-unknown-linux-gnu, and
> powerpc-unknown-linux, (p7,p8le,p8be) with no regressions.
>     
> Is this OK for trunk?

Sure!  Thanks,


Segher


>     2017-05-10  Will Schmidt  <will_schmidt@vnet.ibm.com>
>     
>             * config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add handling for
>             early GIMPLE expansion of vector multiplies.
diff mbox

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a1b58e2..c4e03b4 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16860,6 +16860,17 @@  rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
 	gsi_replace (gsi, g, true);
 	return true;
       }
+    case VSX_BUILTIN_XVMULSP:
+    case VSX_BUILTIN_XVMULDP:
+      {
+	arg0 = gimple_call_arg (stmt, 0);
+	arg1 = gimple_call_arg (stmt, 1);
+	lhs = gimple_call_lhs (stmt);
+	gimple *g = gimple_build_assign (lhs, MULT_EXPR, arg0, arg1);
+	gimple_set_location (g, gimple_location (stmt));
+	gsi_replace (gsi, g, true);
+	return true;
+      }
     /* Even element flavors of vec_mul (signed). */
     case ALTIVEC_BUILTIN_VMULESB:
     case ALTIVEC_BUILTIN_VMULESH: