コード例 #1
0
def do_it(o):
    code = P.cutoff_comments(g_preamble)
    mul_01 = P.cutoff_comments(g_mul01)
    code += alignment_code(8)
    code += P.g_std_end + ['retq', 'align0:']
    code += P.cutoff_comments(g_load0)
    code += alignment_code(0)

    P.cook_asm(o, code, E.g_var_map, True)
コード例 #2
0
def do_it(o):
    meat = P.cutoff_comments(g_mul0)
    muladd = P.cutoff_comments(g_muladd)
    tail = P.cutoff_comments(g_tail)

    for i in range(1, 6):
        meat += mul1_code(i, muladd)
    meat += tail
    P.cook_asm(o, meat, g_var_map, True)
コード例 #3
0
def do_it(o, mul_01, muladd, tail, perm, var_map):
    p = list(range(12))
    code = mul_add_code(0, P.cutoff_comments(mul_01), p)
    mm = P.cutoff_comments(muladd)
    code += mul_add_code(2, mm, p)
    q = [int(x, 16) for x in perm.split(' ')]
    for i in range(3, 6):
        p = P.composition(p, q)
        code += mul_add_code(i, mm, p)
    j = [j for j in range(len(mm)) if mm[j].find('mulx 48(') != -1][0]
    mm = mm[:j] + P.cutoff_comments(tail)
    p = P.composition(p, q)
    code += mul_add_code(6, mm, p)
    P.cook_asm(o, code, var_map, True)
コード例 #4
0
def do_it(o, amd):
    var_map = g_var_map
    for i in range(16):
        var_map += ' x%X,xmm%s' % (i, i)
    code = g_memcpy_11.replace('@stack_taken', '%s' % g_stack_taken)
    code = chew_code(code + g_v_load_1, amd, 0, None, None)

    code += v_alignment_code(amd, 8) + v_alignment_code(amd, 0)

    code = '\n'.join(code)
    code = re.sub(r'\bwC\b', 'up', code)
    code = re.sub(r'\bwD\b', 'rp', code)
    code = code.split('\n')

    code += ['all_done:', 'add $%s,sp' % g_stack_taken]
    P.cook_asm(o, code, var_map, True)
コード例 #5
0
def do_it(o):
    mul_01 = P.cutoff_comments(E.g_mul_01)
    mul_01 = P.starting_from(mul_01, 'mulx')
    mul_01 = P.replace_in_string_array(mul_01, 'pextrq $0x1, t0, w8',
                                       'w8:=v[2]')
    code = P.cutoff_comments(g_preamble)
    code += replace_extract_v(mul_01, 8)
    code += alignment_code(8)
    # TODO: is it possible to shorten binary code by jmp to common part?
    code += P.g_std_end + ['retq', 'align0:']

    code += P.cutoff_comments(g_load0)
    code += replace_extract_v(mul_01, 0)
    code += alignment_code(0)

    P.cook_asm(o, code, E.g_var_map, True)
コード例 #6
0
def do_it(o):
    meat = P.cutoff_comments(g_mul_01)
    p = list(range(12))
    m2 = P.cutoff_comments(g_muladd_2)
    m3 = P.swap_adox_adcx(m2)
    meat += mul1_code(2, m2, p)
    q = [int(x, 16) for x in g_perm.split(' ')]
    for i in range(3, 6):
        p = P.composition(p, q)
        if i & 1:
            meat += mul1_code(i, m3, p)
        else:
            meat += mul1_code(i, m2, p)

    tail = cook_tail(m2)
    p = P.composition(p, q)
    meat += mul1_code(6, tail, p)

    P.cook_asm(o, meat, g_var_map, True)
コード例 #7
0
def do_it(o, extra):
    code = alignment_code(8, extra) + alignment_code(0, extra)
    P.cook_asm(o, code, g_var_map, True)
コード例 #8
0
def do_it(o):
    code = alignment_code(8) + alignment_code(0)
    P.cook_asm(o, code, g_var_map, True)
コード例 #9
0
def do_it(o, code, var_map):
    r = []
    for c in P.cutoff_comments(code):
        r += evaluate_row(c)
    P.cook_asm(o, r, var_map, True)
コード例 #10
0
def do_it(o):
    code = chew_code(g_preamble, 0, None, None)
    code += alignment_code(8)
    code += alignment_code(0)
    P.cook_asm(o, code, g_var_map, True)
コード例 #11
0
def do_it(o, code, var_map):
    code = [chew_line(x) for x in P.cutoff_comments(code)]
    P.cook_asm(o, code, var_map, False)