Author Topic: What are the 5 most absurd x86 assembly instructions?  (Read 949 times)

jj2007

  • Member
  • *****
  • Posts: 13299
  • Assembly is fun ;-)
    • MasmBasic
What are the 5 most absurd x86 assembly instructions?
« on: April 22, 2022, 08:59:36 PM »
Every instruction was created with a purpose, and even if the purpose is highly specialized, it’s still a purpose.

fnop, BSF, BSR, SARX/SHLX/SHRX, INTO, GF2P8AFFINEINVQB...

See here for the AAC instruction (use Ctrl F to find AAC inside the page); my favourite so far is WBT :cool:

LiaoMi

  • Member
  • *****
  • Posts: 1038
Re: What are the 5 most absurd x86 assembly instructions?
« Reply #1 on: April 23, 2022, 08:43:27 AM »
 :biggrin:

nopw %cs:0L(%rax,%rax,1)
nopl 0(%rax,%rax,1)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 10005
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: What are the 5 most absurd x86 assembly instructions?
« Reply #2 on: April 23, 2022, 10:19:36 AM »
 :biggrin:

I think AT&T notation GAS is more as a backend for the GNU C compiler than for writing assembler code manually. GAS with Intel notation is OK to use with a little practice.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

_japheth

  • Member
  • **
  • Posts: 100
Re: What are the 5 most absurd x86 assembly instructions?
« Reply #3 on: April 30, 2022, 03:32:59 AM »
fnop, BSF, BSR, SARX/SHLX/SHRX, INTO, GF2P8AFFINEINVQB...

Ouch - I admit I used SHLD and SHRD quite regularly and found them useful for 64-bit shifts. Since they are so absurd, what am I missing?  :hmmm:
The road to hell is paved with good intentions.

jj2007

  • Member
  • *****
  • Posts: 13299
  • Assembly is fun ;-)
    • MasmBasic
Re: What are the 5 most absurd x86 assembly instructions?
« Reply #4 on: April 30, 2022, 09:50:40 AM »
Ouch - I admit I used SHLD and SHRD quite regularly and found them useful for 64-bit shifts. Since they are so absurd, what am I missing?  :hmmm:

I didn't mention shld or shrd, and they are not found in the pages I am linking to. Probably you confuse it with the SHLX and SHRX instructions mentioned there.

I use shld/shrd 3 times in 43k lines of code, so I agree they are not absurd - although rarely needed :cool:

_japheth

  • Member
  • **
  • Posts: 100
Re: What are the 5 most absurd x86 assembly instructions?
« Reply #5 on: April 30, 2022, 10:55:24 AM »
I didn't mention shld or shrd, and they are not found in the pages I am linking to. Probably you confuse it with the SHLX and SHRX instructions mentioned there.

Ah, I see  I thought the 'X' in SHLX/SHRX was a placeholder for SHLD/SHRD/SHLQ/SHRQ/....  :tongue:
The road to hell is paved with good intentions.

jj2007

  • Member
  • *****
  • Posts: 13299
  • Assembly is fun ;-)
    • MasmBasic
Re: What are the 5 most absurd x86 assembly instructions?
« Reply #6 on: April 30, 2022, 06:42:56 PM »
SARX/SHLX/SHRX — Shift Without Affecting Flags

On a side note: "SHL is faster if surrounded by instructions that write all flags without reading them. (This is one case where ADD 1 is preferable to INC) ... still a lot worse than SHLX"