Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added timing tests for BiosChecksum, BgAffineSet, and ObjAffineSet #15

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
268 changes: 266 additions & 2 deletions src/tests/swi.s
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ TEST_THUMB(testCpuSetThumb, _(
ldr r0, =0x02000000 ;
ldr r1, =0x02000000 ;
ldr r2, =0x100 ;
swi $0xC ;
swi $0xB ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4-r5}), _(pop {r4-r5}))
Expand All @@ -141,9 +141,273 @@ TEST_ARM(testCpuSetArm, _(
mov r0, #0x02000000 ;
mov r1, #0x02000000 ;
mov r2, #0x100 ;
swi $0xC0000 ;
swi $0xB0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testCpuSet, testCpuSetArm, testCpuSetThumb)

TEST_THUMB(testCpuFastSetThumb, _(
mov r4, r0 ;
mov r5, r1 ;
ldr r0, =0x02000000 ;
ldr r1, =0x02000000 ;
ldr r2, =0x100 ;
swi $0xC ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4-r5}), _(pop {r4-r5}))

TEST_ARM(testCpuFastSetArm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x02000000 ;
mov r1, #0x02000000 ;
mov r2, #0x100 ;
swi $0xC0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testCpuFastSet, testCpuFastSetArm, testCpuFastSetThumb)

TEST_THUMB(testCpuFastSet2Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
ldr r0, =0x02000000 ;
ldr r1, =0x02002000 ; // Hopefully unused
ldr r2, =0x01000100 ;
swi $0xC ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4-r5}), _(pop {r4-r5}))

TEST_ARM(testCpuFastSet2Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x02000000 ;
ldr r1, =0x02002000 ;
ldr r2, =0x01000100 ;
swi $0xC0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testCpuFastSet2, testCpuFastSet2Arm, testCpuFastSet2Thumb)

TEST_THUMB(testCpuFastSet3Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
ldr r0, =0x02000000 ;
ldr r1, =0x02000000 ;
mov r2, #0x0 ;
swi $0xC ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4-r5}), _(pop {r4-r5}))

TEST_ARM(testCpuFastSet3Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x02000000 ;
mov r1, #0x02000000 ;
mov r2, #0x0 ;
swi $0xC0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testCpuFastSet3, testCpuFastSet3Arm, testCpuFastSet3Thumb)

TEST_THUMB(testCpuFastSet4Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
ldr r1, =0x02000000 ;
ldr r2, =0x100 ;
swi $0xC ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4-r5}), _(pop {r4-r5}))

TEST_ARM(testCpuFastSet4Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x02000000 ;
mov r2, #0x100 ;
swi $0xC0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testCpuFastSet4, testCpuFastSet4Arm, testCpuFastSet4Thumb)

