Encode bnot on x86.

This commit is contained in:
Sergey Pepyakin
2018-06-09 03:20:12 +03:00
committed by Dan Gohman
parent a7813c4448
commit 399860e2aa
3 changed files with 20 additions and 0 deletions

View File

@@ -913,6 +913,15 @@ ebb0:
; asm: movsbl -50000(%rsi), %edx ; asm: movsbl -50000(%rsi), %edx
[-,%rdx] v39 = sload8.i32 v2-50000 ; bin: heap_oob 0f be 96 ffff3cb0 [-,%rdx] v39 = sload8.i32 v2-50000 ; bin: heap_oob 0f be 96 ffff3cb0
; Integer Register Operations.
; asm: notl %ecx
[-,%rcx] v4000 = bnot v1 ; bin: f7 d1
; asm: notl %esi
[-,%rsi] v4001 = bnot v2 ; bin: f7 d6
; asm: notl %r10d
[-,%r10] v4002 = bnot v3 ; bin: 41 f7 d2
; Integer Register-Register Operations. ; Integer Register-Register Operations.
; asm: addl %esi, %ecx ; asm: addl %esi, %ecx

View File

@@ -150,6 +150,9 @@ for inst, opc in [
(base.bxor, 0x31)]: (base.bxor, 0x31)]:
enc_i32_i64(inst, r.rr, opc) enc_i32_i64(inst, r.rr, opc)
# x86 has a bitwise not instruction NOT.
enc_i32_i64(base.bnot, r.ur, 0xf7, rrr=2)
# Also add a `b1` encodings for the logic instructions. # Also add a `b1` encodings for the logic instructions.
# TODO: Should this be done with 8-bit instructions? It would improve # TODO: Should this be done with 8-bit instructions? It would improve
# partial register dependencies. # partial register dependencies.

View File

@@ -348,6 +348,14 @@ fax = TailRecipe(
modrm_rr(in_reg0, in_reg1, sink); modrm_rr(in_reg0, in_reg1, sink);
''') ''')
# XX /n for a unary operation with extension bits.
ur = TailRecipe(
'ur', Unary, size=1, ins=GPR, outs=0,
emit='''
PUT_OP(bits, rex1(in_reg0), sink);
modrm_r_bits(in_reg0, bits, sink);
''')
# XX /r, but for a unary operator with separate input/output register, like # XX /r, but for a unary operator with separate input/output register, like
# copies. MR form, preserving flags. # copies. MR form, preserving flags.
umr = TailRecipe( umr = TailRecipe(