4/24 working tests for ARMv7l

This commit is contained in:
Jeremiah Orians 2019-03-10 13:07:19 -04:00
parent 740f376828
commit f357464727
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
8 changed files with 122 additions and 18 deletions

View File

@ -16,7 +16,7 @@
* Current
** Added
Added 3/24 working tests for armv7l
Added 4/24 working tests for armv7l
** Changed

View File

@ -231,7 +231,7 @@ void constant_load(struct token_list* a)
{
if(KNIGHT_POSIX == Architecture) emit_out("LOADI R0 ");
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#constant_load\n");
else if(ARMV7L == Architecture) emit_out("!0 R0 LOAD32 R15 MEMORY\n~0 JUMP\n%");
emit_out(a->arguments->s);
emit_out("\n");
}
@ -247,16 +247,18 @@ void variable_load(struct token_list* a)
if(KNIGHT_POSIX == Architecture) emit_out("ADDI R0 R14 ");
else if(X86 == Architecture) emit_out("LOAD_BASE_ADDRESS_eax %");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#variable_load\n");
else if(ARMV7L == Architecture) emit_out("!");
emit_out(numerate_number(a->depth));
if(ARMV7L == Architecture) emit_out(" R0 ADD R12 ARITH_ALWAYS");
emit_out("\n");
if(TRUE == Address_of) return;
if(match("=", global_token->s)) return;
if(KNIGHT_POSIX == Architecture) emit_out("LOAD R0 R0 0\n");
else if(X86 == Architecture) emit_out("LOAD_INTEGER\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#variable_load\n");
else if(ARMV7L == Architecture) emit_out("!0 R0 LOAD32 R0 MEMORY\n");
}
void function_load(struct token_list* a)
@ -774,24 +776,24 @@ void primary_expr()
else if('-' == global_token->s[0])
{
if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %0\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#primary_expr\n");
else if(ARMV7L == Architecture) emit_out("!0 R0 LOADI8_ALWAYS\n");
common_recursion(primary_expr);
if(KNIGHT_POSIX == Architecture) emit_out("NEG R0 R0\n");
else if(X86 == Architecture) emit_out("SUBTRACT_eax_from_ebx_into_ebx\nMOVE_ebx_to_eax\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#primary_expr\n");
else if(ARMV7L == Architecture) emit_out("'0' R0 R0 SUB R1 ARITH2_ALWAYS\n");
}
else if('!' == global_token->s[0])
{
if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %1\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#primary_expr\n");
else if(ARMV7L == Architecture) emit_out("!1 R0 LOADI8_ALWAYS\n");
common_recursion(postfix_expr);
if(KNIGHT_POSIX == Architecture) emit_out("XORI R0 R0 1\n");
else if(X86 == Architecture) emit_out("XOR_ebx_eax_into_eax\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#primary_expr\n");
else if(ARMV7L == Architecture) emit_out("'0' R0 R0 XOR R1 ARITH2_ALWAYS\n");
}
else if('~' == global_token->s[0])
{
@ -799,7 +801,7 @@ void primary_expr()
if(KNIGHT_POSIX == Architecture) emit_out("NOT R0 R0\n");
else if(X86 == Architecture) emit_out("NOT_eax\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#primary_expr\n");
else if(ARMV7L == Architecture) emit_out("'0' R0 R0 MVN_ALWAYS\n");
}
else if(global_token->s[0] == '(')
{
@ -1335,7 +1337,7 @@ void declare_function()
/* Prevent duplicate RETURNS */
if((KNIGHT_POSIX == Architecture) && !match("RET R15\n", out->s)) emit_out("RET R15\n");
else if((X86 == Architecture) && !match("RETURN\n", out->s)) emit_out("RETURN\n");
else if(ARMV7L == Architecture) emit_out("'0' R14 R15 MOVE_ALWAYS\n");
else if((ARMV7L == Architecture) && !match("'0' R14 R15 MOVE_ALWAYS\n", out->s)) emit_out("'0' R14 R15 MOVE_ALWAYS\n");
}
}

