Commit f509665f authored by Jesse Natalie's avatar Jesse Natalie Committed by Erik Faye-Lund
Browse files

microsoft/compiler: Fix (f2u8, u2f32) lowering

parent d70df998
......@@ -71,11 +71,12 @@ def remove_unsupported_casts(arr, bit_size, mask, max_unsigned_float, min_signed
continue
orig_seq = (outer_op, (inner_op, 'a@' + str(int(src_sz))))
if (outer_op[0] == 'u'):
new_seq = ('fmed3', a, 0.0, max_unsigned_float)
new_seq = ('fmin', ('fmax', a, 0.0), max_unsigned_float)
else:
new_seq = ('fmed3', a, min_signed_float, max_signed_float)
new_seq = ('fmin', ('fmax', a, min_signed_float), max_signed_float)
if outer_op_sz != src_sz:
new_seq = ('f2f' + str(int(outer_op_sz)), new_seq)
arr += [(orig_seq, new_seq)]
else:
# From float to integral, convert to integral type first, then truncate
orig_seq = (outer_op, (inner_op, a))
......@@ -85,7 +86,7 @@ def remove_unsupported_casts(arr, bit_size, mask, max_unsigned_float, min_signed
else:
shift = outer_op_sz - bit_size
new_seq = ('ishr', ('ishl', float_conv, shift), shift)
arr += [(orig_seq, new_seq)]
arr += [(orig_seq, new_seq)]
remove_unsupported_casts(no_8bit_conv, 8, 0xff, 255.0, -128.0, 127.0)
remove_unsupported_casts(no_16bit_conv, 16, 0xffff, 65535.0, -32768.0, 32767.0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment