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]

[FR30] PR21283: Avoid gen_lowpart of FP SUBREGs in splitters


The following patch resolves PR target/21283 which is marked as a
4.0/4.1/4.2 regression caused by an ICE in gen_lowpart_general compiling
code containing double constants on fr30-elf.  The issue is that on FR30
load of floating point constants are represented as RTL like:

	(set (subreg:SI (reg:DF) 0) (const_int XXXX))
	(set (subreg:SI (reg:DF) 4) (const_int YYYY))

This unfortunately conflicts with one of the splitters in fr30.md that
attempts to optimize loads of SImode constants.  For suitable constants,
it attempts to transform:

	(set (reg:SI) (const_int XXXX))

into
	(set (subreg:QI (reg:SI) 0) (const_int XXXX))
	(set (reg:SI) (sign_extend:SI (subreg:QI (reg:SI) 0))

The conflict is that in attempting to construct

	(subreg:QI (subreg:SI (reg:DF) X) Y)

we require a new pseudo to hold an intermediate result.  Hence, the
call to gen_lowpart at this point in the compilation eventually runs
into the gcc_assert(!no_new_pseudos).  As this splitter is just an
optimization and not required for correctness, it seems simplest to
avoid this transformation if we identify the destination as potentially
problematic.

The following patch has been tested with a cross-compiler to fr30-elf,
where the testcase in the bugzilla PR now compiles without problems.
Indeed, we combined with the previous two patches newlib now builds
in an uberbaum tree.  Alas we now fail configuring libstdc++-v3 with
Link tests not allowed after GCC_NO_EXECUTABLES.

Ok for mainline?  This is marked as a 4.0 and 4.1 regression, but
I'm not sure what to do about the release branches until I can
regression test on mainline and judge how much needs to be backported
to resurect the FR30 port.



2006-04-16  Roger Sayle  <roger@eyesopen.com>

	PR target/21283
	* config/fr30/fr30.md (define_split): Avoid calling gen_lowpart on
	a SImode SUBREG of a floating point register after no_new_pseudos.


Index: config/fr30/fr30.md
===================================================================
*** config/fr30/fr30.md	(revision 112972)
--- config/fr30/fr30.md	(working copy)
***************
*** 290,296 ****
  (define_split
    [(set (match_operand:SI 0 "register_operand"  "")
  	(match_operand:SI 1 "const_int_operand" ""))]
!    "INTVAL (operands[1]) <= -1 && INTVAL (operands[1]) >= -128"
     [(set:SI (match_dup 0) (match_dup 1))
      (set:SI (match_dup 0) (sign_extend:SI (match_dup 2)))]
     "{
--- 290,298 ----
  (define_split
    [(set (match_operand:SI 0 "register_operand"  "")
  	(match_operand:SI 1 "const_int_operand" ""))]
!    "INTVAL (operands[1]) <= -1 && INTVAL (operands[1]) >= -128
!     && (GET_CODE (operands[0]) != SUBREG
! 	|| SCALAR_INT_MODE_P (GET_MODE (XEXP (operands[0], 0))))"
     [(set:SI (match_dup 0) (match_dup 1))
      (set:SI (match_dup 0) (sign_extend:SI (match_dup 2)))]
     "{


Roger
--


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