History

x86asm: Add lzcnt/tzcnt support

We already support popcnt, add lzcnt and tzcnt as well.

Mathias Krause committed 3 years ago

Commit 9cfc8f61 parent 07969204 files · +31 −1Browse files

Unified · Split

4 files
  1. i386-asm.h +3 −0
  2. i386-tok.h +2 −0
  3. tests/asmtest.S +23 −1
  4. x86_64-asm.h +3 −0
i386-asm.h+3−0
@@ -75,6 +75,9 @@ ALT(DEF_ASM_OP2(btcw, 0x0fba, 7, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW | OPT_EA · 74 unmodified lines
75 75
76ALT(DEF_ASM_OP2(popcntw, 0xf30fb8, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))76ALT(DEF_ASM_OP2(popcntw, 0xf30fb8, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
77 77
78ALT(DEF_ASM_OP2(tzcntw, 0xf30fbc, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
79ALT(DEF_ASM_OP2(lzcntw, 0xf30fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
80
78 /* prefixes */81 /* prefixes */
79 DEF_ASM_OP0(wait, 0x9b)82 DEF_ASM_OP0(wait, 0x9b)
80 DEF_ASM_OP0(fwait, 0x9b)83 DEF_ASM_OP0(fwait, 0x9b)
i386-tok.h+2−0
@@ -269,6 +269,8 @@ · 268 unmodified lines
269 DEF_WLX(btr)269 DEF_WLX(btr)
270 DEF_WLX(btc)270 DEF_WLX(btc)
271 DEF_WLX(popcnt)271 DEF_WLX(popcnt)
272 DEF_WLX(tzcnt)
273 DEF_WLX(lzcnt)
272 274
273 DEF_WLX(lar)275 DEF_WLX(lar)
274 DEF_WLX(lsl)276 DEF_WLX(lsl)
tests/asmtest.S+23−1
@@ -766,7 +766,29 @@ int $0x10 · 765 unmodified lines
766 popcnt %rbx, %rdi766 popcnt %rbx, %rdi
767 popcntq %rcx, %r8767 popcntq %rcx, %r8
768#endif768#endif
769 769
770 lzcnt %cx, %ax
771 lzcntw %cx, %ax
772 lzcnt %edx, %ebx
773 lzcntl 8(%edi), %ecx
774#ifdef __x86_64__
775 lzcnt %rdi, %rdx
776 lzcntq %r12, %r15
777 lzcnt 0x40(%rcx), %r11
778 lzcntq (%r8), %rsi
779#endif
780
781 tzcnt %cx, %ax
782 tzcntw %cx, %ax
783 tzcnt %edx, %ebx
784 tzcntl -24(%edi), %ecx
785#ifdef __x86_64__
786 tzcnt %rbp, %rdx
787 tzcntq %rax, %r15
788 tzcnt -8(%rbp), %rcx
789 tzcntq (%r8), %r12
790#endif
791
770#ifdef __i386__792#ifdef __i386__
771 boundl %edx, 0x10000793 boundl %edx, 0x10000
772 boundw %bx, 0x1000794 boundw %bx, 0x1000
x86_64-asm.h+3−0
@@ -83,6 +83,9 @@ ALT(DEF_ASM_OP2(btcw, 0x0fba, 7, OPC_MODRM | OPC_WLX, OPT_IM8, OPT_REGW | OPT_EA · 82 unmodified lines
83 83
84ALT(DEF_ASM_OP2(popcntw, 0xf30fb8, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))84ALT(DEF_ASM_OP2(popcntw, 0xf30fb8, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
85 85
86ALT(DEF_ASM_OP2(tzcntw, 0xf30fbc, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
87ALT(DEF_ASM_OP2(lzcntw, 0xf30fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
88
86 /* prefixes */89 /* prefixes */
87 DEF_ASM_OP0(lock, 0xf0)90 DEF_ASM_OP0(lock, 0xf0)
88 DEF_ASM_OP0(rep, 0xf3)91 DEF_ASM_OP0(rep, 0xf3)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t