6/24 working tests for ARMv7l
This commit is contained in:
parent
eb034f51e8
commit
b61144efd7
|
@ -16,7 +16,7 @@
|
|||
|
||||
* Current
|
||||
** Added
|
||||
Added 5/24 working tests for armv7l
|
||||
Added 6/24 working tests for armv7l
|
||||
|
||||
** Changed
|
||||
|
||||
|
|
18
cc_core.c
18
cc_core.c
|
@ -523,14 +523,19 @@ void postfix_expr_arrow()
|
|||
emit_out(numerate_number(i->offset));
|
||||
emit_out("\nADD_ebx_to_eax\n");
|
||||
}
|
||||
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#postfix_expr_arrow\n");
|
||||
else if(ARMV7L == Architecture)
|
||||
{
|
||||
emit_out("!0 R1 LOAD32 R15 MEMORY\n~0 JUMP_ALWAYS\n%");
|
||||
emit_out(numerate_number(i->offset));
|
||||
emit_out("\n'0' R0 R0 ADD R1 ARITH2_ALWAYS\n");
|
||||
}
|
||||
}
|
||||
|
||||
if((!match("=", global_token->s) && (4 >= i->size)))
|
||||
{
|
||||
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#postfix_expr_arrow\n");
|
||||
else if(ARMV7L == Architecture) emit_out("!0 R0 LOAD32 R0 MEMORY\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -593,8 +598,9 @@ void unary_expr_sizeof()
|
|||
|
||||
if(KNIGHT_POSIX == Architecture) emit_out("LOADUI R0 ");
|
||||
else if(X86 == Architecture) emit_out("LOAD_IMMEDIATE_eax %");
|
||||
else if(ARMV7L == Architecture) emit_out("PLACEHOLDER\t#unary_expr_sizeof\n");
|
||||
else if(ARMV7L == Architecture) emit_out("!");
|
||||
emit_out(numerate_number(a->size));
|
||||
if(ARMV7L == Architecture) emit_out(" R0 LOADI8_ALWAYS");
|
||||
emit_out("\n");
|
||||
}
|
||||
|
||||
|
@ -659,8 +665,8 @@ void additive_expr_stub()
|
|||
general_recursion(postfix_expr, "'9' R0 '0' R1 MUL R0 ARITH2_ALWAYS\n", "*", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "{LR} PUSH_ALWAYS\n^~divide CALL_ALWAYS\n{LR} POP_ALWAYS\n", "/", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "{LR} PUSH_ALWAYS\n^~modulus CALL_ALWAYS\n{LR} POP_ALWAYS\n", "%", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "LEFT R0 R0 R1 SHIFT AUX_ALWAYS\n", "<<", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "RIGHT R0 R0 R1 SHIFT AUX_ALWAYS\n", ">>", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "LEFT R1 R0 R0 SHIFT AUX_ALWAYS\n", "<<", additive_expr_stub);
|
||||
general_recursion(postfix_expr, "RIGHT R1 R0 R0 SHIFT AUX_ALWAYS\n", ">>", additive_expr_stub);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1071,7 +1077,7 @@ void process_do()
|
|||
else if(X86 == Architecture) emit_out("TEST\nJUMP_NE %DO_");
|
||||
else if(ARMV7L == Architecture) emit_out("!0 CMPI8 R0 IMM_ALWAYS\n^~DO_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
if(ARMV7L == Architecture) emit_out(" JUMP_EQUAL\t");
|
||||
if(ARMV7L == Architecture) emit_out(" JUMP_NE\t");
|
||||
|
||||
emit_out(":DO_END_");
|
||||
uniqueID_out(function->s, number_string);
|
||||
|
|
8
makefile
8
makefile
|
@ -96,6 +96,8 @@ test: test00-knight-posix-binary \
|
|||
test04-armv7l-binary \
|
||||
test05-armv7l-binary \
|
||||
test06-armv7l-binary \
|
||||
test07-armv7l-binary \
|
||||
test08-armv7l-binary \
|
||||
test00-x86-binary \
|
||||
test01-x86-binary \
|
||||
test02-x86-binary \
|
||||
|
@ -227,6 +229,12 @@ test05-armv7l-binary: M2-Planet | results
|
|||
test06-armv7l-binary: M2-Planet | results
|
||||
test/test06/hello-armv7l.sh
|
||||
|
||||
test07-armv7l-binary: M2-Planet | results
|
||||
test/test07/hello-armv7l.sh
|
||||
|
||||
test08-armv7l-binary: M2-Planet | results
|
||||
test/test08/hello-armv7l.sh
|
||||
|
||||
test00-x86-binary: M2-Planet | results
|
||||
test/test00/hello-x86.sh
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ DEFINE {LR} 0040
|
|||
# Bitshift constants
|
||||
DEFINE NO_SHIFT 0
|
||||
DEFINE LEFT 1
|
||||
DEFINE RIGHT 2
|
||||
DEFINE RIGHT 3
|
||||
DEFINE ARITH_RIGHT 5
|
||||
|
||||
# LOAD/STORE
|
||||
|
@ -66,6 +66,7 @@ DEFINE LOADI8_L 0A0B3
|
|||
# JUMP/BRANCH
|
||||
DEFINE JUMP_ALWAYS EA
|
||||
DEFINE JUMP_EQUAL 0A
|
||||
DEFINE JUMP_NE 1A
|
||||
DEFINE CALL_ALWAYS EB
|
||||
|
||||
# Data movement
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
/* Copyright (C) 2016 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/>.
|
||||
*/
|
||||
|
||||
// CONSTANT NULL 0
|
||||
|
||||
void* malloc(int size)
|
||||
{
|
||||
asm("!45 R7 LOADI8_ALWAYS"
|
||||
"!0 R0 LOADI8_ALWAYS"
|
||||
"SYSCALL_ALWAYS"
|
||||
"{R0} PUSH_ALWAYS"
|
||||
"!4 R1 SUB R12 ARITH_ALWAYS"
|
||||
"!0 R1 LOAD32 R1 MEMORY"
|
||||
"'0' R0 R0 ADD R1 ARITH2_ALWAYS"
|
||||
"{R0} PUSH_ALWAYS"
|
||||
"SYSCALL_ALWAYS"
|
||||
"{R1} POP_ALWAYS"
|
||||
"'0' R0 CMP R1 AUX_ALWAYS"
|
||||
"{R0} POP_ALWAYS"
|
||||
"!-1 R0 LOADI8_NE");
|
||||
}
|
|
@ -19,16 +19,18 @@ b5b76320ccda887a30b0bbefc2a5c302c8f2aa3c398d92ef3a79526690b25d6f test/results/t
|
|||
2d0d9778c9de385f7a78009bee00345611a90b24e7418f9e8773018bd6113bd4 test/results/test06-armv7l-binary
|
||||
b177d769ae44c3509d9a08d0ee631ec69654dc5d723408bf0decdc67c42aae27 test/results/test06-knight-posix-binary
|
||||
663fc6eefe965f237b6bf5a211398c8ae1210f97ff39b59603677e92462c68c7 test/results/test06-x86-binary
|
||||
1c125d2e347037ab8e2c542a2f77a4047edba17e49d9cfddf51bcbcdddd8ab9d test/results/test07-armv7l-binary
|
||||
9159c4ba8196b24ec78bc9ebfbc7066d510ddbf03461736e7795a48634134dc5 test/results/test07-knight-posix-binary
|
||||
a9a3e332d13ded5f80d7431f8717f26527b3722b33ea57760a9a5723dffc099c test/results/test07-x86-binary
|
||||
1e23922a948e4ed066e8277899eefdd4e1b30621cac39d99a58728b9867d45e7 test/results/test08-armv7l-binary
|
||||
b824859fd0e39f1417742a1b9a1cec18ade78afdd80ce2c64cb54cdf7683f53a test/results/test08-knight-posix-binary
|
||||
f1c01feb865c4d552033186d9ce50dd39468a7e8aebf762886c13ad3e03b5011 test/results/test08-x86-binary
|
||||
0feaacc13ad24c2b513fd9d46a58c38b1af57e77275c9a148cafb4a0d3cc7b7a test/results/test09-knight-posix-binary
|
||||
3b39e72f3de90ed690adfaf6145af46157cef2ec5e72867ac577fa27a0229894 test/results/test09-x86-binary
|
||||
c1b5a2a3cd46c5e95e5540e871c2a916e028684ca80f51c001ef489342e27625 test/results/test10-knight-posix-binary
|
||||
020e86020819cc4963e6185b22e534fcf8306b6cb116f12643f254a24688ff0a test/results/test10-x86-binary
|
||||
fd5054d7d5ae525c4231a9351c98b373cff53275b80ee0853404cd17548f40d0 test/results/test100-knight-posix-binary
|
||||
bb3a90999ee64b8560e76379ebcb60e3c700d41210bcb4c3cbf031185e5ace8c test/results/test100-x86-binary
|
||||
2ab9dbf623d09807db89e38ba837fe65234538441f0152e170edb78a0aba6c7a test/results/test100-knight-posix-binary
|
||||
0fabd4489381a382d04ec114d8279b9ad846f449479b238a8c9050c9f14fa67b 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
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
#! /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/common_armv7l/functions/malloc.c \
|
||||
-f test/test08/struct.c \
|
||||
-o test/test08/struct.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/test08/struct.M1 \
|
||||
--LittleEndian \
|
||||
--architecture armv7l \
|
||||
-o test/test08/struct.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test08/struct.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test08-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/test08-armv7l-binary 2>&1 )
|
||||
[ 16 = $? ] || exit 4
|
||||
[ "$out" = "35419896642975313541989657891634" ] || exit 5
|
||||
fi
|
||||
exit 0
|
|
@ -1 +1 @@
|
|||
60ad787cab898a4f762b48afd533f4a902deb026d15da53c4d1cd777712452c6 test/test100/proof
|
||||
eef31f88977f516d52af0f0fa20876fd5cc271dfd3686ea207352c965b25b1e6 test/test100/proof
|
||||
|
|
Loading…
Reference in New Issue