diff options
author | Andrzej Janik <[email protected]> | 2021-01-26 01:27:52 +0100 |
---|---|---|
committer | Andrzej Janik <[email protected]> | 2021-01-26 01:27:52 +0100 |
commit | 3dd2a45b4288eabb29b82d73a1829afcb2fec3a4 (patch) | |
tree | bd97c01e194179fde0ee29139576d773bc01c3d7 /ptx/src/translate.rs | |
parent | 1396bbbc9a28e499ee2bec166584bc641d9c3fc3 (diff) | |
download | ZLUDA-3dd2a45b4288eabb29b82d73a1829afcb2fec3a4.tar.gz ZLUDA-3dd2a45b4288eabb29b82d73a1829afcb2fec3a4.zip |
Fix buggy signed integer conversion
Diffstat (limited to 'ptx/src/translate.rs')
-rw-r--r-- | ptx/src/translate.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/ptx/src/translate.rs b/ptx/src/translate.rs index 471a2d7..18d750f 100644 --- a/ptx/src/translate.rs +++ b/ptx/src/translate.rs @@ -4087,8 +4087,15 @@ fn emit_implicit_conversion( {
builder.u_convert(wide_bit_type_spirv, Some(cv.dst), same_width_bit_value)?;
} else {
+ let conversion_fn = if from_parts.scalar_kind == ScalarKind::Signed
+ && to_parts.scalar_kind == ScalarKind::Signed
+ {
+ dr::Builder::s_convert
+ } else {
+ dr::Builder::u_convert
+ };
let wide_bit_value =
- builder.u_convert(wide_bit_type_spirv, None, same_width_bit_value)?;
+ conversion_fn(builder, wide_bit_type_spirv, None, same_width_bit_value)?;
emit_implicit_conversion(
builder,
map,
|