[PATCH v2] X86: disambiguate unqualified btr, bts

Ramkumar Ramachandra artagnon at gmail.com
Sat Jul 13 01:59:57 PDT 2013


Ramkumar Ramachandra wrote:
> Eli Friedman wrote:
>>> +// Disambiguate btr, bts
>>> +btrw   $1, 0 // CHECK: btrw $1, 0 # encoding: [0x66,0x0f,0xba,0x34,0x25,0x00,0x00,0x00,0x00,0x01]
>>> +btr    $1, 0 // CHECK: btrw $1, 0 # encoding: [0x66,0x0f,0xba,0x34,0x25,0x00,0x00,0x00,0x00,0x01]
>>> +btsw   $1, 0 // CHECK: btsw $1, 0 # encoding: [0x66,0x0f,0xba,0x2c,0x25,0x00,0x00,0x00,0x00,0x01]
>>> +bts    $1, 0 // CHECK: btsw $1, 0 # encoding: [0x66,0x0f,0xba,0x2c,0x25,0x00,0x00,0x00,0x00,0x01]
>>
>> This doesn't match gas.
>
> Oh.  Could you please let me know what I did wrong, and how to do it
> right?

Sorry about my stupidity; I think I figured it out now.  Getting gas
to assemble this:

  btl	$1, 0
  bt	$1, 0

  btrl	$1, 0
  btr	$1, 0
  btsl	$1, 0
  bts	$1, 0

  btq $0x01,%rdx

yields:

   1 0000 0FBA2425      btl     $1, 0
   1      00000000
   1      01
   2 0009 0FBA2425      bt      $1, 0
   2      00000000
   2      01
   3
   4 0012 0FBA3425      btrl    $1, 0
   4      00000000
   4      01
   5 001b 0FBA3425      btr     $1, 0
   5      00000000
   5      01
   6 0024 0FBA2C25      btsl    $1, 0
   6      00000000
   6      01
   7 002d 0FBA2C25      bts     $1, 0
   7      00000000
   7      01
   8
   9 0036 480FBAE2      btq $0x01,%rdx
   9      01

They match!  So, I have to follow 824a907 exactly; btr/bts correspond
to btrl/btsl in exactly the same way that bt corresponds to btl.

Thanks, I'll submit a new iteration soon.



More information about the llvm-commits mailing list