This is the mail archive of the gcc-bugs@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: optimization/6162: gcc 3.0.4: certain i386 asm reloader ice


Michael Matz <matz@suse.de> writes:

  
  Wow.  Indeed. Some of them even have such funny things like:
  __asm__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %0,%2"           \
               : "=r" ((USItype) (sh)),                                   \
                 "=&r" ((USItype) (sl))                                   \
               : "%r" ((USItype) (ah)),                                   \
                 "%r" ((USItype) (al)),                                   \
                 "rI" ((USItype) (bl)));
  
  which obviously is broken, or

Fixed in gmp's longlong.h:

2002-01-21  Torbjorn Granlund  <tege@swox.com>

        * longlong.h (32-bit powerpc add_ssaaaa): Remove spurious commutative
        declaration.

  __asm__ ("addu.co %1,%r4,%r5\n\taddu.ci %0,%r2,%r3"                   \
             : "=r" ((USItype) (sh)),                                     \
               "=&r" ((USItype) (sl))                                     \
             : "%rJ" ((USItype) (ah)),                                    \
               "rJ" ((USItype) (bh)),                                     \
               "%rJ" ((USItype) (al)),                                    \
               "rJ" ((USItype) (bl)))
  
  which is useless (they have the same constraints, so commutativity doesn't
  matter at all).  

Well, we put commutativity declarations where they apply for
consistency.

  Some of them probably are just lucky, like:

  __asm__ ("add.f       %1, %4, %5\n\tadc       %0, %2, %3"             \
             : "=r" ((USItype) (sh)),                                     \
               "=&r" ((USItype) (sl))                                     \
             : "%r" ((USItype) (ah)),                                     \
               "rIJ" ((USItype) (bh)),                                    \
               "%r" ((USItype) (al)),                                     \
               "rIJ" ((USItype) (bl)))
  
  If called with only variables, or constants already in the right operands,
  the swapping also doesn't take place.  But if then also operand matching
  comes into play (like some asms in longlong and also your example) the
  chance of getting unlucky is even higher.  Anyway given that longlong.h
  uses it I again looked into reload, and no, it simply can't handle
  correctly more than one pair which needs swapping.  It keeps track of only
  one operand which is commutative (the 'commutative' variable), and it only
  tries each alternative twice at most (once normally and once with the last
  pair swapped).  Therefore I think longlong.h is broken, but I wonder why
  this never popped up.

In GCC, I doubt immediate values will be used for add_ssaaaa.  In GMP
immediates are used, but by conventions they are used for the 2nd
operand.

There are a couple of other packages that use longlong.h as well, but
they don't use immediates.

I suggest that we don't touch longlong.h, since it is not really a
problem.  Who knows, one day GCC might get this right.

-- 
Torbjörn


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