aboutsummaryrefslogtreecommitdiffhomepage
path: root/ptx/src/pass/normalize_predicates.rs
diff options
context:
space:
mode:
authorAndrzej Janik <[email protected]>2024-10-16 03:15:48 +0200
committerGitHub <[email protected]>2024-10-16 03:15:48 +0200
commit3870a96592c6a93d3a68391f6cbaecd9c7a2bc97 (patch)
tree77faf858cfa48c618e18f058046165af949e3929 /ptx/src/pass/normalize_predicates.rs
parent1a63ef62b7ec47e5d55c1437641169a60f225eae (diff)
downloadZLUDA-3870a96592c6a93d3a68391f6cbaecd9c7a2bc97.tar.gz
ZLUDA-3870a96592c6a93d3a68391f6cbaecd9c7a2bc97.zip
Re-enable all failing PTX tests (#277)
Additionally remove unused compilation paths
Diffstat (limited to 'ptx/src/pass/normalize_predicates.rs')
-rw-r--r--ptx/src/pass/normalize_predicates.rs44
1 files changed, 0 insertions, 44 deletions
diff --git a/ptx/src/pass/normalize_predicates.rs b/ptx/src/pass/normalize_predicates.rs
deleted file mode 100644
index c971cfa..0000000
--- a/ptx/src/pass/normalize_predicates.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-use super::*;
-use ptx_parser as ast;
-
-pub(crate) fn run(
- func: Vec<NormalizedStatement>,
- id_def: &mut NumericIdResolver,
-) -> Result<Vec<UnconditionalStatement>, TranslateError> {
- let mut result = Vec::with_capacity(func.len());
- for s in func {
- match s {
- Statement::Label(id) => result.push(Statement::Label(id)),
- Statement::Instruction((pred, inst)) => {
- if let Some(pred) = pred {
- let if_true = id_def.register_intermediate(None);
- let if_false = id_def.register_intermediate(None);
- let folded_bra = match &inst {
- ast::Instruction::Bra { arguments, .. } => Some(arguments.src),
- _ => None,
- };
- let mut branch = BrachCondition {
- predicate: pred.label,
- if_true: folded_bra.unwrap_or(if_true),
- if_false,
- };
- if pred.not {
- std::mem::swap(&mut branch.if_true, &mut branch.if_false);
- }
- result.push(Statement::Conditional(branch));
- if folded_bra.is_none() {
- result.push(Statement::Label(if_true));
- result.push(Statement::Instruction(inst));
- }
- result.push(Statement::Label(if_false));
- } else {
- result.push(Statement::Instruction(inst));
- }
- }
- Statement::Variable(var) => result.push(Statement::Variable(var)),
- // Blocks are flattened when resolving ids
- _ => return Err(error_unreachable()),
- }
- }
- Ok(result)
-}