[Bug inline-asm/37711] Incorrect code generated for mips inline assembly

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Oct 2 19:35:00 GMT 2008



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-10-02 19:33 -------
        asm("SLL %[temp], %[c], 16\n\t"
            "MULT %[a], %[c]\n\t"
            : [result]"=h"(result), [temp]"=r"(temp)
            : [a]"r"(a), [c]"r"(c)
            : "lo");

You need an early clobber on temp since it is written to before c is read. You
want:
        asm("SLL %[temp], %[c], 16\n\t"
            "MULT %[a], %[c]\n\t"
            : [result]"=h"(result), [temp]"=&r"(temp)
            : [a]"r"(a), [c]"r"(c)
            : "lo");


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
          Component|c                           |inline-asm
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37711



More information about the Gcc-bugs mailing list