def test_load_singlefloat(): descr = ArrayDescr(8, 4, None, 'S', concrete_type='f') args = [rop.InputArgInt(), ConstInt(0)] baseop = rop.ResOperation(rop.rop.RAW_LOAD_I, args, descr=descr) baseop.set_forwarded(rop.VectorizationInfo(baseop)) op = rop.VecOperation(rop.rop.VEC_RAW_LOAD_I, args, baseop, 4, descr=descr) assert (op.type, op.datatype, op.bytesize, op.is_vector()) == ('i', 'i', 4, True)
def test_vec_store(): descr = ArrayDescr(0, 8, None, 'F', concrete_type='f') vec = rop.InputArgVector() args = [rop.InputArgRef(), ConstInt(0), vec] baseop = rop.ResOperation(rop.rop.RAW_STORE, args, descr=descr) baseop.set_forwarded(rop.VectorizationInfo(baseop)) op = rop.VecOperation(rop.rop.VEC_RAW_STORE, args, baseop, 2, descr=descr) assert (op.type, op.datatype, op.bytesize, op.is_vector()) == ('v', 'v', 8, True)
def test_types(): op = rop.ResOperation(rop.rop.INT_ADD, [ConstInt(0), ConstInt(1)]) op.set_forwarded(rop.VectorizationInfo(op)) baseop = rop.ResOperation(rop.rop.CAST_FLOAT_TO_SINGLEFLOAT, [op]) baseop.set_forwarded(rop.VectorizationInfo(baseop)) op = rop.VecOperation(rop.rop.VEC_CAST_FLOAT_TO_SINGLEFLOAT, [op], baseop, 2) assert op.type == 'i' assert op.datatype == 'i' assert op.bytesize == 4
def test_vec_guard(): vec = rop.InputArgVector() vec.bytesize = 4 vec.type = vec.datatype = 'i' vec.sigend = True baseop = rop.ResOperation(rop.rop.GUARD_TRUE, [vec]) baseop.set_forwarded(rop.VectorizationInfo(baseop)) op = rop.VecOperation(rop.rop.VEC_GUARD_TRUE, [vec], baseop, 4) assert (op.type, op.datatype, op.bytesize, op.is_vector()) == ('v', 'v', 0, False)