def test_opcount_filling_store(self): descr = ArrayDescr(0, 8, None, 'F', concrete_type='f') pack = Pack([ Node(ResOperation(rop.RAW_STORE, [0, 0, arg('f', 4)], descr), 0), Node(ResOperation(rop.RAW_STORE, [0, 0, arg('f', 4)], descr), 0), ]) assert pack.opcount_filling_vector_register(16) == 2
def test_opcount_filling_guard(self): descr = ArrayDescr(0, 4, None, 'S') vec = ResOperation(rop.VEC_RAW_LOAD_I, ['a', 'i'], descr=descr) vec.count = 4 pack = Pack([ Node(ResOperation(rop.GUARD_TRUE, [vec]), 0), Node(ResOperation(rop.GUARD_TRUE, [vec]), 1), Node(ResOperation(rop.GUARD_TRUE, [vec]), 2), Node(ResOperation(rop.GUARD_TRUE, [vec]), 3), Node(ResOperation(rop.GUARD_TRUE, [vec]), 4), Node(ResOperation(rop.GUARD_TRUE, [vec]), 5), ]) assert pack.pack_load(16) == 24 - 16 assert pack.pack_load(8) == 24 - 8 assert pack.pack_load(32) == 24 - 32 assert pack.opcount_filling_vector_register(16) == 4 ops, newops = pack.slice_operations(16) assert len(ops) == 4 assert len(newops) == 2 assert pack.opcount_filling_vector_register(8) == 2 ops, newops = pack.slice_operations(8) assert len(ops) == 2 assert len(newops) == 4
def test_opcount_filling_guard(self): descr = ArrayDescr(0,4, None, 'S') vec = ResOperation(rop.VEC_RAW_LOAD_I, ['a','i'], descr=descr) vec.count = 4 pack = Pack([Node(ResOperation(rop.GUARD_TRUE, [vec]), 0), Node(ResOperation(rop.GUARD_TRUE, [vec]), 1), Node(ResOperation(rop.GUARD_TRUE, [vec]), 2), Node(ResOperation(rop.GUARD_TRUE, [vec]), 3), Node(ResOperation(rop.GUARD_TRUE, [vec]), 4), Node(ResOperation(rop.GUARD_TRUE, [vec]), 5), ]) assert pack.pack_load(16) == 24-16 assert pack.pack_load(8) == 24-8 assert pack.pack_load(32) == 24-32 assert pack.opcount_filling_vector_register(16) == 4 ops, newops = pack.slice_operations(16) assert len(ops) == 4 assert len(newops) == 2 assert pack.opcount_filling_vector_register(8) == 2 ops, newops = pack.slice_operations(8) assert len(ops) == 2 assert len(newops) == 4
def test_opcount_filling_store(self): descr = ArrayDescr(0,8, None, 'F', concrete_type='f') pack = Pack([Node(ResOperation(rop.RAW_STORE, [0,0,arg('f',4)], descr), 0), Node(ResOperation(rop.RAW_STORE, [0,0,arg('f',4)], descr), 0), ]) assert pack.opcount_filling_vector_register(16) == 2