Example #1
0
def unpack_from_vector(state, arg, index, count):
    """ Extract parts of the vector box into another vector box """
    assert count > 0
    assert index + count <= arg.count
    args = [arg, ConstInt(index), ConstInt(count)]
    vecop = OpHelpers.create_vec_unpack(arg.type, args, arg.bytesize,
                                        arg.signed, count)
    state.costmodel.record_vector_unpack(arg, index, count)
    state.oplist.append(vecop)
    return vecop
Example #2
0
def unpack_from_vector(state, arg, index, count):
    """ Extract parts of the vector box into another vector box """
    assert count > 0
    vecinfo = forwarded_vecinfo(arg)
    assert index + count <= vecinfo.count
    args = [arg, ConstInt(index), ConstInt(count)]
    vecop = OpHelpers.create_vec_unpack(arg.type, args, vecinfo.bytesize,
                                        vecinfo.signed, count)
    state.costmodel.record_vector_unpack(arg, index, count)
    state.append_to_oplist(vecop)
    return vecop
Example #3
0
def unpack_from_vector(state, arg, index, count):
    """ Extract parts of the vector box into another vector box """
    assert count > 0
    vecinfo = forwarded_vecinfo(arg)
    assert index + count <= vecinfo.count
    args = [arg, ConstInt(index), ConstInt(count)]
    vecop = OpHelpers.create_vec_unpack(arg.type, args, vecinfo.bytesize,
                                        vecinfo.signed, count)
    state.costmodel.record_vector_unpack(arg, index, count)
    state.append_to_oplist(vecop)
    return vecop
Example #4
0
 def ensure_unpacked(self, index, arg):
     if arg in self.seen or arg.is_vector():
         return arg
     (pos, var) = self.getvector_of_box(arg)
     if var:
         if var in self.invariant_vector_vars:
             return arg
         if arg in self.accumulation:
             return arg
         args = [var, ConstInt(pos), ConstInt(1)]
         vecop = OpHelpers.create_vec_unpack(var.type, args, var.bytesize,
                                             var.signed, 1)
         self.renamer.start_renaming(arg, vecop)
         self.seen[vecop] = None
         self.costmodel.record_vector_unpack(var, pos, 1)
         self.oplist.append(vecop)
         return vecop
     return arg
Example #5
0
 def ensure_unpacked(self, index, arg):
     if arg in self.seen or arg.is_vector():
         return arg
     (pos, var) = self.getvector_of_box(arg)
     if var:
         if var in self.invariant_vector_vars:
             return arg
         if arg in self.accumulation:
             return arg
         args = [var, ConstInt(pos), ConstInt(1)]
         vecinfo = forwarded_vecinfo(var)
         vecop = OpHelpers.create_vec_unpack(var.type, args, vecinfo.bytesize,
                                             vecinfo.signed, 1)
         self.renamer.start_renaming(arg, vecop)
         self.seen[vecop] = None
         self.costmodel.record_vector_unpack(var, pos, 1)
         self.oplist.append(vecop)
         return vecop
     return arg