This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils 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: PATCH: PR 834: IA64: Change br to brl for "far" branches when possible


On Tue, May 17, 2005 at 11:38:41AM +0200, Jan Beulich wrote:
> >>> Richard Henderson <rth@redhat.com> 16.05.05 19:43:45 >>>
> >On Fri, May 13, 2005 at 09:19:54AM -0700, H. J. Lu wrote:
> >> 	* elfxx-ia64.c (elfNN_ia64_relax_br): New.
> >> 	(elfNN_ia64_relax_brl): Use it.
> >
> >This is ok, but I think you really shouldn't keep the nop predicate.
> >You claimed you didn't want to change the user's code; what do you
> >think you're doing here?!?  Both stances make no sense.
> 
> I guess the most reasonable thing to do here is to keep the predicate if the slot wasn't modified (i.e. was a nop before), but to strip it if the branch was actually moved out of that slot (and with it the predicate).
> 

That makes sense. Here is the patch.


H.J.
----
2005-05-17  H.J. Lu  <hongjiu.lu@intel.com>

	* elfxx-ia64.c (elfNN_ia64_relax_br): Keep the original
	predicate on slot 0 only if slot 0 isn't br.

--- bfd/elfxx-ia64.c.nop	2005-05-17 08:33:53.000000000 -0700
+++ bfd/elfxx-ia64.c	2005-05-17 08:46:27.000000000 -0700
@@ -795,9 +795,12 @@ elfNN_ia64_relax_br (bfd_byte *contents,
 
   if (template == 0x16)
     {
-      /* For BBB, we need to put nop.m in slot 0 and keep the original
-	 predicate.  */
-      t0 &= PREDICATE_BITS << 5;
+      /* For BBB, we need to put nop.m in slot 0.  We keep the original
+	 predicate only if slot 0 isn't br.  */
+      if (br_slot == 0)
+	t0 = 0LL;
+      else
+	t0 &= PREDICATE_BITS << 5;
       t0 |= 0x1LL << (X4_SHIFT + 5);
     }
   else


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