public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem of inline assembly for branch instruction
@ 2011-09-07 13:17 Naveen H. S
  2011-09-07 16:24 ` Ian Lance Taylor
  0 siblings, 1 reply; 7+ messages in thread
From: Naveen H. S @ 2011-09-07 13:17 UTC (permalink / raw)
  To: gcc-help

Hi,

We are implementing a special branch instruction for offsets between
0 and 32 bytes in CR16 port.
=======================================================================
    if (get_attr_length (insn) == 2)
      return \"beq0<tIsa>\t%0,%l1\";
    else
      return \"cmp<tIsa>\t$0, %0\;beq\t%l1\";
  }"
  [(set (attr "length")
       (if_then_else
           (and (ge (minus (match_dup 1) (pc)) (const_int 2))
                (le (minus (match_dup 1) (pc)) (const_int 32)))
           (const_int 2)
           (const_int 6)))]
=======================================================================

The branch instruction has been implemented and working as expected. 
However, it resulted in error while testing an application with inline
assembly. In the application, the linker calculated length of offset
from current location to the branch as 24. However, due to some inline
assembly in between PC and branch location, the offset is more than 32.
Hence, the linker generates error while linking application.

However, we could not find any solution to handling inline assembly in
such scenarios.
Please let us know if the compiler could be informed not to generate 
special branch instruction for code with inline assembly.
Also let us know if the inline assembly length attribute could be
passed to linker so that it can calculate the exact offset.

Thanks & Regards,
Naveen


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-05 13:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-07 13:17 Problem of inline assembly for branch instruction Naveen H. S
2011-09-07 16:24 ` Ian Lance Taylor
2011-09-08 11:26   ` Naveen H. S
2011-10-04 14:09   ` Problem with peephole optimizing the register Naveen H. S
2011-10-04 16:30     ` Ian Lance Taylor
2011-10-05  6:22       ` Naveen H. S
2011-10-05 13:48         ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).