mirror of
https://github.com/KarolS/millfork.git
synced 2025-01-19 04:31:05 +00:00
More tests
This commit is contained in:
parent
63866fffe3
commit
921a59bdad
8
src/test/scala/millfork/test/ArrayFieldsSuite.scala
Normal file
8
src/test/scala/millfork/test/ArrayFieldsSuite.scala
Normal file
@ -0,0 +1,8 @@
|
||||
package millfork.test
|
||||
|
||||
/**
|
||||
* @author Karol Stasiak
|
||||
*/
|
||||
class ArrayFieldsSuite {
|
||||
|
||||
}
|
@ -790,4 +790,30 @@ class AssemblyOptimizationSuite extends FunSuite with Matchers {
|
||||
m.readByte(0xc000) should equal(3)
|
||||
}
|
||||
}
|
||||
|
||||
test("Repeated struct array indexing optimization") {
|
||||
EmuBenchmarkRun(
|
||||
"""
|
||||
| struct A {
|
||||
| byte padding
|
||||
| byte x
|
||||
| byte y
|
||||
| }
|
||||
|
|
||||
| array(A) arr[40]
|
||||
|
|
||||
| byte output @$c000
|
||||
| void main() {
|
||||
| arr[0].x = 1
|
||||
| f(0, 50)
|
||||
| output = arr[0].y
|
||||
| }
|
||||
|
|
||||
| noinline void f(byte i, byte v) {
|
||||
| arr[i].y = arr[i].x + v
|
||||
| }
|
||||
|""".stripMargin){ m =>
|
||||
m.readByte(0xc000) should equal(51)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user