# mir_passes @preserve "test:main" { # Check for proper reuse of a register with the same name let a: score = val 4s; mul %a, 3s; use %a; set %a, 10s; mul %a, 6s; use %a; # Adapted from sine. Inlined out and simplified. # Since this is starting with the same inputs, it should have the # same output for both. let in: score = null; let sign: score = null; let temp: score = null; let out: score = null; let x: score = null; set %in, 104s; set %sign, -400s; set %temp, %in; sub %temp, 1800s; mul %temp, %in; set %out, %temp; mul %out, %sign; add %temp, 4050000s; div %out, %temp; set %x, %out; use %x; let y: score = null; set %in, 104s; set %sign, -400s; set %temp, %in; sub %temp, 1800s; mul %temp, %in; set %out, %temp; mul %out, %sign; add %temp, 4050000s; div %out, %temp; set %y, %out; use %y; } @preserve "test:zero_mul" { let x: score = val 0s; mul %x, sco @s[] "foo"; use %x; } @preserve "test:setblock" { call run "test:setblock_fn", false; } "test:setblock_fn" bool { if bool &0: sb ~0 ~0 ~0, "stone"{}[], replace; if not bool &0: sb ~0 ~0 ~0, "smooth_stone"{}[], replace; } @preserve "test:div_by_self" { let x: score = val 10s; div %x, %x; use %x; let y: score = val 0s; div %y, %y; use %y; }