View File

@ -92,6 +92,8 @@ test: test00-knight-posix-binary \
test00-armv7l-binary \
test01-armv7l-binary \
test02-armv7l-binary \
test03-armv7l-binary \
test04-armv7l-binary \
test00-x86-binary \
test01-x86-binary \
test02-x86-binary \
@ -211,6 +213,12 @@ test01-armv7l-binary: M2-Planet | results
test02-armv7l-binary: M2-Planet | results
test/test02/hello-armv7l.sh
test03-armv7l-binary: M2-Planet | results
test/test03/hello-armv7l.sh
test04-armv7l-binary: M2-Planet | results
test/test04/hello-armv7l.sh
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh

View File

@ -53,7 +53,7 @@ DEFINE LOADI8_GE 0A0A3
DEFINE LOADI8_EQUAL 0A003
DEFINE LOADI8_NE 0A013
DEFINE LOADI8_LE 0A0D3
DEFINE LOADI8_l 0A0B3
DEFINE LOADI8_L 0A0B3
# JUMP/BRANCH
DEFINE JUMP EA
@ -62,16 +62,20 @@ DEFINE CALL_ALWAYS EB
# Data movement
DEFINE MOVE_ALWAYS 0A0E1
DEFINE MVN_ALWAYS 0E0E1
DEFINE PUSH_ALWAYS 2DE9
DEFINE POP_ALWAYS bde8
# Arithmetic
# Arithmetic/logic
DEFINE AUX_ALWAYS E1
DEFINE IMM_ALWAYS E3
DEFINE ARITH_ALWAYS E2
DEFINE ARITH2_ALWAYS E0
DEFINE ADD 08
DEFINE XOR 02
DEFINE CMP 005
DEFINE CMPI8 005
DEFINE SUB 04
# SYSCALL
DEFINE SYSCALL_ALWAYS 000000EF

View File

@ -1,14 +1,16 @@
fae8083f3cda34eb0700e5f737fec8ebd37e2e497dbb07877b08761724db81a0 test/results/test00-armv7l-binary
95f2ceced02ccdf5704e96d44fd36d07d769cabb2d1bca926145929d0a3cb8ed test/results/test00-armv7l-binary
64879eebceb475f21e54cb1f2e872996ca80e8c1fbb8b5895fb5fb6bac0c4384 test/results/test00-knight-posix-binary
c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary
9b088242569dedc540b8abfd5de2d90ae201ac3b97e5c3dcd6d6760358b9f4b2 test/results/test01-armv7l-binary
7b711844a2c472626430d9e0db63a99abfc599f9df55df6c44b523732267441f test/results/test01-armv7l-binary
486ee05ccea796a9cfa9bfb23189b8e014b7ce8d14fea03b27d679d410fe17dd test/results/test01-knight-posix-binary
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
791244db88cfeffb73989a0643c3b1e75d2a697f3a954f66158521fbeef85f5a test/results/test02-armv7l-binary
3d10a15119546b1fe2368ef849c348a0ac6303bddf5e724de841bce1225506f6 test/results/test02-armv7l-binary
e6493845b9e94a617649638252f23502f9212de583fd00cba6cc07fffd296e32 test/results/test02-knight-posix-binary
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
458494405d2a56556775d317bc59e88e8844a18658417752da78c315f4434b64 test/results/test03-armv7l-binary
96849d5a9294799a9648c24db21b2dab1555dd5ba69d172d77df800622347226 test/results/test03-knight-posix-binary
2313cb3f1a2b9eb6bf15f8d43418e15d6c16f7f1b5c22700fdfc2b38beb59192 test/results/test03-x86-binary
49d35e2e98f7975ce8f401b23475421caa1eb5274b1a42eabcf9c8bd5e17eea1 test/results/test04-armv7l-binary
df9ba08dfa69ac6cbb4483146dbbe079ef575d7de8318e2e52283151ebf24bd3 test/results/test04-knight-posix-binary
b7ddb37063c541c6a315809c4438aa235d6702f54bb64f4ffc88dbe78617de81 test/results/test04-x86-binary
5db3a2fbd84150dae41e1c778f2822d053a0539cbdf59bba56e5514222f46674 test/results/test05-knight-posix-binary
@ -23,8 +25,8 @@ f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/t
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary
c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary
5279b7ef7b094b7713de63b53c7e082faa33dabef5fefa0a13868ac47589a624 test/results/test100-knight-posix-binary
9e891f4502429e0c39ac47a7bc5e7363548848d603f5c796e94247ad8aa2f642 test/results/test100-x86-binary
9eebb281d1dbf75aa7febadc1f5777c01a3802375ab237d9f5e2318229861e25 test/results/test100-knight-posix-binary
eb4f05476690361112c2f57f98c4d4dd16f755fbbfb879012de5d773884ea63b test/results/test100-x86-binary
63fd5fbf389d1b19031026df193ec55e98d923b8568007125b80bc246c094496 test/results/test11-knight-posix-binary
3fd11bad4a426ce1ff8fd9c6d7d2b943effae9f3f5740b7376e426e9b0555851 test/results/test11-x86-binary
313536f9209d29d4c3b40f6ada898f81c1fb3b650ca1a84754f90b1db3b9e001 test/results/test12-knight-posix-binary

