Add support for writing float literals in store_per_thread

This commit is contained in:
Steven Robertson 2010-09-10 14:33:56 -04:00
parent 6eaa80be7a
commit fb4e5b75e9

View File

@ -673,6 +673,10 @@ class _PTXStdLib(PTXFragment):
op.mov.u32(spt_base, base) op.mov.u32(spt_base, base)
self.get_gtid(spt_offset) self.get_gtid(spt_offset)
op.mad.lo.u32(spt_base, spt_offset, 4, spt_base) op.mad.lo.u32(spt_base, spt_offset, 4, spt_base)
if isinstance(val, float):
# Turn a constant float into the big-endian PTX binary float
# representation, 0fXXXXXXXX (where XX is hex byte)
val = '0f%x%x%x%x' % reversed(map(ord, struct.pack('f', val)))
op.st.b32(addr(spt_base), val) op.st.b32(addr(spt_base), val)
@ptx_func @ptx_func