Attempt to fold constants when folding expressions
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user