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]

[Bug c++/43262] inline asm with -O2 breaks logic if comarisons are involved



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-03-04 22:08 -------
The problem you are seeing is Intel vs AT&T asm formats.  GNU as defaults to
AT&T format in that it is src, dst. So you have the operands swapped.  Note
also you also don't clobber the flags register as bsr sets the Zero flag.
asm volatile("bsr %1, %0" : "=r" (n) : "r" (x) : "flags");
Is the correct code you want.  It just happened to work at -O0 because the
register allocator used the same registers for the input and output.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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


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