44
test/test03/hello-armv7l.sh Executable file
View File

@ -0,0 +1,44 @@
#! /bin/sh
## Copyright (C) 2017 Jeremiah Orians
## This file is part of M2-Planet.
##
## M2-Planet is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## M2-Planet is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
set -x
# Build the test
bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/putchar.c \
-f test/common_armv7l/functions/exit.c \
-f test/test03/constant.c \
-o test/test03/constant.M1 || exit 1
# Macro assemble with libc written in M1-Macro
M1 -f test/common_armv7l/armv7l_defs.M1 \
-f test/common_armv7l/libc-core.M1 \
-f test/test03/constant.M1 \
--LittleEndian \
--architecture armv7l \
-o test/test03/constant.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test03/constant.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test03-armv7l-binary --exec_enable || exit 3
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
then
# Verify that the compiled program returns the correct result
out=$(./test/results/test03-armv7l-binary 2>&1 )
[ 42 = $? ] || exit 4
[ "$out" = "Hello mes" ] || exit 5
fi
exit 0

44
test/test04/hello-armv7l.sh Executable file
View File

@ -0,0 +1,44 @@
#! /bin/sh
## Copyright (C) 2017 Jeremiah Orians
## This file is part of M2-Planet.
##
## M2-Planet is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## M2-Planet is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
set -x
# Build the test
bin/M2-Planet --architecture armv7l -f test/common_armv7l/functions/putchar.c \
-f test/common_armv7l/functions/exit.c \
-f test/test04/call.c \
-o test/test04/call.M1 || exit 1
# Macro assemble with libc written in M1-Macro
M1 -f test/common_armv7l/armv7l_defs.M1 \
-f test/common_armv7l/libc-core.M1 \
-f test/test04/call.M1 \
--LittleEndian \
--architecture armv7l \
-o test/test04/call.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test04/call.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test04-armv7l-binary --exec_enable || exit 3
# Ensure binary works if host machine supports test
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
then
# Verify that the compiled program returns the correct result
out=$(./test/results/test04-armv7l-binary 2>&1 )
[ 42 = $? ] || exit 4
[ "$out" = "Hello mes" ] || exit 5
fi
exit 0

View File

@ -1 +1 @@
acab74ad112f3818db7760c3a752a674c260f42dd603c9a9d972ddff9448e0dc test/test100/proof
499dee39dc26fc7a6c5299033c596895b96a3354a20de85f4a5c02e1aef77bf8 test/test100/proof