[patch][pr23594] Print the lock prefix first

Rafael EspĂ­ndola rafael.espindola at gmail.com
Tue May 26 10:55:55 PDT 2015


On 26 May 2015 at 13:03, JF Bastien <jfb at chromium.org> wrote:
> Your proposed changes looks like it undoes the following:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20141215/249076.html
> ?

Yes, that is odd.

I think I figured what is going on:

Given the C testcase in pr23594, gcc prints something like

lock cmpxchgw %cx, (%rdi)

llvm prints

lock
cmpxchgw %cx, (%rdi)

Assembling a file with

lock
cmpxchgw %cx, (%rdi)
lock cmpxchgw %cx, (%rdi)

gas produces

   0: f0 66 0f b1 0f       lock cmpxchg %cx,(%rdi)
   5: 66 f0 0f b1 0f       lock cmpxchg %cx,(%rdi)

llvm-mc produces

   0: f0 66 0f b1 0f       lock cmpxchg %cx,(%rdi)
   5: f0 66 0f b1 0f       lock cmpxchg %cx,(%rdi)

So it looks like r224283 should really be changing llc to print

lock cmpxchgw %cx, (%rdi)

and then this patch in addition to a asm parser fix should make things
consistent. I will give that a try.

Cheers,
Rafael



More information about the llvm-commits mailing list