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] combine: Don't mess with subregs of floating point (PR78590)


PR78590 shows a problem in change_zero_ext, where we change a zero_extend
of a subreg to a logical and.  We should only do this if the thing we are
taking the subreg of is a scalar integer, otherwise we will take a subreg
of (e.g.) a float in a different size, which is nonsensical and hits an
assert.

Tested on powerpc64-linux; committing to trunk.


Segher


2016-11-30  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/78590
	* combine.c (change_zero_ext): Transform zero_extend of subregs only
	if the subreg_reg is a scalar integer mode.

---
 gcc/combine.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/combine.c b/gcc/combine.c
index 5696eea9..fd33a4d 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -11285,6 +11285,7 @@ change_zero_ext (rtx pat)
       else if (GET_CODE (x) == ZERO_EXTEND
 	       && SCALAR_INT_MODE_P (mode)
 	       && GET_CODE (XEXP (x, 0)) == SUBREG
+	       && SCALAR_INT_MODE_P (GET_MODE (SUBREG_REG (XEXP (x, 0))))
 	       && !paradoxical_subreg_p (XEXP (x, 0))
 	       && subreg_lowpart_p (XEXP (x, 0)))
 	{
-- 
1.9.3


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