diff options
author | Andrzej Janik <[email protected]> | 2020-10-01 20:28:57 +0200 |
---|---|---|
committer | Andrzej Janik <[email protected]> | 2020-10-01 20:28:57 +0200 |
commit | bd3d440dba9a913e2214de89a151f9c2c34984fe (patch) | |
tree | e90bd1e36968d3abae492b0c5bf22791f119fb80 /ptx/src/translate.rs | |
parent | 96a342e33f221803874ff897f4aa1aa3aae8e71c (diff) | |
download | ZLUDA-bd3d440dba9a913e2214de89a151f9c2c34984fe.tar.gz ZLUDA-bd3d440dba9a913e2214de89a151f9c2c34984fe.zip |
Implement or
Diffstat (limited to 'ptx/src/translate.rs')
-rw-r--r-- | ptx/src/translate.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/ptx/src/translate.rs b/ptx/src/translate.rs index fe6a7dc..fb1b843 100644 --- a/ptx/src/translate.rs +++ b/ptx/src/translate.rs @@ -592,6 +592,9 @@ fn convert_to_typed_statements( ast::Instruction::Shr(d, a) => {
result.push(Statement::Instruction(ast::Instruction::Shr(d, a.cast())))
}
+ ast::Instruction::Or(d, a) => {
+ result.push(Statement::Instruction(ast::Instruction::Or(d, a.cast())))
+ }
},
Statement::Label(i) => result.push(Statement::Label(i)),
Statement::Variable(v) => result.push(Statement::Variable(v)),
@@ -1583,6 +1586,14 @@ fn emit_function_body_ops( }
ast::MulDetails::Float(desc) => emit_mad_float(builder, map, desc, arg)?,
},
+ ast::Instruction::Or(t, a) => {
+ let result_type = map.get_or_add_scalar(builder, ast::ScalarType::from(*t));
+ if *t == ast::OrType::Pred {
+ builder.logical_or(result_type, Some(a.dst), a.src1, a.src2)?;
+ } else {
+ builder.bitwise_or(result_type, Some(a.dst), a.src1, a.src2)?;
+ }
+ }
},
Statement::LoadVar(arg, typ) => {
let type_id = map.get_or_add(builder, SpirvType::from(*typ));
@@ -2905,6 +2916,10 @@ impl<T: ArgParamsEx> ast::Instruction<T> { let is_wide = d.is_wide();
ast::Instruction::Mad(d, a.map(visitor, inst_type, is_wide)?)
}
+ ast::Instruction::Or(t, a) => ast::Instruction::Or(
+ t,
+ a.map_non_shift(visitor, ast::Type::Scalar(t.into()), false)?,
+ ),
})
}
}
@@ -3113,6 +3128,7 @@ impl ast::Instruction<ExpandedArgParams> { | ast::Instruction::Ret(_)
| ast::Instruction::Abs(_, _)
| ast::Instruction::Call(_)
+ | ast::Instruction::Or(_, _)
| ast::Instruction::Mad(_, _) => None,
}
}
|