Attempt to fold constants when folding expressions
All checks were successful
CI/CD Pipeline / test (pull_request) Successful in 37s
CI/CD Pipeline / build (pull_request) Has been skipped
CI/CD Pipeline / release (pull_request) Has been skipped

This commit is contained in:
2026-01-02 03:06:37 -07:00
parent 3c7300d2e1
commit 4c704b8960
9 changed files with 223 additions and 10 deletions

View File

@@ -90,4 +90,23 @@ mod bitwise_tests {
let output = compile_with_and_without_optimization(source);
insta::assert_snapshot!(output);
}
#[test]
fn test_bitwise_with_const() {
let source = indoc! {r#"
device sorterOutput = "d0";
const ingotSortClass = 19;
const equals = 0;
loop {
yield();
clr(sorterOutput);
sorterOutput[0] = (ingotSortClass << 16) | (equals << 8) | 3;
}
"#};
let output = compile_with_and_without_optimization(source);
insta::assert_snapshot!(output);
}
}

View File

@@ -0,0 +1,21 @@
---
source: libs/integration_tests/src/bitwise_tests.rs
expression: output
---
## Unoptimized Output
j main
main:
__internal_L1:
yield
clr d0
put d0 0 1245187
j __internal_L1
__internal_L2:
## Optimized Output
yield
clr d0
put d0 0 1245187
j 0