Test02 for ARMv7l

This commit is contained in:
Jeremiah Orians 2019-03-10 11:24:13 -04:00
parent 8f247d9716
commit 740f376828
No known key found for this signature in database
GPG Key ID: 5410E91C14959E87
8 changed files with 80 additions and 16 deletions

View File

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

View File

@ -445,14 +445,14 @@ void common_recursion(FUNCTION f)
if(KNIGHT_POSIX == Architecture) emit_out("PUSHR R0 R15\t#_common_recursion\n");
else if(X86 == Architecture) emit_out("PUSH_eax\t#_common_recursion\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#common_recursion\n");
else if(ARMV7L == Architecture) emit_out("{R0} PUSH_ALWAYS\t#_common_recursion\n");
f();
current_target = promote_type(current_target, last_type);
if(KNIGHT_POSIX == Architecture) emit_out("POPR R1 R15\t# _common_recursion\n");
else if(X86 == Architecture) emit_out("POP_ebx\t# _common_recursion\n");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#common_recursion\n");
else if(ARMV7L == Architecture) emit_out("{R1} POP_ALWAYS\t# _common_recursion\n");
}
void general_recursion( FUNCTION f, char* s, char* name, FUNCTION iterate)
@ -693,12 +693,12 @@ void relational_expr_stub()
}
else if(ARMV7L == Architecture)
{
general_recursion(additive_expr, "PLACEHOLDER\t#relational_expr_stub\n", "<", relational_expr_stub);
general_recursion(additive_expr, "PLACEHOLDER\t#relational_expr_stub\n", "<=", relational_expr_stub);
general_recursion(additive_expr, "PLACEHOLDER\t#relational_expr_stub\n", ">=", relational_expr_stub);
general_recursion(additive_expr, "PLACEHOLDER\t#relational_expr_stub\n", ">", relational_expr_stub);
general_recursion(additive_expr, "PLACEHOLDER\t#relational_expr_stub\n", "==", relational_expr_stub);
general_recursion(additive_expr, "PLACEHOLDER\t#relational_expr_stub\n", "!=", relational_expr_stub);
general_recursion(additive_expr, "'0' R0 CMP R1 AUX_ALWAYS\n!1 R0 LOADI8_L\n", "<", relational_expr_stub);
general_recursion(additive_expr, "'0' R0 CMP R1 AUX_ALWAYS\n!1 R0 LOADI8_LE\n", "<=", relational_expr_stub);
general_recursion(additive_expr, "'0' R0 CMP R1 AUX_ALWAYS\n!1 R0 LOADI8_GE\n", ">=", relational_expr_stub);
general_recursion(additive_expr, "'0' R0 CMP R1 AUX_ALWAYS\n!1 R0 LOADI8_G\n", ">", relational_expr_stub);
general_recursion(additive_expr, "'0' R0 CMP R1 AUX_ALWAYS\n!1 R0 LOADI8_EQUAL\n", "==", relational_expr_stub);
general_recursion(additive_expr, "'0' R0 CMP R1 AUX_ALWAYS\n!1 R0 LOADI8_NE\n", "!=", relational_expr_stub);
}
}
@ -906,18 +906,21 @@ void process_if()
if(KNIGHT_POSIX == Architecture) emit_out("JUMP.Z R0 @ELSE_");
else if(X86 == Architecture) emit_out("TEST\nJUMP_EQ %ELSE_");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#process_if\n");
else if(ARMV7L == Architecture) emit_out("!0 CMPI8 R0 IMM_ALWAYS\n^~ELSE_");
uniqueID_out(function->s, number_string);
if(ARMV7L == Architecture) emit_out(" JUMP_EQUAL\n");
require_match("ERROR in process_if\nMISSING )\n", ")");
statement();
if(KNIGHT_POSIX == Architecture) emit_out("JUMP @_END_IF_");
else if(X86 == Architecture) emit_out("JUMP %_END_IF_");
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#process_if\n");
else if(ARMV7L == Architecture) emit_out("^~_END_IF_");
uniqueID_out(function->s, number_string);
if(ARMV7L == Architecture) emit_out(" JUMP\n");
emit_out(":ELSE_");
uniqueID_out(function->s, number_string);

View File

@ -91,6 +91,7 @@ test: test00-knight-posix-binary \
test100-knight-posix-binary \
test00-armv7l-binary \
test01-armv7l-binary \
test02-armv7l-binary \
test00-x86-binary \
test01-x86-binary \
test02-x86-binary \
@ -207,6 +208,9 @@ test00-armv7l-binary: M2-Planet | results
test01-armv7l-binary: M2-Planet | results
test/test01/hello-armv7l.sh
test02-armv7l-binary: M2-Planet | results
test/test02/hello-armv7l.sh
test00-x86-binary: M2-Planet | results
test/test00/hello-x86.sh

