Add test case for movt semantics

This requires bumping the `asl-translator` submodule to bring the changes from
GaloisInc/asl-translator#47, which are necessary for the test case to work.
This commit is contained in:
Ryan Scott 2022-10-26 14:35:00 -04:00 committed by Ryan Scott
parent e6420fc006
commit da06413771
5 changed files with 28 additions and 1 deletions

2
deps/asl-translator vendored

@ -1 +1 @@
Subproject commit 4a7eb74dada86f5296654e0daeecc21ae4e94504 Subproject commit 94fcf64dc94dfa246afd34d600cc668be717a280

View File

@ -17,3 +17,9 @@ all: $(unopt) $(opt)
# conditionally performs a bunch of other operations instead # conditionally performs a bunch of other operations instead
test-conditional-return.opt.exe: test-conditional-return.c test-conditional-return.opt.exe: test-conditional-return.c
$(CC) $(CFLAGS) -O1 $< -o $@ $(CC) $(CFLAGS) -O1 $< -o $@
# We need to pass -mcpu=cortex-a7 here
movt.unopt.exe: movt.c
$(CC) $(CFLAGS) -mcpu=cortex-a7 -O0 $< -o $@
movt.opt.exe: movt.c
$(CC) $(CFLAGS) -mcpu=cortex-a7 -O2 $< -o $@

View File

@ -0,0 +1,21 @@
// A test case which ensures that the `movt` instruction works as expected.
int __attribute__((noinline)) test_movt(void) {
int ret = 0;
// After the movt instruction, the value of r0 should be 0x10000, which
// should suffice to make the `movne %0 #1` instruction fire and set the
// value of ret (i.e., %0) to 1.
__asm__(
"movw r6, #0x0;"
"movt r6, #0x1;"
"cmp r6, #0x0;"
"movne %0, #1;"
: "=r"(ret) /* Outputs */
: /* Inputs */
: "r6", "r7" /* Clobbered registers */
);
return ret;
}
void _start() {
test_movt();
}

Binary file not shown.

Binary file not shown.