This is the mail archive of the gcc@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]

Problem with ColdFire restricted addressing modes (mode5.6 combination)


I've gotten a testcase for gcc-3.4.1 that fails with:

./bug4.c:231: error: insn does not satisfy its constraints:
(insn 154 471 155 6 ./bug4.c:203 (set (mem/s:HI (plus:SI (reg:SI 9 %a1)
                (const_int 20 [0x14])) [4 <variable>.FAT_cnt+0 S2 A16])
        (mem:HI (plus:SI (reg/f:SI 14 %a6)
                (reg:SI 9 %a1)) [45 file_cnt+0 S4 A16])) 29 {*m68k.md:790} (nil)
    (nil))
./bug4.c:231: internal compiler error: in reload_cse_simplify_operands, at postreload.c:378

And the pattern is:

(define_insn "movhi_cf"
  [(set (match_operand:HI 0 "nonimmediate_operand" "=r<Q>,g")
	(match_operand:HI 1 "general_operand" "g,r<Q>"))]
  "TARGET_COLDFIRE && !TARGET_CFV4"
  "* return output_move_himode (operands);")

I am trying to figure out the best way to code a fix...

ColdFire has a restricted(compred to the 68k) comnination of addresing
modes available for moves.  The following summerizes the problem

Mode    Format     Description
0	Dx         data register direct
1	Ax         address register direct
2	(Ax)       address register indirect
3	-(Ax)      address register indirect w/predecrement
4	(Ax)+      address register indirect w/postincrement
5	(d16,Ax)   address register indirect w/register offset
6	(d8,Ax,Xi) address register indirect w/displacement mode
7.0	(xxx).w    absolute short
7.1	(xxx).l    absolute long
7.2	(d16,pc)   PC-relative w/register offset
7.3	(d8,pc,Xi) PC-relative w/displacement mode
7.4	#imm       immediate value

For moves, ColdFire is limited to(Smode = source, Dmode - destination):

                           Dmode
Smode    0   1   2   3   4   5   6  7.0 7.1 7.2 7.3 7.4
 0       X   X   X   X   X   X   X   X   X   X   X
 1       X   X   X   X   X   X   X   X   X   X   X
 2       X   X   X   X   X   X   X   X   X   X   X
 3       X   X   X   X   X   X   X   X   X   X   X
 4       X   X   X   X   X   X   X   X   X   X   X
 5       X   X   X   X   X   X
 6       X   X   X   X   X
 7.0     X   X   X   X   X
 7.1     X   X   X   X   X
 7.2     X   X   X   X   X   X
 7.3     X   X   X   X   X
 7.4     X   X   X   X   X   Y

Where X is valid for all ColdFire architectures and 'Y' is valid for
the ColdFire V4e byte/word.

The problem is that in this case, a mode 6 is the source(which
satisifies general_source_operand), and mode 5 is the
destination(which satisifies the predicate nonimmediate_operand).

I'm wondering if I have to create new patterns and predicates to
handle the combinations of:

Smode         Dmode
0-4           0-7.3
5	      5
6-7.4	      0-4
7.2,7.4	      5

instead of one general pattern that handles all andin its condition
clause, validate the combination or operands(any idea how?) and
rejects those that are illegal.

Any suggestions are appreciated.

-- 
Peter Barada
peter@the-baradas.com


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