clean up code/fix improper indents

This commit is contained in:
Sam Sneed 2024-08-04 19:30:09 -05:00 committed by GitHub
parent 6213ed6eba
commit be9d5bf6ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

52
main.py
View file

@ -76,11 +76,6 @@ def translate_arm64_to_x86(arm64_ins):
if operands[0] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[0]], f"[{operands[1]}]"]))
elif arm64_ins.mnemonic == 'stz':
operands = arm64_ins.op_str.split(', ')
if operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [f"[{operands[0]}]", reg_mapping[operands[1]]]))
elif 'fma' in arm64_ins.mnemonic and '(63=0)' in arm64_ins.op_str:
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
@ -99,26 +94,6 @@ def translate_arm64_to_x86(arm64_ins):
x86_instructions.append(generate_x86_instruction('vmulps', [reg_mapping[operands[0]], reg_mapping[operands[0]], reg_mapping[operands[1]]]))
x86_instructions.append(generate_x86_instruction('vaddps', [reg_mapping[operands[0]], reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif 'vec' in arm64_ins.mnemonic and '(47≠4)' in arm64_ins.op_str:
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('vaddps', [reg_mapping[operands[0]], reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif 'vec' in arm64_ins.mnemonic and '(47=4)' in arm64_ins.op_str:
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping:
x86_instructions.append(generate_x86_instruction('vaddps', [reg_mapping[operands[0]], reg_mapping[operands[0]], reg_mapping[operands[0]]]))
elif arm64_ins.mnemonic == 'extrx':
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif arm64_ins.mnemonic == 'extry':
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[1]], reg_mapping[operands[0]]]))
elif arm64_ins.mnemonic == 'smulh':
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
@ -234,11 +209,6 @@ def translate_arm64_to_x86(arm64_ins):
if operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [f"[{operands[0]}]", reg_mapping[operands[1]]]))
elif arm64_ins.mnemonic == 'stz':
operands = arm64_ins.op_str.split(', ')
if operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [f"[{operands[0]}]", reg_mapping[operands[1]]]))
elif 'fma' in arm64_ins.mnemonic and '(63=0)' in arm64_ins.op_str:
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
@ -262,21 +232,6 @@ def translate_arm64_to_x86(arm64_ins):
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('vaddps', [reg_mapping[operands[0]], reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif 'vec' in arm64_ins.mnemonic and '(47=4)' in arm64_ins.op_str:
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping:
x86_instructions.append(generate_x86_instruction('vaddps', [reg_mapping[operands[0]], reg_mapping[operands[0]], reg_mapping[operands[0]]]))
elif arm64_ins.mnemonic == 'extrx':
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif arm64_ins.mnemonic == 'extry':
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[1]], reg_mapping[operands[0]]]))
elif arm64_ins.mnemonic == 'umull':
if operands[0] in reg_mapping and operands[1] in reg_mapping and operands[2] in reg_mapping and operands[3] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[2]], f"[{reg_mapping[operands[0]]} * {reg_mapping[operands[1]]}]"]))
@ -402,13 +357,6 @@ def translate_arm64_to_x86(arm64_ins):
operands = arm64_ins.op_str.split(', ')
if operands[0] in reg_mapping and operands[1] in reg_mapping and operands[2] in reg_mapping:
x86_instructions.append(generate_x86_instruction('divss', [reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif arm64_ins.mnemonic == 'extrx':
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif arm64_ins.mnemonic == 'extry':
if operands[0] in reg_mapping and operands[1] in reg_mapping:
x86_instructions.append(generate_x86_instruction('mov', [reg_mapping[operands[0]], reg_mapping[operands[1]]]))
elif arm64_ins.mnemonic == 'extrh':
if operands[0] in reg_mapping and operands[1] in reg_mapping: