Commit 271be653 by Will Schmidt Committed by Will Schmidt

rs6000.c (rs6000_gimple_fold_builtin): Add handling for early expansion of vec_eqv.

[gcc]

2017-06-08  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add handling
	for early expansion of vec_eqv.

[gcc/testsuite]

2017-06-08  Will Schmidt  <will_schmidt@vnet.ibm.com>

	* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-char.c: New.
	* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-float.c: New.
	* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-floatdouble.c: New.
	* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-int.c: New.
	* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-longlong.c: New.
	* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-short.c: New.

From-SVN: r249040
parent 8ab7005b
2017-06-08 Will Schmidt <will_schmidt@vnet.ibm.com>
* config/rs6000/rs6000.c (rs6000_gimple_fold_builtin): Add handling
for early expansion of vec_eqv.
2017-06-08 Jakub Jelinek <jakub@redhat.com>
PR middle-end/81005
......
......@@ -16568,6 +16568,26 @@ rs6000_gimple_fold_builtin (gimple_stmt_iterator *gsi)
gsi_replace (gsi, g, true);
return true;
}
/* Flavors of vec_eqv. */
case P8V_BUILTIN_EQV_V16QI:
case P8V_BUILTIN_EQV_V8HI:
case P8V_BUILTIN_EQV_V4SI:
case P8V_BUILTIN_EQV_V4SF:
case P8V_BUILTIN_EQV_V2DF:
case P8V_BUILTIN_EQV_V2DI:
{
arg0 = gimple_call_arg (stmt, 0);
arg1 = gimple_call_arg (stmt, 1);
lhs = gimple_call_lhs (stmt);
tree temp = create_tmp_reg_or_ssa_name (TREE_TYPE (arg1));
gimple *g = gimple_build_assign (temp, BIT_XOR_EXPR, arg0, arg1);
gimple_set_location (g, gimple_location (stmt));
gsi_insert_before (gsi, g, GSI_SAME_STMT);
g = gimple_build_assign (lhs, BIT_NOT_EXPR, temp);
gimple_set_location (g, gimple_location (stmt));
gsi_replace (gsi, g, true);
return true;
}
default:
break;
}
2017-06-08 Will Schmidt <will_schmidt@vnet.ibm.com>
* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-char.c: New.
* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-float.c: New.
* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-floatdouble.c: New.
* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-int.c: New.
* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-longlong.c: New.
* testsuite/gcc.target/powerpc/fold-vec-logical-eqv-short.c: New.
2017-06-08 Jakub Jelinek <jakub@redhat.com>
PR c/81006
......
/* Verify that overloaded built-ins for vec_eqv with char
inputs produce the right results. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mpower8-vector -O2" } */
#include <altivec.h>
vector bool char
test1 (vector bool char x, vector bool char y)
{
return vec_eqv (x, y);
}
vector signed char
test3 (vector signed char x, vector signed char y)
{
return vec_eqv (x, y);
}
vector unsigned char
test6 (vector unsigned char x, vector unsigned char y)
{
return vec_eqv (x, y);
}
/* { dg-final { scan-assembler-times "xxleqv" 3 } } */
/* Verify that overloaded built-ins for vec_eqv with float
inputs produce the right results. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mpower8-vector -O2" } */
#include <altivec.h>
vector float
test1 (vector float x, vector float y)
{
return vec_eqv (x, y);
}
/* { dg-final { scan-assembler-times "xxleqv" 1 } } */
/* Verify that overloaded built-ins for vec_eqv with float and
double inputs for VSX produce the right results. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mpower8-vector -O2" } */
#include <altivec.h>
vector float
test1 (vector float x, vector float y)
{
return vec_eqv (x, y);
}
vector double
test2 (vector double x, vector double y)
{
return vec_eqv (x, y);
}
/* { dg-final { scan-assembler-times "xxleqv" 2 } } */
/* Verify that overloaded built-ins for vec_eqv with int
inputs produce the right results. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mpower8-vector -O2" } */
#include <altivec.h>
vector bool int
test1 (vector bool int x, vector bool int y)
{
return vec_eqv (x, y);
}
vector signed int
test3 (vector signed int x, vector signed int y)
{
return vec_eqv (x, y);
}
vector unsigned int
test6 (vector unsigned int x, vector unsigned int y)
{
return vec_eqv (x, y);
}
/* { dg-final { scan-assembler-times "xxleqv" 3 } } */
/* Verify that overloaded built-ins for vec_eqv with long long
inputs produce the right results. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mpower8-vector -O2" } */
#include <altivec.h>
vector bool long long
test1 (vector bool long long x, vector bool long long y)
{
return vec_eqv (x, y);
}
vector signed long long
test3 (vector signed long long x, vector signed long long y)
{
return vec_eqv (x, y);
}
vector unsigned long long
test6 (vector unsigned long long x, vector unsigned long long y)
{
return vec_eqv (x, y);
}
/* { dg-final { scan-assembler-times "xxleqv" 3 } } */
/* Verify that overloaded built-ins for vec_eqv with short
inputs produce the right results. */
/* { dg-do compile } */
/* { dg-require-effective-target powerpc_p8vector_ok } */
/* { dg-options "-mpower8-vector -O2" } */
#include <altivec.h>
vector bool short
test1 (vector bool short x, vector bool short y)
{
return vec_eqv (x, y);
}
vector signed short
test3 (vector signed short x, vector signed short y)
{
return vec_eqv (x, y);
}
vector unsigned short
test6 (vector unsigned short x, vector unsigned short y)
{
return vec_eqv (x, y);
}
/* { dg-final { scan-assembler-times "xxleqv" 3 } } */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment