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]

Re: Accumulator based machines


Michael Hope schrieb:

The problem is when I have to clobber ACC such as when moving between
registers.  The output should be:
 LOADACC, R10; STOREACC, R11 (equivalent to ACC = R10; R11 = ACC)

I've tried a parallel clobber like:
(define_insn "movsi"
  [(set (match_operand:SI 0 "nonimmediate_operand" "=b,   dam,dam")
	(match_operand:SI 1 "general_operand"       "dami,b,  dam"))
  (clobber (reg:SI TREG_ACC))

 but this causes trouble when setting up ACC for the likes of the add
above.  The compiler runs but the code is incorrect

I've tried a parallel with a match_scratch like:
(define_insn "movsi"
  [(set (match_operand:SI 0 "nonimmediate_operand" "=b,   rm,rm")
	(match_operand:SI 1 "general_operand"       "rmi,b,  rm"))
  (clobber (match_scratch:SI 2 "=X,X,b"))
  ]
  ""
  "@
  LOADACC, %1
  STOREACC, %0
  LOADACC, %1\;STOREACC, %0"

This uses a 'b' constraint to put the scratch into ACC when moving
between registers and a 'X' constraint to ignore the scratch when
moving to or from ACC directly.

You will have to introduce secondary reloads for that purpose, see TARGET_SECONDARY_RELOAD et al.
You must not clobber regs in movM insns.


Georg-Johann


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