diff options
author | Jose Maria Casanova Crespo <[email protected]> | 2017-07-01 07:58:26 +0200 |
---|---|---|
committer | Jose Maria Casanova Crespo <[email protected]> | 2017-12-06 08:57:18 +0100 |
commit | 1f440d00d2b6ae6f74fb850ea5acec1f1b5efa58 (patch) | |
tree | 46460eeeeeeefe82036e98926071b06ba92e441e /src/compiler/nir/nir_opcodes.py | |
parent | 2af63683bc61e1efb8f634697770d314ef07c882 (diff) |
nir: Handle fp16 rounding modes at nir_type_conversion_op
nir_type_conversion enables new operations to handle rounding modes to
convert to fp16 values. Two new opcodes are enabled nir_op_f2f16_rtne
and nir_op_f2f16_rtz.
The undefined behaviour doesn't has any effect and uses the original
nir_op_f2f16 operation.
v2: Indentation fixed (Jason Ekstrand)
v3: Use explicit case for undefined rounding and assert if
rounding mode is used for non 16-bit float conversions
(Jason Ekstrand)
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opcodes.py')
-rw-r--r-- | src/compiler/nir/nir_opcodes.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index 28a04672285..ac7333fe781 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -179,8 +179,15 @@ for src_t in [tint, tuint, tfloat]: else: bit_sizes = [8, 16, 32, 64] for bit_size in bit_sizes: - unop_convert("{0}2{1}{2}".format(src_t[0], dst_t[0], bit_size), - dst_t + str(bit_size), src_t, "src0") + if bit_size == 16 and dst_t == tfloat and src_t == tfloat: + rnd_modes = ['rtne', 'rtz', 'undef'] + for rnd_mode in rnd_modes: + unop_convert("{0}2{1}{2}_{3}".format(src_t[0], dst_t[0], + bit_size, rnd_mode), + dst_t + str(bit_size), src_t, "src0") + else: + unop_convert("{0}2{1}{2}".format(src_t[0], dst_t[0], bit_size), + dst_t + str(bit_size), src_t, "src0") # We'll hand-code the to/from bool conversion opcodes. Because bool doesn't # have multiple bit-sizes, we can always infer the size from the other type. |