View File

@ -48,9 +48,16 @@ DEFINE STORE8 0C
DEFINE LOAD32 09
DEFINE LOAD8 0D
DEFINE LOADI8_ALWAYS 0A0E3
DEFINE LOADI8_G 0A0C3
DEFINE LOADI8_GE 0A0A3
DEFINE LOADI8_EQUAL 0A003
DEFINE LOADI8_NE 0A013
DEFINE LOADI8_LE 0A0D3
DEFINE LOADI8_l 0A0B3
# JUMP/BRANCH
DEFINE JUMP EA
DEFINE JUMP_EQUAL 0A
DEFINE CALL_ALWAYS EB
# Data movement
@ -59,8 +66,12 @@ DEFINE PUSH_ALWAYS 2DE9
DEFINE POP_ALWAYS bde8
# Arithmetic
DEFINE AUX_ALWAYS E1
DEFINE IMM_ALWAYS E3
DEFINE ARITH_ALWAYS E2
DEFINE ADD 08
DEFINE CMP 005
DEFINE CMPI8 005
# SYSCALL
DEFINE SYSCALL_ALWAYS 000000EF

View File

@ -15,6 +15,7 @@
## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
:_start
'0' R13 R12 MOVE_ALWAYS
^~FUNCTION_main CALL_ALWAYS
!1 R7 LOADI8_ALWAYS
SYSCALL_ALWAYS

View File

@ -1,9 +1,10 @@
9bb7fc192780009edb1f890eaa2ffb614f9461e7826bfb2beadc0f13ffe4b495 test/results/test00-armv7l-binary
fae8083f3cda34eb0700e5f737fec8ebd37e2e497dbb07877b08761724db81a0 test/results/test00-armv7l-binary
64879eebceb475f21e54cb1f2e872996ca80e8c1fbb8b5895fb5fb6bac0c4384 test/results/test00-knight-posix-binary
c52562bd0aabb86ce8ca177f22f8d0455769b444df2d4d62894faab63b7151d8 test/results/test00-x86-binary
56c6b31f809bc8296a8428bc028f223b5345bf650080cfb191277992a986a83d test/results/test01-armv7l-binary
9b088242569dedc540b8abfd5de2d90ae201ac3b97e5c3dcd6d6760358b9f4b2 test/results/test01-armv7l-binary
486ee05ccea796a9cfa9bfb23189b8e014b7ce8d14fea03b27d679d410fe17dd test/results/test01-knight-posix-binary
eae96857f2b6d8e8ba86ac06e72345ea572622b358b23978bb5f2db1baadf41c test/results/test01-x86-binary
791244db88cfeffb73989a0643c3b1e75d2a697f3a954f66158521fbeef85f5a test/results/test02-armv7l-binary
e6493845b9e94a617649638252f23502f9212de583fd00cba6cc07fffd296e32 test/results/test02-knight-posix-binary
8ead336d2f3f72d5874230492e0472edec61d355905e8636e3dfb2731695037c test/results/test02-x86-binary
96849d5a9294799a9648c24db21b2dab1555dd5ba69d172d77df800622347226 test/results/test03-knight-posix-binary
@ -22,8 +23,8 @@ f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/t
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary
c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary
091ff86dc5dc8669b2010055929da898caa314227e8c57ddd9adad9e96adcf5f test/results/test100-knight-posix-binary
4978d711e023e622cd793ba6029e53c5eba86f59f13e69a052312d4e0c7efa3d test/results/test100-x86-binary
5279b7ef7b094b7713de63b53c7e082faa33dabef5fefa0a13868ac47589a624 test/results/test100-knight-posix-binary
9e891f4502429e0c39ac47a7bc5e7363548848d603f5c796e94247ad8aa2f642 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/test02/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/test02/if.c \
-o test/test02/if.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/test02/if.M1 \
--LittleEndian \
--architecture armv7l \
-o test/test02/if.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test02/if.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test02-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/test02-armv7l-binary 2>&1 )
[ 42 = $? ] || exit 4
[ "$out" = "Hello mes" ] || exit 5
fi
exit 0

View File

@ -1 +1 @@
3497f140e76eb04dcf28fd8f07d1d332c5a36071a62555a5d3f224d6c1b7a6a1 test/test100/proof
acab74ad112f3818db7760c3a752a674c260f42dd603c9a9d972ddff9448e0dc test/test100/proof