INNER CODE UNIT · Python

compute_sdot_vec_elem

PaddlePaddle/Paddle-Lite · lite/tools/convert_arm_sdot_to_machine_code.py:28

def compute_sdot_vec_elem(vd, vn, vm, idx):
    i = 0x4f80e000 | int(vd) | (int(vn) << 5) | (int(vm) << 16) | (int(
        idx % 2) << 21) | (int(idx / 2) << 11)
    return '".word 0x{:08x}\\n"'.format(i) + \
           ' /* sdot v{vd}.4s, v{vn}.16b, v{vm}.4b[{idx}] */\\\r\n'.format(
               vd=vd, vn=vn, vm=vm, idx=idx)


def match_sdot_patten(line):
    matched = re.search(
        r'sdot\s+v(.*?).4s\s*,\s*v(.*?).16b\s*,\s*v(.*?).4b\[(.*?)\].*', line,
        re.M | re.I)
    if matched:
        # print('matched:', matched.group(1), matched.group(2), matched.group(3), matched.group(4))
        vd = int(matched.group(1))
        vn = int(matched.group(2))
        vm = int(matched.group(3))
        idx = int(matched.group(4))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…