TEST_THUMB(testBiosChecksumThumb, _(
mov r4, r0 ;
mov r5, r1 ;
swi $0xD ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testBiosChecksumArm, _(
mov r4, r0 ;
mov r5, r1 ;
swi $0xD0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testBiosChecksum, testBiosChecksumArm, testBiosChecksumThumb)

TEST_THUMB(testBgAffineSetThumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x0 ;
swi $0xE ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testBgAffineSetArm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x0 ;
swi $0xE0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testBgAffineSet, testBgAffineSetArm, testBgAffineSetThumb)

TEST_THUMB(testBgAffineSet2Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x1 ;
swi $0xE ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testBgAffineSet2Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x1 ;
swi $0xE0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testBgAffineSet2, testBgAffineSet2Arm, testBgAffineSet2Thumb)

TEST_THUMB(testBgAffineSet3Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x2 ;
swi $0xE ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testBgAffineSet3Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x2 ;
swi $0xE0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testBgAffineSet3, testBgAffineSet3Arm, testBgAffineSet3Thumb)

TEST_THUMB(testObjAffineSetThumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x0 ;
mov r3, #0x0 ;
swi $0xF ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testObjAffineSetArm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x0 ;
mov r3, #0x0 ;
swi $0xF0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testObjAffineSet, testObjAffineSetArm, testObjAffineSetThumb)

TEST_THUMB(testObjAffineSet2Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x1 ;
mov r3, #0x0 ;
swi $0xF ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testObjAffineSet2Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x1 ;
mov r3, #0x0 ;
swi $0xF0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testObjAffineSet2, testObjAffineSet2Arm, testObjAffineSet2Thumb)

TEST_THUMB(testObjAffineSet3Thumb, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x2 ;
mov r3, #0x0 ;
swi $0xF ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_ARM(testObjAffineSet3Arm, _(
mov r4, r0 ;
mov r5, r1 ;
mov r0, #0x0 ;
mov r1, #0x0 ;
mov r2, #0x2 ;
mov r3, #0x0 ;
swi $0xF0000 ;
mov r0, r4 ;
mov r1, r5 ;
), _(push {r4, r5}), _(pop {r4, r5}))

TEST_VARIANT(testObjAffineSet3, testObjAffineSet3Arm, testObjAffineSet3Thumb)
77 changes: 77 additions & 0 deletions src/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ void testSqrt2(struct TestTimings*);
void testSqrt3(struct TestTimings*);
void testAtan(struct TestTimings*);
void testCpuSet(struct TestTimings*);
void testCpuFastSet(struct TestTimings*);
void testCpuFastSet2(struct TestTimings*);
void testCpuFastSet3(struct TestTimings*);
void testCpuFastSet4(struct TestTimings*);
void testBiosChecksum(struct TestTimings*);
void testBgAffineSet(struct TestTimings*);
void testBgAffineSet2(struct TestTimings*);
void testBgAffineSet3(struct TestTimings*);
void testObjAffineSet(struct TestTimings*);
void testObjAffineSet2(struct TestTimings*);
void testObjAffineSet3(struct TestTimings*);
void testTrivialDma(struct TestTimings*);
void testTrivialDmaRom(struct TestTimings*);
void testTrivialDmaToRom(struct TestTimings*);
Expand Down Expand Up @@ -751,11 +762,77 @@ static const struct TimingTest timingTests[] = {
122, 104
} },
{ "CpuSet", testCpuSet, TEST_ARM | TEST_THUMB, {
4000, 4000, 3998, 3998, 3981, 3981, 3979, 3979,
3996, 3944,
4003, 4003, 3995, 3995, 3994, 3994, 3986, 3986,
3987, 3950
} },
{ "CpuFastSet", testCpuFastSet, TEST_ARM | TEST_THUMB, {
3453, 3453, 3451, 3451, 3434, 3434, 3432, 3432,
3449, 3397,
3456, 3456, 3448, 3448, 3447, 3447, 3439, 3439,
3440, 3403
} },
{ "CpuFastSet 2", testCpuFastSet2, TEST_ARM | TEST_THUMB, {
1890, 1890, 1884, 1884, 1871, 1871, 1865, 1865,
1878, 1816,
1871, 1871, 1863, 1863, 1862, 1862, 1854, 1854,
1855, 1818
} },
{ "CpuFastSet 3", testCpuFastSet3, TEST_ARM | TEST_THUMB, {
148, 148, 146, 146, 129, 129, 127, 127,
144, 92,
140, 140, 134, 134, 131, 131, 125, 125,
128, 96
} },
{ "CpuFastSet 4", testCpuFastSet4, TEST_ARM | TEST_THUMB, {
150, 150, 148, 148, 131, 131, 129, 129,
146, 94,
142, 142, 136, 136, 133, 133, 127, 127,
130, 98
} },
{ "BIOS Checksum", testBiosChecksum, TEST_ARM | TEST_THUMB, {
41056, 41056, 41054, 41054, 41043, 41043, 41041, 41041,
41052, 41015,
41035, 41035, 41033, 41033, 41029, 41029, 41027, 41027,
41031, 41015
} },
{ "BgAffineSet", testBgAffineSet, TEST_ARM | TEST_THUMB, {
137, 137, 135, 135, 118, 118, 116, 116,
133, 81,
107, 107, 105, 105, 98, 98, 96, 96,
103, 81
} },
{ "BgAffineSet 2", testBgAffineSet2, TEST_ARM | TEST_THUMB, {
217, 217, 215, 215, 198, 198, 196, 196,
213, 161,
187, 187, 185, 185, 178, 178, 176, 176,
183, 161
} },
{ "BgAffineSet 3", testBgAffineSet3, TEST_ARM | TEST_THUMB, {
301, 301, 299, 299, 282, 282, 280, 280,
297, 245,
271, 271, 269, 269, 262, 262, 260, 260,
267, 245
} },
{ "ObjAffineSet", testObjAffineSet, TEST_ARM | TEST_THUMB, {
135, 135, 133, 133, 114, 114, 112, 112,
131, 74,
102, 102, 100, 100, 92, 92, 90, 90,
98, 74
} },
{ "ObjAffineSet 2", testObjAffineSet2, TEST_ARM | TEST_THUMB, {
185, 185, 183, 183, 164, 164, 162, 162,
181, 124,
152, 152, 150, 150, 142, 142, 140, 140,
148, 124
} },
{ "ObjAffineSet 3", testObjAffineSet3, TEST_ARM | TEST_THUMB, {
235, 235, 233, 233, 214, 214, 212, 212,
231, 174,
202, 202, 200, 200, 192, 192, 190, 190,
198, 174
} },
{ "Trivial DMA (16)", testTrivialDma, TEST_ARM | TEST_THUMB, {
13, 10, 12, 10, 12, 8, 11, 8,
11, 2,
Expand Down