[rs6000] Fix PR79951, ICE for unrecognizable insn with -mno-cmpb

Submitted by Pat Haugen on March 15, 2017, 11:09 p.m.

Details

Message ID e8df1f35-f729-5536-29cb-c912b70da560@linux.vnet.ibm.com
State New
Headers show

Commit Message

Pat Haugen March 15, 2017, 11:09 p.m.
The define_expand for copysign<mode>3 will call
gen_copysign<mode>3_fcpsgn if either TARGET_CMPB || VECTOR_UNIT_VSX_P
(<MODE>mode) are true, but gen_copysign<mode>3_fcpsgn is missing the
check of VECTOR_UNIT_VSX_P (<MODE>mode) which results in an
unrecognizable insn ICE. This is fixed with the following patch.

Bootstrap/regtest on powerpc64le with no new regressions. Ok for trunk?
Ok for backport to GCC 5/6 branches after testing?

-Pat


2017-03-15  Pat Haugen  <pthaugen@us.ibm.com>

	PR target/79951
	* config/rs6000/rs6000.md (copysign<mode>3_fcpsgn): Test
	for VECTOR_UNIT_VSX_P (<MODE>mode) too.

testsuite/ChangeLog:
2017-03-15  Pat Haugen  <pthaugen@us.ibm.com>

	* gcc.target/powerpc/pr79951.c: New.



+

Comments

Segher Boessenkool March 16, 2017, 7:42 p.m.
On Wed, Mar 15, 2017 at 06:09:57PM -0500, Pat Haugen wrote:
> The define_expand for copysign<mode>3 will call
> gen_copysign<mode>3_fcpsgn if either TARGET_CMPB || VECTOR_UNIT_VSX_P
> (<MODE>mode) are true, but gen_copysign<mode>3_fcpsgn is missing the
> check of VECTOR_UNIT_VSX_P (<MODE>mode) which results in an
> unrecognizable insn ICE. This is fixed with the following patch.
> 
> Bootstrap/regtest on powerpc64le with no new regressions. Ok for trunk?
> Ok for backport to GCC 5/6 branches after testing?

Yes, okay for both.  Thanks,


Segher

Patch hide | download patch | download mbox

Index: config/rs6000/rs6000.md
===================================================================
--- config/rs6000/rs6000.md	(revision 246180)
+++ config/rs6000/rs6000.md	(working copy)
@@ -4831,7 +4831,7 @@  (define_insn "copysign<mode>3_fcpsgn"
 	(unspec:SFDF [(match_operand:SFDF 1 "gpc_reg_operand" "<Ff>,<Fv>")
 		      (match_operand:SFDF 2 "gpc_reg_operand" "<Ff>,<Fv>")]
 		     UNSPEC_COPYSIGN))]
-  "TARGET_<MODE>_FPR && TARGET_CMPB"
+  "TARGET_<MODE>_FPR && (TARGET_CMPB || VECTOR_UNIT_VSX_P (<MODE>mode))"
   "@
    fcpsgn %0,%2,%1
    xscpsgndp %x0,%x2,%x1"
Index: testsuite/gcc.target/powerpc/pr79951.c
===================================================================
--- testsuite/gcc.target/powerpc/pr79951.c	(nonexistent)
+++ testsuite/gcc.target/powerpc/pr79951.c	(working copy)
@@ -0,0 +1,10 @@ 
+/* { dg-do compile { target { powerpc*-*-* } } } */
+/* { dg-require-effective-target powerpc_p8vector_ok } */
+/* { dg-skip-if "do not override -mcpu" { powerpc*-*-* } { "-mcpu=*" }
{ "-mcpu=power8" } } */
+/* { dg-options "-mcpu=power8 -S -mno-cmpb" } */
+
+float testf (float x, float y)
+{
+  return __builtin_copysignf (x, y);
+}