Merge remote-tracking branch 'origin/GT-3106_ghidorahrex_AVR8_pcodetests'

This commit is contained in:
Ryan Kurtz
2019-11-01 10:03:33 -04:00
28 changed files with 3972 additions and 3398 deletions
@@ -11,6 +11,7 @@ pcodetest/build||GHIDRA||||END|
pcodetest/build.py||GHIDRA||||END|
pcodetest/c_src/BIOPS.test||GHIDRA||||END|
pcodetest/c_src/BIOPS2.test||GHIDRA||||END|
pcodetest/c_src/BIOPS4.test||GHIDRA||||END|
pcodetest/c_src/BIOPS_DOUBLE.test||GHIDRA||||END|
pcodetest/c_src/BIOPS_FLOAT.test||GHIDRA||||END|
pcodetest/c_src/BIOPS_LONGLONG.test||GHIDRA||||END|
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,474 @@
#include "pcode_test.h"
TEST u4_complexLogic_Main()
{
extern u4 u4_complexLogic(u4 a, u4 b, u4 c, u4 d, u4 e, u4 f);
ASSERTU4(u4_complexLogic(2016764524, 1717226057, 1748349614, 0, 1276673168, 0), 15);
ASSERTU4(u4_complexLogic(2009726312, 696947386, 0, 0, 1265204346, 1369602726), 11);
ASSERTU4(u4_complexLogic(1665204916, 1707056552, 564325578, 0, 0, 1010528946), 14);
ASSERTU4(u4_complexLogic(0, 1516266761, 1866000081, 0, 1175526309, 1586903190), 10);
}
TEST i4_complexLogic_Main()
{
extern i4 i4_complexLogic(i4 a, i4 b, i4 c, i4 d, i4 e, i4 f);
ASSERTI4(i4_complexLogic((i4) -1916250774, 1528806445, (i4) -870305000, 0, 0, 1799560997), 14);
ASSERTI4(i4_complexLogic((i4) -1375179334, (i4) -1539942439, 987987334, 0, 1162088421, 12548159), 15);
ASSERTI4(i4_complexLogic(0, (i4) -750167716, (i4) -1104561852, 0, (i4) -915711850, 737703662), 11);
ASSERTI4(i4_complexLogic(0, 386839851, (i4) -771476364, 0, (i4) -942724790, 1833488263), 10);
}
TEST u4_compareLogic_Main()
{
extern u4 u4_compareLogic(u4 lhs, u4 rhs);
ASSERTU4(u4_compareLogic(0x1, 0x1), 1);
ASSERTU4(u4_compareLogic(0x1, 0x2), 23);
ASSERTU4(u4_compareLogic(0x2, 0x1), 22);
}
TEST i4_compareLogic_Main()
{
extern i4 i4_compareLogic(i4 lhs, i4 rhs);
ASSERTI4(i4_compareLogic(0x1, 0x1), 21);
ASSERTI4(i4_compareLogic(0x1, 0x2), 21);
ASSERTI4(i4_compareLogic(0x2, 0x1), 22);
ASSERTI4(i4_compareLogic(-0x1, -0x1), 21);
ASSERTI4(i4_compareLogic(-0x1, -0x2), 21);
ASSERTI4(i4_compareLogic(-0x2, -0x1), 24);
}
/* Comparison operators */
TEST u4_greaterThan_Main()
{
extern u4 u4_greaterThan(u4 lhs, u4 rhs);
ASSERTU4(u4_greaterThan(0x01010101, 0x01010101), 0);
ASSERTU4(u4_greaterThan(2, 1), 1);
ASSERTU4(u4_greaterThan(U4_MAX, U4_MAX), 0);
ASSERTU4(u4_greaterThan(U4_MAX, 0), 1);
ASSERTU4(u4_greaterThan(0, U4_MAX), 0);
}
TEST u4_greaterThanEquals_Main()
{
extern u4 u4_greaterThanEquals(u4 lhs, u4 rhs);
ASSERTU4(u4_greaterThanEquals(2, 1), 1);
ASSERTU4(u4_greaterThanEquals(U4_MAX, U4_MAX), 1);
ASSERTU4(u4_greaterThanEquals(U4_MAX, 0), 1);
ASSERTU4(u4_greaterThanEquals(0, U4_MAX), 0);
}
TEST u4_lessThan_Main()
{
extern u4 u4_lessThan(u4 lhs, u4 rhs);
ASSERTU4(u4_lessThan(0x01010101, 0x01010101), 0);
ASSERTU4(u4_lessThan(2, 1), 0);
ASSERTU4(u4_lessThan(U4_MAX, U4_MAX), 0);
ASSERTU4(u4_lessThan(U4_MAX, 0), 0);
ASSERTU4(u4_lessThan(0, U4_MAX), 1);
}
TEST u4_lessThanEquals_Main()
{
extern u4 u4_lessThanEquals(u4 lhs, u4 rhs);
ASSERTU4(u4_lessThanEquals(0x01010101, 0x01010101), 1);
ASSERTU4(u4_lessThanEquals(2, 1), 0);
ASSERTU4(u4_lessThanEquals(U4_MAX, U4_MAX), 1);
ASSERTU4(u4_lessThanEquals(U4_MAX, 0), 0);
ASSERTU4(u4_lessThanEquals(0, U4_MAX), 1);
}
TEST u4_equals_Main()
{
extern u4 u4_equals(u4 lhs, u4 rhs);
ASSERTU4(u4_equals(0x01010101, 0x01010101), 1);
ASSERTU4(u4_equals(2, 1), 0);
ASSERTU4(u4_equals(U4_MAX, U4_MAX), 1);
ASSERTU4(u4_equals(U4_MAX, 0), 0);
ASSERTU4(u4_equals(0, U4_MAX), 0);
}
TEST u4_notEquals_Main()
{
extern u4 u4_notEquals(u4 lhs, u4 rhs);
ASSERTU4(u4_notEquals(0x01010101, 0x01010101), 0);
ASSERTU4(u4_notEquals(2, 1), 1);
ASSERTU4(u4_notEquals(U4_MAX, U4_MAX), 0);
ASSERTU4(u4_notEquals(U4_MAX, 0), 1);
ASSERTU4(u4_notEquals(0, U4_MAX), 1);
}
TEST i4_greaterThan_Main()
{
extern i4 i4_greaterThan(i4 lhs, i4 rhs);
ASSERTI4(i4_greaterThan(2, 1), 1);
ASSERTI4(i4_greaterThan(0x01010101, 0x01010101), 0);
ASSERTI4(i4_greaterThan(0x01000101, 0x01010101), 0);
ASSERTI4(i4_greaterThan(0x01010101, -0x01010101), 1);
ASSERTI4(i4_greaterThan(I4_MAX, I4_MAX), 0);
ASSERTI4(i4_greaterThan(I4_MAX, I4_MIN), 1);
ASSERTI4(i4_greaterThan(I4_MIN, I4_MAX), 0);
}
TEST i4_greaterThanEquals_Main()
{
extern i4 i4_greaterThanEquals(i4 lhs, i4 rhs);
ASSERTI4(i4_greaterThanEquals(2, 1), 1);
ASSERTI4(i4_greaterThanEquals(-2, 1), 0);
ASSERTI4(i4_greaterThanEquals(0x01010101, 0x01010100), 1);
ASSERTI4(i4_greaterThanEquals(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_greaterThanEquals(I4_MAX, I4_MIN), 1);
ASSERTI4(i4_greaterThanEquals(I4_MIN, I4_MAX), 0);
}
TEST i4_lessThan_Main()
{
extern i4 i4_lessThan(i4 lhs, i4 rhs);
ASSERTI4(i4_lessThan(2, 1), 0);
ASSERTI4(i4_lessThan(0x01010101, 0x01010101), 0);
ASSERTI4(i4_lessThan(0x01000101, 0x01010101), 1);
ASSERTI4(i4_lessThan(0x01010101, -0x01010101), 0);
}
TEST i4_lessThanEquals_Main()
{
extern i4 i4_lessThanEquals(i4 lhs, i4 rhs);
ASSERTI4(i4_lessThanEquals(2, 1), 0);
ASSERTI4(i4_lessThanEquals(0x01010101, 0x01010101), 1);
ASSERTI4(i4_lessThanEquals(0x01000101, 0x01010101), 1);
ASSERTI4(i4_lessThanEquals(0x01010101, -0x01010101), 0);
ASSERTI4(i4_lessThanEquals(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_lessThanEquals(I4_MAX, I4_MIN), 0);
ASSERTI4(i4_lessThanEquals(I4_MIN, I4_MAX), 1);
}
TEST i4_equals_Main()
{
extern i4 i4_equals(i4 lhs, i4 rhs);
ASSERTI4(i4_equals(0x01010101, -0x01010101), 0);
ASSERTI4(i4_equals(2, 1), 0);
ASSERTI4(i4_equals(0x01010101, 0x01010101), 1);
ASSERTI4(i4_equals(0x01000101, 0x01010101), 0);
ASSERTI4(i4_equals(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_equals(I4_MAX, I4_MIN), 0);
ASSERTI4(i4_equals(I4_MIN, I4_MAX), 0);
}
TEST i4_notEquals_Main()
{
extern i4 i4_notEquals(i4 lhs, i4 rhs);
ASSERTI4(i4_notEquals(0x01010101, 0x01010101), 0);
ASSERTI4(i4_notEquals(0x01000101, 0x01010101), 1);
ASSERTI4(i4_notEquals(0x01000101, -0x01010101), 1);
ASSERTI4(i4_notEquals(2, 1), 1);
ASSERTI4(i4_notEquals(I4_MAX, I4_MAX), 0);
ASSERTI4(i4_notEquals(I4_MAX, I4_MIN), 1);
ASSERTI4(i4_notEquals(I4_MIN, I4_MAX), 1);
}
/* Bitwise operators */
TEST u4_bitwiseAnd_Main()
{
extern u4 u4_bitwiseAnd(u4 lhs, u4 rhs);
ASSERTU4(u4_bitwiseAnd(0x01010101, 0x01010101), 0x01010101);
ASSERTU4(u4_bitwiseAnd(2, 1), 0);
ASSERTU4(u4_bitwiseAnd(U4_MAX, U4_MAX), -1);
ASSERTU4(u4_bitwiseAnd(U4_MAX, U4_MIN), 0);
ASSERTU4(u4_bitwiseAnd(U4_MAX, 0), 0);
}
TEST u4_bitwiseOr_Main()
{
extern u4 u4_bitwiseOr(u4 lhs, u4 rhs);
ASSERTU4(u4_bitwiseOr(0x01010101, 0x01010101), 0x01010101);
ASSERTU4(u4_bitwiseOr(2, 1), 3);
ASSERTU4(u4_bitwiseOr(U4_MAX, U4_MAX), U4_MAX);
ASSERTU4(u4_bitwiseOr(U4_MAX, 0), U4_MAX);
}
TEST u4_bitwiseXor_Main()
{
extern u4 u4_bitwiseXor(u4 lhs, u4 rhs);
ASSERTU4(u4_bitwiseXor(0x01010101, 0x01010101), 0);
ASSERTU4(u4_bitwiseXor(2, 1), 3);
ASSERTU4(u4_bitwiseXor(U4_MAX, U4_MAX), 0);
ASSERTU4(u4_bitwiseXor(U4_MAX, U4_MIN), -1);
ASSERTU4(u4_bitwiseXor(U4_MAX, 0), -1);
}
TEST i4_bitwiseAnd_Main()
{
extern i4 i4_bitwiseAnd(i4 lhs, i4 rhs);
ASSERTI4(i4_bitwiseAnd(0x01010101, 0x01010101), 0x01010101);
ASSERTI4(i4_bitwiseAnd(2, 1), 0);
ASSERTI4(/*val*/ i4_bitwiseAnd(I4_MAX, I4_MAX), 2147483647)
ASSERTI4(/*val*/ i4_bitwiseAnd(0, 0), 0)
ASSERTI4(/*val*/ i4_bitwiseAnd(I4_MIN, I4_MIN), -2147483648)
}
TEST i4_bitwiseOr_Main()
{
extern i4 i4_bitwiseOr(i4 lhs, i4 rhs);
ASSERTI4(i4_bitwiseOr(0x01010101, 0x01010101), 0x01010101);
ASSERTI4(i4_bitwiseOr(0x01010101, 0x0), 0x01010101);
ASSERTI4(i4_bitwiseOr(2, 1), 3);
ASSERTI4(i4_bitwiseOr(I4_MAX, I4_MAX), 2147483647);
ASSERTI4(i4_bitwiseOr(0, 0), 0);
}
TEST i4_bitwiseXor_Main()
{
extern i4 i4_bitwiseXor(i4 lhs, i4 rhs);
ASSERTI4(i4_bitwiseXor(0x01010101, 0x01010101), 0);
ASSERTI4(i4_bitwiseXor(0x01010101, 0x01000101), 0x10000);
ASSERTI4(i4_bitwiseXor(2, 1), 3);
ASSERTI4(i4_bitwiseXor(I4_MAX, I4_MAX), 0);
ASSERTI4(i4_bitwiseXor(I4_MAX, 0), 2147483647);
ASSERTI4(i4_bitwiseXor(0, 0), 0);
}
/* Logical operators */
TEST u4_logicalAnd_Main()
{
extern u4 u4_logicalAnd(u4 lhs, u4 rhs);
ASSERTU4(u4_logicalAnd(0x01010101, 0x01010101), 1);
ASSERTU4(u4_logicalAnd(2, 1), 1);
ASSERTU4(u4_logicalAnd(U4_MAX, U4_MAX), 1)
}
TEST u4_logicalOr_Main()
{
extern u4 u4_logicalOr(u4 lhs, u4 rhs);
ASSERTU4(u4_logicalOr(0x01010101, 0x01010101), 1);
ASSERTU4(u4_logicalOr(2, 1), 1);
ASSERTU4(u4_logicalOr(U4_MAX, U4_MAX), 1);
ASSERTU4(u4_logicalOr(U4_MAX, U4_MIN), 1);
}
TEST u4_logicalNot_Main()
{
extern u4 u4_logicalNot(u4 lhs);
ASSERTU4(u4_logicalNot(0x01010101), 0);
ASSERTU4(u4_logicalNot(2), 0);
ASSERTU4(u4_logicalNot(U4_MAX), 0);
}
TEST i4_logicalAnd_Main()
{
extern i4 i4_logicalAnd(i4 lhs, i4 rhs);
ASSERTI4(i4_logicalAnd(0x01010101, 0x01010101), 1);
ASSERTI4(i4_logicalAnd(2, 1), 1);
ASSERTI4(i4_logicalAnd(0x01000101, 0x01010101), 1);
ASSERTI4(i4_logicalAnd(0x01000101, 0x0), 0);
ASSERTI4(i4_logicalAnd(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_logicalAnd(I4_MIN, I4_MIN), 1);
ASSERTI4(i4_logicalAnd(0, 0), 0);
}
TEST i4_logicalOr_Main()
{
extern i4 i4_logicalOr(i4 lhs, i4 rhs);
ASSERTI4(i4_logicalOr(0x01010101, 0x01010101), 1);
ASSERTI4(i4_logicalOr(2, 1), 1);
ASSERTI4(i4_logicalOr(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_logicalOr(I4_MIN, I4_MIN), 1);
ASSERTI4(i4_logicalOr(0, 0), 0);
}
TEST i4_logicalNot_Main()
{
extern i4 i4_logicalNot(i4 lhs);
ASSERTI4(i4_logicalNot(0x01010101), 0);
ASSERTI4(i4_logicalNot(2), 0);
ASSERTI4(i4_logicalNot(I4_MAX), 0);
ASSERTI4(i4_logicalNot(I4_MIN), 0);
ASSERTI4(i4_logicalNot(0), 1);
}
/* Shift operators */
TEST u4_shiftLeft_Main()
{
extern u4 u4_shiftLeft(u4 lhs, u4 rhs);
ASSERTU4(u4_shiftLeft(0x01010101, 16), 0x01010000);
ASSERTU4(u4_shiftLeft(2, 1), 4);
ASSERTU4(u4_shiftLeft(U4_MAX, 4*8-1), 2147483648);
ASSERTU4(u4_shiftLeft(U4_MAX, 4), -16);
}
TEST u4_shiftRight_Main()
{
extern u4 u4_shiftRight(u4 lhs, u4 rhs);
ASSERTU4(u4_shiftRight(0x01010101, 16), 0x0101);
ASSERTU4(u4_shiftRight(2, 1), 1);
ASSERTU4(u4_shiftRight(U4_MAX, 4), 268435455);
ASSERTU4(u4_shiftRight(U4_MAX, 4*8-1), 1);
ASSERTU4(u4_shiftRight(4, 4), 0);
}
TEST i4_shiftLeft_Main()
{
extern i4 i4_shiftLeft(i4 lhs, i4 rhs);
ASSERTI4(i4_shiftLeft(2, 1), 4);
ASSERTI4(i4_shiftLeft(0x01010101, 16), 0x01010000);
ASSERTI4(i4_shiftLeft(0x01010101, 0), 0x01010101);
ASSERTI4(i4_shiftLeft(I4_MAX, 2), -4);
ASSERTI4(i4_shiftLeft(I4_MAX, 0), 2147483647);
}
TEST i4_shiftRight_Main()
{
extern i4 i4_shiftRight(i4 lhs, i4 rhs);
ASSERTI4(i4_shiftRight(2, 1), 1);
ASSERTI4(i4_shiftRight(0x01010101, 16), 0x0101);
ASSERTI4(i4_shiftRight(0x01010101, 31), 0x0);
ASSERTI4(i4_shiftRight(0x01010101, 0), 0x01010101);
ASSERTI4(i4_shiftRight(I4_MAX, 2), 536870911);
}
/* Arithmetic operators */
TEST u4_unaryPlus_Main()
{
extern u4 u4_unaryPlus(u4 lhs);
ASSERTU4(u4_unaryPlus(0x01010101), 0x01010101);
ASSERTU4(u4_unaryPlus(2), 2);
ASSERTU4(u4_unaryPlus(U4_MAX), -1);
ASSERTU4(u4_unaryPlus(~1000), 4294966295);
ASSERTU4(u4_unaryPlus(0), 0);
}
TEST u4_addition_Main()
{
extern u4 u4_addition(u4 lhs, u4 rhs);
ASSERTU4(u4_addition(0x01010101, 0x01010101), 33686018);
ASSERTU4(u4_addition(2, 1), 3);
ASSERTU4(u4_addition(~2, ~1), 4294967291);
ASSERTU4(u4_addition(U4_MAX, U4_MAX), -2);
ASSERTU4(u4_addition(U4_MAX, 0), -1);
ASSERTU4(u4_addition(0, 0), 0);
}
TEST u4_subtract_Main()
{
extern u4 u4_subtract(u4 lhs, u4 rhs);
ASSERTU4(u4_subtract(0x01010101, 0x01010101), 0);
ASSERTU4(u4_subtract(2, 1), 1);
ASSERTU4(u4_subtract(~2, ~1), 4294967295);
ASSERTU4(u4_subtract(U4_MAX, U4_MAX), 0);
ASSERTU4(u4_subtract(U4_MAX, 0), U4_MAX);
ASSERTU4(u4_subtract(0, U4_MAX), 1);
}
TEST u4_multiply_Main()
{
extern u4 u4_multiply(u4 lhs, u4 rhs);
ASSERTU4(u4_multiply(0x01010101, 0x01010101), 67305985);
ASSERTU4(u4_multiply(2, 1), 2);
ASSERTU4(u4_multiply(~2, ~1), 6);
ASSERTU4(u4_multiply(U4_MAX, U4_MAX), 1);
ASSERTU4(u4_multiply(U4_MAX, 1), U4_MAX);
ASSERTU4(u4_multiply(U4_MAX, 0), 0);
}
TEST u4_divide_Main()
{
extern u4 u4_divide(u4 lhs, u4 rhs);
ASSERTU4(u4_divide(0x01010101, 0x01010101), 1);
ASSERTU4(u4_divide(-0x01010101, 0x01010101), 254);
ASSERTU4(u4_divide(0, 0x01010101), 0);
ASSERTU4(u4_divide(0x01010101, 2), 0x808080);
ASSERTU4(u4_divide(U4_MAX, U4_MAX), 1);
ASSERTU4(u4_divide(U4_MAX, 1), U4_MAX);
}
TEST u4_remainder_Main()
{
extern u4 u4_remainder(u4 lhs, u4 rhs);
ASSERTU4(u4_remainder(0x01010101, 0x01010101), 0);
ASSERTU4(u4_remainder(U4_MAX, U4_MAX), 0);
ASSERTU4(u4_remainder(I4_MIN, I4_MIN), 0);
ASSERTU4(u4_remainder(~1000, ~10), 4294966295);
ASSERTU4(u4_remainder(0, U4_MAX), 0);
}
TEST i4_unaryMinus_Main()
{
extern i4 i4_unaryMinus(i4 lhs);
ASSERTI4(i4_unaryMinus(0x01010101), -0x01010101);
ASSERTI4(i4_unaryMinus(-0x01010101), 0x01010101);
ASSERTI4(i4_unaryMinus(I4_MAX), -I4_MAX);
ASSERTI4(i4_unaryMinus(I4_MIN), I4_MIN);
ASSERTI4(i4_unaryMinus(0), 0);
}
TEST i4_unaryPlus_Main()
{
extern i4 i4_unaryPlus(i4 lhs);
ASSERTI4(i4_unaryPlus(0x01010101), 0x01010101);
ASSERTI4(i4_unaryPlus(-0x01010101), -0x01010101);
ASSERTI4(i4_unaryPlus(2), 2);
ASSERTI4(i4_unaryPlus(I4_MAX), 2147483647);
ASSERTI4(i4_unaryPlus(I4_MIN), -2147483648);
ASSERTI4(i4_unaryPlus(0), 0);
}
TEST i4_addition_Main()
{
extern i4 i4_addition(i4 lhs, i4 rhs);
ASSERTI4(i4_addition(2, 1), 3);
ASSERTI4(i4_addition(0x01010101, 0x01010101), 33686018);
ASSERTI4(i4_addition(0x01010101, -0x01010101), 0);
ASSERTI4(i4_addition(I4_MAX, I4_MAX), -2);
ASSERTI4(i4_addition(I4_MAX, I4_MIN), -1);
ASSERTI4(i4_addition(I4_MAX, 0), 2147483647);
ASSERTI4(i4_addition(I4_MIN, I4_MIN), 0);
}
TEST i4_subtract_Main()
{
extern i4 i4_subtract(i4 lhs, i4 rhs);
ASSERTI4(i4_subtract(2, 1), 1);
ASSERTI4(i4_subtract(0x01010101, 0x01010101), 0);
ASSERTI4(i4_subtract(0x01010101, 0x01000100), 0x00010001);
ASSERTI4(i4_subtract(0x01000100, 0x01010101), -0x00010001);
ASSERTI4(i4_subtract(I4_MAX, I4_MAX), 0);
ASSERTI4(i4_subtract(I4_MAX, I4_MIN), -1);
ASSERTI4(i4_subtract(I4_MAX, 0), 2147483647);
ASSERTI4(i4_subtract(0, I4_MAX), -2147483647);
}
TEST i4_multiply_Main()
{
extern i4 i4_multiply(i4 lhs, i4 rhs);
ASSERTI4(i4_multiply(2, 1), 2);
ASSERTI4(i4_multiply(0x01010101, 0x01010101), 67305985);
ASSERTI4(i4_multiply(0x01010101, -16843009), -67305985);
ASSERTI4(i4_multiply(0, -16843009), 0);
ASSERTI4(i4_multiply(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_multiply(I4_MAX, I4_MIN), -2147483648);
ASSERTI4(i4_multiply(I4_MAX, 0), 0);
}
TEST i4_divide_Main()
{
extern i4 i4_divide(i4 lhs, i4 rhs);
ASSERTI4(i4_divide(0x01010101, 0x01010101), 1);
ASSERTI4(i4_divide(-0x01010101, 0x01010101), -1);
ASSERTI4(i4_divide(0, 0x01010101), 0);
ASSERTI4(i4_divide(0x01010101, 2), 0x808080);
ASSERTI4(i4_divide(I4_MAX, I4_MAX), 1);
ASSERTI4(i4_divide(I4_MIN, I4_MIN), 1);
ASSERTI4(i4_divide(-1, I4_MIN), 0);
}
TEST i4_remainder_Main()
{
extern i4 i4_remainder(i4 lhs, i4 rhs);
ASSERTI4(i4_remainder(0x01010101, 0x01010101), 0);
ASSERTI4(i4_remainder(I4_MAX, I4_MAX), 0);
ASSERTI4(i4_remainder(I4_MIN, I4_MIN), 0);
ASSERTI4(i4_remainder(0, I4_MIN), 0);
ASSERTI4(i4_remainder(0, I4_MAX), 0);
}
MAIN BIOPS4_main(){ }
@@ -0,0 +1,413 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "pcode_test.h"
u4 u4_complexLogic(u4 a, u4 b, u4 c, u4 d, u4 e, u4 f)
{
u4 ret = 0;
if (a > b && b > c || d < e && f < e) {
ret += 1;
}
if (a != b || a != c && d != e || f != e) {
ret += 2;
}
if (a && b && c || d && e && f) {
ret += 4;
}
if (a || b || c && d || e || f) {
ret += 8;
}
return ret;
}
i4 i4_complexLogic(i4 a, i4 b, i4 c, i4 d, i4 e, i4 f)
{
i4 ret = 0;
if (a > b && b > c || d < e && f < e) {
ret += 1;
}
if (a != b || a != c && d != e || f != e) {
ret += 2;
}
if (a && b && c || d && e && f) {
ret += 4;
}
if (a || b || c && d || e || f) {
ret += 8;
}
return ret;
}
u4 u4_compareLogic(u4 lhs, u4 rhs)
{
if (lhs < rhs)
lhs += 2;
if (lhs > rhs)
lhs += 4;
if (lhs == 0)
lhs += 8;
if (lhs != rhs)
lhs += 16;
return lhs;
}
i4 i4_compareLogic(i4 lhs, i4 rhs)
{
if (lhs < 0)
lhs += 2;
if (lhs > 0)
lhs += 4;
if (lhs == 0)
lhs += 8;
if (lhs != rhs)
lhs += 16;
return lhs;
}
/* Comparison operators */
u4 u4_greaterThan(u4 lhs, u4 rhs)
{
u4 z;
z = lhs > rhs;
return z;
}
u4 u4_greaterThanEquals(u4 lhs, u4 rhs)
{
u4 z;
z = lhs >= rhs;
return z;
}
u4 u4_lessThan(u4 lhs, u4 rhs)
{
u4 z;
z = lhs < rhs;
return z;
}
u4 u4_lessThanEquals(u4 lhs, u4 rhs)
{
u4 z;
z = lhs <= rhs;
return z;
}
u4 u4_equals(u4 lhs, u4 rhs)
{
u4 z;
z = lhs == rhs;
return z;
}
u4 u4_notEquals(u4 lhs, u4 rhs)
{
u4 z;
z = lhs != rhs;
return z;
}
i4 i4_greaterThan(i4 lhs, i4 rhs)
{
i4 z;
z = lhs > rhs;
return z;
}
i4 i4_greaterThanEquals(i4 lhs, i4 rhs)
{
i4 z;
z = lhs >= rhs;
return z;
}
i4 i4_lessThan(i4 lhs, i4 rhs)
{
i4 z;
z = lhs < rhs;
return z;
}
i4 i4_lessThanEquals(i4 lhs, i4 rhs)
{
i4 z;
z = lhs <= rhs;
return z;
}
i4 i4_equals(i4 lhs, i4 rhs)
{
i4 z;
z = lhs == rhs;
return z;
}
i4 i4_notEquals(i4 lhs, i4 rhs)
{
i4 z;
z = lhs != rhs;
return z;
}
/* Bitwise operators */
u4 u4_bitwiseAnd(u4 lhs, u4 rhs)
{
u4 z;
z = lhs & rhs;
return z;
}
u4 u4_bitwiseOr(u4 lhs, u4 rhs)
{
u4 z;
z = lhs | rhs;
return z;
}
u4 u4_bitwiseXor(u4 lhs, u4 rhs)
{
u4 z;
z = lhs ^ rhs;
return z;
}
i4 i4_bitwiseAnd(i4 lhs, i4 rhs)
{
i4 z;
z = lhs & rhs;
return z;
}
i4 i4_bitwiseOr(i4 lhs, i4 rhs)
{
i4 z;
z = lhs | rhs;
return z;
}
i4 i4_bitwiseXor(i4 lhs, i4 rhs)
{
i4 z;
z = lhs ^ rhs;
return z;
}
/* Logical operators */
u4 u4_logicalAnd(u4 lhs, u4 rhs)
{
u4 z;
z = lhs && rhs;
return z;
}
u4 u4_logicalOr(u4 lhs, u4 rhs)
{
u4 z;
z = lhs || rhs;
return z;
}
u4 u4_logicalNot(u4 lhs)
{
u4 z;
z = !lhs;
return z;
}
i4 i4_logicalAnd(i4 lhs, i4 rhs)
{
i4 z;
z = lhs && rhs;
return z;
}
i4 i4_logicalOr(i4 lhs, i4 rhs)
{
i4 z;
z = lhs || rhs;
return z;
}
i4 i4_logicalNot(i4 lhs)
{
i4 z;
z = !lhs;
return z;
}
/* Shift operators */
u4 u4_shiftLeft(u4 lhs, u4 rhs)
{
u4 z;
z = lhs << rhs;
return z;
}
u4 u4_shiftRight(u4 lhs, u4 rhs)
{
u4 z;
z = lhs >> rhs;
return z;
}
i4 i4_shiftLeft(i4 lhs, i4 rhs)
{
i4 z;
z = lhs << rhs;
return z;
}
i4 i4_shiftRight(i4 lhs, i4 rhs)
{
i4 z;
z = lhs >> rhs;
return z;
}
/* Arithmetic operators */
u4 u4_unaryPlus(u4 lhs)
{
u4 z;
z = +lhs;
return z;
}
u4 u4_addition(u4 lhs, u4 rhs)
{
u4 z;
z = lhs + rhs;
return z;
}
u4 u4_subtract(u4 lhs, u4 rhs)
{
u4 z;
z = lhs - rhs;
return z;
}
u4 u4_multiply(u4 lhs, u4 rhs)
{
u4 z;
z = lhs * rhs;
return z;
}
u4 u4_divide(u4 lhs, u4 rhs)
{
u4 z;
z = lhs / rhs;
return z;
}
u4 u4_remainder(u4 lhs, u4 rhs)
{
u4 z;
z = lhs % rhs;
return z;
}
i4 i4_unaryMinus(i4 lhs)
{
i4 z;
z = -lhs;
return z;
}
i4 i4_unaryPlus(i4 lhs)
{
i4 z;
z = +lhs;
return z;
}
i4 i4_addition(i4 lhs, i4 rhs)
{
i4 z;
z = lhs + rhs;
return z;
}
i4 i4_subtract(i4 lhs, i4 rhs)
{
i4 z;
z = lhs - rhs;
return z;
}
i4 i4_multiply(i4 lhs, i4 rhs)
{
i4 z;
z = lhs * rhs;
return z;
}
i4 i4_divide(i4 lhs, i4 rhs)
{
i4 z;
z = lhs / rhs;
return z;
}
i4 i4_remainder(i4 lhs, i4 rhs)
{
i4 z;
z = lhs % rhs;
return z;
}
File diff suppressed because it is too large Load Diff
@@ -1,197 +1,199 @@
#include "pcode_test.h"
/* Comparison operators */
#ifdef HAS_DOUBLE
TEST biopEqf8f8_Main()
TEST f8_greaterThan_Main()
{
extern f8 biopEqf8f8(f8 lhs, f8 rhs);
extern f8 f8_greaterThan(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopEqf8f8(lhs, rhs);
retVal = f8_greaterThan(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(f8_greaterThan(PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(f8_greaterThan(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF8(f8_greaterThan(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_DOUBLE
TEST f8_greaterThanEquals_Main()
{
extern f8 f8_greaterThanEquals(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = f8_greaterThanEquals(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(f8_greaterThanEquals(PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(f8_greaterThanEquals(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF8(f8_greaterThanEquals(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_DOUBLE
TEST f8_lessThan_Main()
{
extern f8 f8_lessThan(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = f8_lessThan(lhs, rhs);
ASSERTF8(retVal, 0);
ASSERTF8(biopEqf8f8(PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(biopEqf8f8(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF8(biopEqf8f8(2*PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(f8_lessThan(PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(f8_lessThan(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF8(f8_lessThan(2*PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST biopNef8f8_Main()
TEST f8_lessThanEquals_Main()
{
extern f8 biopNef8f8(f8 lhs, f8 rhs);
extern f8 f8_lessThanEquals(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopNef8f8(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(biopNef8f8(PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(biopNef8f8(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF8(biopNef8f8(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_DOUBLE
TEST biopLogicOrf8f8_Main()
{
extern f8 biopLogicOrf8f8(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopLogicOrf8f8(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(biopLogicOrf8f8(PI_SHORT, PI_SHORT), 1);
ASSERTF8(biopLogicOrf8f8(PI_SHORT, 0), 1);
}
#endif
#ifdef HAS_DOUBLE
TEST biopLogicAndf8f8_Main()
{
extern f8 biopLogicAndf8f8(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopLogicAndf8f8(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(biopLogicAndf8f8(PI_SHORT, PI_SHORT), 1);
ASSERTF8(biopLogicAndf8f8(PI_SHORT, 0), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST unopNotf8_Main()
{
extern f8 unopNotf8(f8 lhs);
f8 lhs = 2;
f8 retVal;
retVal = unopNotf8(lhs);
retVal = f8_lessThanEquals(lhs, rhs);
ASSERTF8(retVal, 0);
ASSERTF8(unopNotf8(PI_SHORT), 0);
ASSERTF8(f8_lessThanEquals(PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(f8_lessThanEquals(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF8(f8_lessThanEquals(2*PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST unopNegativef8_Main()
TEST f8_equals_Main()
{
extern f8 unopNegativef8(f8 lhs);
extern f8 f8_equals(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = f8_equals(lhs, rhs);
ASSERTF8(retVal, 0);
ASSERTF8(f8_equals(PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(f8_equals(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF8(f8_equals(2*PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST f8_notEquals_Main()
{
extern f8 f8_notEquals(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = f8_notEquals(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(f8_notEquals(PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(f8_notEquals(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF8(f8_notEquals(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
/* Logical operators */
#ifdef HAS_DOUBLE
TEST f8_logicalAnd_Main()
{
extern f8 f8_logicalAnd(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = f8_logicalAnd(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(f8_logicalAnd(PI_SHORT, PI_SHORT), 1);
ASSERTF8(f8_logicalAnd(PI_SHORT, 0), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST f8_logicalOr_Main()
{
extern f8 f8_logicalOr(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = f8_logicalOr(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(f8_logicalOr(PI_SHORT, PI_SHORT), 1);
ASSERTF8(f8_logicalOr(PI_SHORT, 0), 1);
}
#endif
#ifdef HAS_DOUBLE
TEST f8_logicalNot_Main()
{
extern f8 f8_logicalNot(f8 lhs);
f8 lhs = 2;
f8 retVal;
retVal = unopNegativef8(lhs);
retVal = f8_logicalNot(lhs);
ASSERTF8(retVal, 0);
ASSERTF8(f8_logicalNot(PI_SHORT), 0);
}
#endif
/* Arithmetic operators */
#ifdef HAS_DOUBLE
TEST f8_unaryMinus_Main()
{
extern f8 f8_unaryMinus(f8 lhs);
f8 lhs = 2;
f8 retVal;
retVal = f8_unaryMinus(lhs);
ASSERTF8(retVal, -2);
ASSERTF8(unopNegativef8(PI_SHORT), -3.14);
ASSERTF8(f8_unaryMinus(PI_SHORT), -3.14);
}
#endif
#ifdef HAS_DOUBLE
TEST unopPlusf8_Main()
TEST f8_unaryPlus_Main()
{
extern f8 unopPlusf8(f8 lhs);
extern f8 f8_unaryPlus(f8 lhs);
f8 lhs = 2;
f8 retVal;
retVal = unopPlusf8(lhs);
retVal = f8_unaryPlus(lhs);
ASSERTF8(retVal, 2);
ASSERTF8(unopPlusf8(PI_SHORT), PI_SHORT);
ASSERTF8(f8_unaryPlus(PI_SHORT), PI_SHORT);
}
#endif
#ifdef HAS_DOUBLE
TEST biopMultf8f8_Main()
TEST f8_addition_Main()
{
extern f8 biopMultf8f8(f8 lhs, f8 rhs);
extern f8 f8_addition(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopMultf8f8(lhs, rhs);
ASSERTF8(retVal, 2);
ASSERTF8(biopMultf8f8(PI_SHORT, PI_SHORT), 9.8596);
}
#endif
#ifdef HAS_DOUBLE
TEST biopSubf8f8_Main()
{
extern f8 biopSubf8f8(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopSubf8f8(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(biopSubf8f8(PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST biopAddf8f8_Main()
{
extern f8 biopAddf8f8(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopAddf8f8(lhs, rhs);
retVal = f8_addition(lhs, rhs);
ASSERTF8(retVal, 3);
ASSERTF8(biopAddf8f8(PI_SHORT, PI_SHORT), 6.28);
ASSERTF8(f8_addition(PI_SHORT, PI_SHORT), 6.28);
}
#endif
#ifdef HAS_DOUBLE
TEST biopGtf8f8_Main()
TEST f8_subtract_Main()
{
extern f8 biopGtf8f8(f8 lhs, f8 rhs);
extern f8 f8_subtract(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopGtf8f8(lhs, rhs);
retVal = f8_subtract(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(biopGtf8f8(PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(biopGtf8f8(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF8(biopGtf8f8(2*PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(f8_subtract(PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST biopGef8f8_Main()
TEST f8_multiply_Main()
{
extern f8 biopGef8f8(f8 lhs, f8 rhs);
extern f8 f8_multiply(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopGef8f8(lhs, rhs);
ASSERTF8(retVal, 1);
ASSERTF8(biopGef8f8(PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(biopGef8f8(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF8(biopGef8f8(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_DOUBLE
TEST biopLtf8f8_Main()
{
extern f8 biopLtf8f8(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopLtf8f8(lhs, rhs);
ASSERTF8(retVal, 0);
ASSERTF8(biopLtf8f8(PI_SHORT, PI_SHORT), 0.0);
ASSERTF8(biopLtf8f8(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF8(biopLtf8f8(2*PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_DOUBLE
TEST biopLef8f8_Main()
{
extern f8 biopLef8f8(f8 lhs, f8 rhs);
f8 lhs = 2;
f8 rhs = 1;
f8 retVal;
retVal = biopLef8f8(lhs, rhs);
ASSERTF8(retVal, 0);
ASSERTF8(biopLef8f8(PI_SHORT, PI_SHORT), 1.0);
ASSERTF8(biopLef8f8(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF8(biopLef8f8(2*PI_SHORT, PI_SHORT), 0.0);
retVal = f8_multiply(lhs, rhs);
ASSERTF8(retVal, 2);
ASSERTF8(f8_multiply(PI_SHORT, PI_SHORT), 9.8596);
}
#endif
MAIN BIOPS_DOUBLE_main() { }
@@ -14,89 +14,10 @@
* limitations under the License.
*/
#include "pcode_test.h"
#ifdef HAS_DOUBLE
f8 biopEqf8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs == rhs;
return z;
}
f8 biopNef8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs != rhs;
return z;
}
f8 biopLogicOrf8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs || rhs;
return z;
}
f8 biopLogicAndf8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs && rhs;
return z;
}
f8 unopNotf8(f8 lhs)
{
f8 z;
z = !lhs;
return z;
}
f8 unopNegativef8(f8 lhs)
{
f8 z;
z = -lhs;
return z;
}
f8 unopPlusf8(f8 lhs)
{
f8 z;
z = +lhs;
return z;
}
f8 biopMultf8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs * rhs;
return z;
}
f8 biopSubf8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs - rhs;
return z;
}
f8 biopAddf8f8(f8 lhs, f8 rhs)
{
f8 z;
z = lhs + rhs;
return z;
}
f8 biopGtf8f8(f8 lhs, f8 rhs)
/* Comparison operators */
f8 f8_greaterThan(f8 lhs, f8 rhs)
{
f8 z;
@@ -104,7 +25,7 @@ f8 biopGtf8f8(f8 lhs, f8 rhs)
return z;
}
f8 biopGef8f8(f8 lhs, f8 rhs)
f8 f8_greaterThanEquals(f8 lhs, f8 rhs)
{
f8 z;
@@ -112,7 +33,7 @@ f8 biopGef8f8(f8 lhs, f8 rhs)
return z;
}
f8 biopLtf8f8(f8 lhs, f8 rhs)
f8 f8_lessThan(f8 lhs, f8 rhs)
{
f8 z;
@@ -120,7 +41,7 @@ f8 biopLtf8f8(f8 lhs, f8 rhs)
return z;
}
f8 biopLef8f8(f8 lhs, f8 rhs)
f8 f8_lessThanEquals(f8 lhs, f8 rhs)
{
f8 z;
@@ -128,4 +49,88 @@ f8 biopLef8f8(f8 lhs, f8 rhs)
return z;
}
f8 f8_equals(f8 lhs, f8 rhs)
{
f8 z;
z = lhs == rhs;
return z;
}
f8 f8_notEquals(f8 lhs, f8 rhs)
{
f8 z;
z = lhs != rhs;
return z;
}
/* Bitwise operators */
/* Logical operators */
f8 f8_logicalAnd(f8 lhs, f8 rhs)
{
f8 z;
z = lhs && rhs;
return z;
}
f8 f8_logicalOr(f8 lhs, f8 rhs)
{
f8 z;
z = lhs || rhs;
return z;
}
f8 f8_logicalNot(f8 lhs)
{
f8 z;
z = !lhs;
return z;
}
/* Arithmetic operators */
f8 f8_unaryMinus(f8 lhs)
{
f8 z;
z = -lhs;
return z;
}
f8 f8_unaryPlus(f8 lhs)
{
f8 z;
z = +lhs;
return z;
}
f8 f8_addition(f8 lhs, f8 rhs)
{
f8 z;
z = lhs + rhs;
return z;
}
f8 f8_subtract(f8 lhs, f8 rhs)
{
f8 z;
z = lhs - rhs;
return z;
}
f8 f8_multiply(f8 lhs, f8 rhs)
{
f8 z;
z = lhs * rhs;
return z;
}
#endif /* #ifdef HAS_DOUBLE */
@@ -1,168 +1,171 @@
#include "pcode_test.h"
#ifdef HAS_FLOAT
TEST biopCmpf4f4_Main()
TEST f4_compareLogic_Main()
{
extern f4 biopCmpf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopCmpf4f4(0x1, 0x1), 21);
ASSERTF4(biopCmpf4f4(0x1, 0x2), 21);
ASSERTF4(biopCmpf4f4(0x2, 0x1), 22);
ASSERTF4(biopCmpf4f4(-0x1, -0x1), 21);
ASSERTF4(biopCmpf4f4(-0x1, -0x2), 21);
ASSERTF4(biopCmpf4f4(-0x2, -0x1), 24);
extern f4 f4_compareLogic(f4 lhs, f4 rhs);
ASSERTF4(f4_compareLogic(0x1, 0x1), 21);
ASSERTF4(f4_compareLogic(0x1, 0x2), 21);
ASSERTF4(f4_compareLogic(0x2, 0x1), 22);
ASSERTF4(f4_compareLogic(-0x1, -0x1), 21);
ASSERTF4(f4_compareLogic(-0x1, -0x2), 21);
ASSERTF4(f4_compareLogic(-0x2, -0x1), 24);
}
#endif
#ifdef HAS_DOUBLE
TEST biopCmpf8f8_Main()
TEST f8_compareLogic_Main()
{
extern f8 biopCmpf8f8(f8 lhs, f8 rhs);
ASSERTF8(biopCmpf8f8(0x1, 0x1), 21);
ASSERTF8(biopCmpf8f8(0x1, 0x2), 21);
ASSERTF8(biopCmpf8f8(0x2, 0x1), 22);
ASSERTF8(biopCmpf8f8(-0x1, -0x1), 21);
ASSERTF8(biopCmpf8f8(-0x1, -0x2), 21);
ASSERTF8(biopCmpf8f8(-0x2, -0x1), 24);
extern f8 f8_compareLogic(f8 lhs, f8 rhs);
ASSERTF8(f8_compareLogic(0x1, 0x1), 21);
ASSERTF8(f8_compareLogic(0x1, 0x2), 21);
ASSERTF8(f8_compareLogic(0x2, 0x1), 22);
ASSERTF8(f8_compareLogic(-0x1, -0x1), 21);
ASSERTF8(f8_compareLogic(-0x1, -0x2), 21);
ASSERTF8(f8_compareLogic(-0x2, -0x1), 24);
}
#endif
/* Comparison operators */
#ifdef HAS_FLOAT
TEST f4_greaterThan_Main()
{
extern f4 f4_greaterThan(f4 lhs, f4 rhs);
ASSERTF4(f4_greaterThan(2, 1), 1);
ASSERTF4(f4_greaterThan(PI_SHORT, PI_SHORT), 0.0);
ASSERTF4(f4_greaterThan(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF4(f4_greaterThan(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopLtf4f4_Main()
TEST f4_greaterThanEquals_Main()
{
extern f4 biopLtf4f4(f4 lhs, f4 rhs);
extern f4 f4_greaterThanEquals(f4 lhs, f4 rhs);
ASSERTF4(f4_greaterThanEquals(2, 1), 1);
ASSERTF4(f4_greaterThanEquals(PI_SHORT, PI_SHORT), 1.0);
ASSERTF4(f4_greaterThanEquals(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF4(f4_greaterThanEquals(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_FLOAT
TEST f4_lessThan_Main()
{
extern f4 f4_lessThan(f4 lhs, f4 rhs);
f4 lhs = 2;
f4 rhs = 1;
f4 retVal;
ASSERTF4(biopLtf4f4(lhs, rhs), 0);
ASSERTF4(f4_lessThan(lhs, rhs), 0);
}
#endif
#ifdef HAS_FLOAT
TEST biopLef4f4_Main()
TEST f4_lessThanEquals_Main()
{
extern f4 biopLef4f4(f4 lhs, f4 rhs);
ASSERTF4(biopLef4f4(2, 1), 0);
ASSERTF4(biopLef4f4(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF4(biopLef4f4(PI_SHORT, PI_SHORT), 1.0);
ASSERTF4(biopLef4f4(2*PI_SHORT, PI_SHORT), 0.0);
extern f4 f4_lessThanEquals(f4 lhs, f4 rhs);
ASSERTF4(f4_lessThanEquals(2, 1), 0);
ASSERTF4(f4_lessThanEquals(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF4(f4_lessThanEquals(PI_SHORT, PI_SHORT), 1.0);
ASSERTF4(f4_lessThanEquals(2*PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopEqf4f4_Main()
TEST f4_equals_Main()
{
extern f4 biopEqf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopEqf4f4(2, 1), 0);
ASSERTF4(biopEqf4f4(PI_SHORT, PI_SHORT), 1.0);
ASSERTF4(biopEqf4f4(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF4(biopEqf4f4(2*PI_SHORT, PI_SHORT), 0.0);
extern f4 f4_equals(f4 lhs, f4 rhs);
ASSERTF4(f4_equals(2, 1), 0);
ASSERTF4(f4_equals(PI_SHORT, PI_SHORT), 1.0);
ASSERTF4(f4_equals(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF4(f4_equals(2*PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopNef4f4_Main()
TEST f4_notEquals_Main()
{
extern f4 biopNef4f4(f4 lhs, f4 rhs);
ASSERTF4(biopNef4f4(2, 1), 1);
ASSERTF4(biopNef4f4(PI_SHORT, PI_SHORT), 0.0);
ASSERTF4(biopNef4f4(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF4(biopNef4f4(2*PI_SHORT, PI_SHORT), 1.0);
extern f4 f4_notEquals(f4 lhs, f4 rhs);
ASSERTF4(f4_notEquals(2, 1), 1);
ASSERTF4(f4_notEquals(PI_SHORT, PI_SHORT), 0.0);
ASSERTF4(f4_notEquals(PI_SHORT, 2*PI_SHORT), 1.0);
ASSERTF4(f4_notEquals(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
/* Logical operators */
#ifdef HAS_FLOAT
TEST f4_logicalAnd_Main()
{
extern f4 f4_logicalAnd(f4 lhs, f4 rhs);
ASSERTF4(f4_logicalAnd(2, 1), 1);
ASSERTF4(f4_logicalAnd(PI_SHORT, PI_SHORT), 1);
ASSERTF4(f4_logicalAnd(PI_SHORT, 0), 0.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopLogicOrf4f4_Main()
TEST f4_logicalOr_Main()
{
extern f4 biopLogicOrf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopLogicOrf4f4(2, 1), 1);
ASSERTF4(biopLogicOrf4f4(PI_SHORT, PI_SHORT), 1);
ASSERTF4(biopLogicOrf4f4(PI_SHORT, 0), 1);
extern f4 f4_logicalOr(f4 lhs, f4 rhs);
ASSERTF4(f4_logicalOr(2, 1), 1);
ASSERTF4(f4_logicalOr(PI_SHORT, PI_SHORT), 1);
ASSERTF4(f4_logicalOr(PI_SHORT, 0), 1);
}
#endif
#ifdef HAS_FLOAT
TEST biopLogicAndf4f4_Main()
TEST f4_logicalNot_Main()
{
extern f4 biopLogicAndf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopLogicAndf4f4(2, 1), 1);
ASSERTF4(biopLogicAndf4f4(PI_SHORT, PI_SHORT), 1);
ASSERTF4(biopLogicAndf4f4(PI_SHORT, 0), 0.0);
extern f4 f4_logicalNot(f4 lhs);
ASSERTF4(f4_logicalNot(2), 0);
ASSERTF4(f4_logicalNot(PI_SHORT), 0);
}
#endif
/* Arithmetic operators */
#ifdef HAS_FLOAT
TEST f4_unaryMinus_Main()
{
extern f4 f4_unaryMinus(f4 lhs);
ASSERTF4(f4_unaryMinus(2), -2);
ASSERTF4(f4_unaryMinus(PI_SHORT), -3.14);
}
#endif
#ifdef HAS_FLOAT
TEST unopNotf4_Main()
TEST f4_unaryPlus_Main()
{
extern f4 unopNotf4(f4 lhs);
ASSERTF4(unopNotf4(2), 0);
ASSERTF4(unopNotf4(PI_SHORT), 0);
extern f4 f4_unaryPlus(f4 lhs);
ASSERTF4(f4_unaryPlus(2), 2);
ASSERTF4(f4_unaryPlus(PI_SHORT), PI_SHORT);
}
#endif
#ifdef HAS_FLOAT
TEST unopNegativef4_Main()
TEST f4_addition_Main()
{
extern f4 unopNegativef4(f4 lhs);
ASSERTF4(unopNegativef4(2), -2);
ASSERTF4(unopNegativef4(PI_SHORT), -3.14);
extern f4 f4_addition(f4 lhs, f4 rhs);
ASSERTF4(f4_addition(2, 1), 3);
ASSERTF4(f4_addition(PI_SHORT, PI_SHORT), 6.280000);
}
#endif
#ifdef HAS_FLOAT
TEST unopPlusf4_Main()
TEST f4_subtract_Main()
{
extern f4 unopPlusf4(f4 lhs);
ASSERTF4(unopPlusf4(2), 2);
ASSERTF4(unopPlusf4(PI_SHORT), PI_SHORT);
extern f4 f4_subtract(f4 lhs, f4 rhs);
ASSERTF4(f4_subtract(2, 1), 1);
ASSERTF4(f4_subtract(PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopMultf4f4_Main()
TEST f4_multiply_Main()
{
extern f4 biopMultf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopMultf4f4(2, 1), 2);
ASSERTF4(biopMultf4f4(PI_SHORT, PI_SHORT), 9.859601);
}
#endif
#ifdef HAS_FLOAT
TEST biopSubf4f4_Main()
{
extern f4 biopSubf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopSubf4f4(2, 1), 1);
ASSERTF4(biopSubf4f4(PI_SHORT, PI_SHORT), 0.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopAddf4f4_Main()
{
extern f4 biopAddf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopAddf4f4(2, 1), 3);
ASSERTF4(biopAddf4f4(PI_SHORT, PI_SHORT), 6.280000);
}
#endif
#ifdef HAS_FLOAT
TEST biopGtf4f4_Main()
{
extern f4 biopGtf4f4(f4 lhs, f4 rhs);
ASSERTF4(biopGtf4f4(2, 1), 1);
ASSERTF4(biopGtf4f4(PI_SHORT, PI_SHORT), 0.0);
ASSERTF4(biopGtf4f4(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF4(biopGtf4f4(2*PI_SHORT, PI_SHORT), 1.0);
}
#endif
#ifdef HAS_FLOAT
TEST biopGef4f4_Main()
{
extern f4 biopGef4f4(f4 lhs, f4 rhs);
ASSERTF4(biopGef4f4(2, 1), 1);
ASSERTF4(biopGef4f4(PI_SHORT, PI_SHORT), 1.0);
ASSERTF4(biopGef4f4(PI_SHORT, 2*PI_SHORT), 0.0);
ASSERTF4(biopGef4f4(2*PI_SHORT, PI_SHORT), 1.0);
extern f4 f4_multiply(f4 lhs, f4 rhs);
ASSERTF4(f4_multiply(2, 1), 2);
ASSERTF4(f4_multiply(PI_SHORT, PI_SHORT), 9.859601);
}
#endif
@@ -16,7 +16,7 @@
#include "pcode_test.h"
#ifdef HAS_FLOAT
f4 biopCmpf4f4(f4 lhs, f4 rhs)
f4 f4_compareLogic(f4 lhs, f4 rhs)
{
if (lhs < 0)
lhs += 2;
@@ -29,7 +29,7 @@ f4 biopCmpf4f4(f4 lhs, f4 rhs)
return lhs;
}
f8 biopCmpf8f8(f8 lhs, f8 rhs)
f8 f8_compareLogic(f8 lhs, f8 rhs)
{
if (lhs < 0)
lhs += 2;
@@ -42,103 +42,8 @@ f8 biopCmpf8f8(f8 lhs, f8 rhs)
return lhs;
}
f4 biopLtf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs < rhs;
return z;
}
f4 biopLef4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs <= rhs;
return z;
}
f4 biopEqf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs == rhs;
return z;
}
f4 biopNef4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs != rhs;
return z;
}
f4 biopLogicOrf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs || rhs;
return z;
}
f4 biopLogicAndf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs && rhs;
return z;
}
f4 unopNotf4(f4 lhs)
{
f4 z;
z = !lhs;
return z;
}
f4 unopNegativef4(f4 lhs)
{
f4 z;
z = -lhs;
return z;
}
f4 unopPlusf4(f4 lhs)
{
f4 z;
z = +lhs;
return z;
}
f4 biopMultf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs * rhs;
return z;
}
f4 biopSubf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs - rhs;
return z;
}
f4 biopAddf4f4(f4 lhs, f4 rhs)
{
f4 z;
z = lhs + rhs;
return z;
}
f4 biopGtf4f4(f4 lhs, f4 rhs)
/* Comparison operators */
f4 f4_greaterThan(f4 lhs, f4 rhs)
{
f4 z;
@@ -146,7 +51,7 @@ f4 biopGtf4f4(f4 lhs, f4 rhs)
return z;
}
f4 biopGef4f4(f4 lhs, f4 rhs)
f4 f4_greaterThanEquals(f4 lhs, f4 rhs)
{
f4 z;
@@ -154,4 +59,102 @@ f4 biopGef4f4(f4 lhs, f4 rhs)
return z;
}
f4 f4_lessThan(f4 lhs, f4 rhs)
{
f4 z;
z = lhs < rhs;
return z;
}
f4 f4_lessThanEquals(f4 lhs, f4 rhs)
{
f4 z;
z = lhs <= rhs;
return z;
}
f4 f4_equals(f4 lhs, f4 rhs)
{
f4 z;
z = lhs == rhs;
return z;
}
f4 f4_notEquals(f4 lhs, f4 rhs)
{
f4 z;
z = lhs != rhs;
return z;
}
/* Logical operators */
f4 f4_logicalAnd(f4 lhs, f4 rhs)
{
f4 z;
z = lhs && rhs;
return z;
}
f4 f4_logicalOr(f4 lhs, f4 rhs)
{
f4 z;
z = lhs || rhs;
return z;
}
f4 f4_logicalNot(f4 lhs)
{
f4 z;
z = !lhs;
return z;
}
/* Arithmetic operators */
f4 f4_unaryMinus(f4 lhs)
{
f4 z;
z = -lhs;
return z;
}
f4 f4_unaryPlus(f4 lhs)
{
f4 z;
z = +lhs;
return z;
}
f4 f4_addition(f4 lhs, f4 rhs)
{
f4 z;
z = lhs + rhs;
return z;
}
f4 f4_subtract(f4 lhs, f4 rhs)
{
f4 z;
z = lhs - rhs;
return z;
}
f4 f4_multiply(f4 lhs, f4 rhs)
{
f4 z;
z = lhs * rhs;
return z;
}
#endif /* #ifdef HAS_FLOAT */
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -121,13 +121,13 @@ i4 nalign_struct(big_struct_type * in)
u4 pcode_memset(u1 *lhs, u1 val, u4 len)
{
memset(lhs, val, len);
memset(lhs, val, (size_t) len);
return *(u4 *) lhs;
}
void *pcode_memcpy(u1 * lhs, u1 * rhs, u4 len)
{
return memcpy(lhs, rhs, len);
return memcpy(lhs, rhs, (size_t) len);
}
u4 pcode_memcmp_u4(u4 lhs, u4 rhs)
@@ -137,7 +137,7 @@ u4 pcode_memcmp_u4(u4 lhs, u4 rhs)
u4 pcode_memcmp_n(u1 * lhs, u1 * rhs, u4 len)
{
return (u4) (memcmp(lhs, rhs, len) == 0 ? 0 : 1);
return (u4) (memcmp(lhs, rhs, (size_t) len) == 0 ? 0 : 1);
}
#if defined(HAS_FLOAT) && defined(HAS_DOUBLE) && defined(HAS_LONGLONG)
@@ -159,9 +159,9 @@ PCodeTest({
})
PCodeTest({
'name': 'AVR8_X5',
'name': 'AVR8_6',
'toolchain': 'AVR/avr-elf',
'ccflags': '-mmcu=avrxmega5 -lgcc',
'ccflags': '-mmcu=avr6 -lgcc',
'language_id': 'avr8:LE:16:atmega256',
'has_float': 0,
'has_double': 0,
@@ -2170,6 +2170,10 @@ public abstract class ProcessorEmulatorTestAdapter extends TestCase implements E
// stub
}
public final void test_BIOPS4() {
// stub
}
public final void test_BitManipulation() {
// stub
}
@@ -37,7 +37,7 @@
<language processor="AVR8"
endian="little"
size="16"
variant="Atmega256"
variant="atmega256"
version="1.3"
slafile="avr8eind.sla"
processorspec="atmega256.pspec"
@@ -1,5 +1,9 @@
<opinions>
<constraint loader="Executable and Linking Format (ELF)" compilerSpecID="gcc">
<constraint primary="83" processor="AVR8" endian="little" />
<constraint loader="Executable and Linking Format (ELF)" compilerSpecID="gcc">
<constraint primary="83" processor="AVR8" endian="little" />
<!-- Elf e_flags are used for the secondary attribute -->
<constraint primary="83" secondary= "31" processor="AVR8" size="16" variant="default"/>
<constraint primary="83" secondary= "51" processor="AVR8" size="16" variant="extended"/>
<constraint primary="83" secondary= "6" processor="AVR8" size="24"" variant="atmega256"/>
</constraint>
</opinions>
File diff suppressed because it is too large Load Diff
@@ -1,7 +1,7 @@
# AVR8 with 22-bit addressable code space
# AVR8 with 16-bit addressable code space and support for
@define PCBYTESIZE "3"
@define HASEIND "0"
@define PCBYTESIZE "2"
@define HASEIND "1"
@include "avr8.sinc"
@@ -18,7 +18,7 @@
<long_size value="4" />
<long_long_size value="8" />
<float_size value="4" />
<double_size value="4" />
<double_size value="4" /> <!-- non-standard -->
<long_double_size value="4" />
<size_alignment_map>
@@ -40,18 +40,24 @@
<prototype name="__stdcall" extrapop="3" stackshift="3" strategy="register">
<input>
<!-- Stack used for vararg parameters only -->
<pentry minsize="1" maxsize="2">
<pentry minsize="1" maxsize="2">
<register name="W"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R23R22"/>
</pentry>
<pentry minsize="3" maxsize="4">
<addr space="join" piece1="W" piece2="R23R22"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R21R20"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R19R18"/>
</pentry>
<pentry minsize="3" maxsize="4">
<addr space="join" piece1="R21R20" piece2="R19R18"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R17R16"/>
</pentry>
@@ -72,6 +78,9 @@
<pentry minsize="1" maxsize="2">
<register name="W"/>
</pentry>
<pentry minsize="3" maxsize="4">
<addr space="join" piece1="W" piece2="R23R22"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
@@ -103,32 +112,32 @@
<addr offset="1" space="stack"/>
</pentry>
</input>
<output>
<pentry minsize="1" maxsize="2">
<register name="W"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
<register name="R1"/>
<register name="R2"/>
<register name="R3"/>
<register name="R4"/>
<register name="R5"/>
<register name="R6"/>
<register name="R7"/>
<register name="R8"/>
<register name="R9"/>
<register name="R10"/>
<register name="R11"/>
<register name="R12"/>
<register name="R13"/>
<register name="R14"/>
<register name="R15"/>
<register name="R16"/>
<register name="R17"/>
<register name="Y"/>
</unaffected>
</prototype>
<output>
<pentry minsize="1" maxsize="2">
<register name="W"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
<register name="R1"/>
<register name="R2"/>
<register name="R3"/>
<register name="R4"/>
<register name="R5"/>
<register name="R6"/>
<register name="R7"/>
<register name="R8"/>
<register name="R9"/>
<register name="R10"/>
<register name="R11"/>
<register name="R12"/>
<register name="R13"/>
<register name="R14"/>
<register name="R15"/>
<register name="R16"/>
<register name="R17"/>
<register name="Y"/>
</unaffected>
</prototype>
</compiler_spec>
@@ -18,7 +18,7 @@
<long_size value="4" />
<long_long_size value="8" />
<float_size value="4" />
<double_size value="4" />
<double_size value="4" /> <!-- non-standard -->
<long_double_size value="4" />
<size_alignment_map>
@@ -45,12 +45,18 @@
<pentry minsize="1" maxsize="2">
<register name="R23R22"/>
</pentry>
<pentry minsize="3" maxsize="4">
<addr space="join" piece1="W" piece2="R23R22"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R21R20"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R19R18"/>
</pentry>
<pentry minsize="3" maxsize="4">
<addr space="join" piece1="R21R20" piece2="R19R18"/>
</pentry>
<pentry minsize="1" maxsize="2">
<register name="R17R16"/>
</pentry>
@@ -71,6 +77,9 @@
<pentry minsize="1" maxsize="2">
<register name="W"/>
</pentry>
<pentry minsize="3" maxsize="4">
<addr space="join" piece1="W" piece2="R23R22"/>
</pentry>
</output>
<unaffected>
<register name="SP"/>
@@ -0,0 +1,59 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test.processors;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.test.processors.support.EmulatorTestRunner;
import ghidra.test.processors.support.ProcessorEmulatorTestAdapter;
import junit.framework.Test;
public class AVR8_31_GCC_O0_EmulatorTest extends ProcessorEmulatorTestAdapter {
private static final String LANGUAGE_ID = "avr8:LE:16:default";
private static final String COMPILER_SPEC_ID = "gcc";
private static final String[] REG_DUMP_SET = new String[] {};
public AVR8_31_GCC_O0_EmulatorTest(String name) throws Exception {
super(name, LANGUAGE_ID, COMPILER_SPEC_ID, REG_DUMP_SET);
}
@Override
protected String getProcessorDesignator() {
return "AVR8_31_GCC_O0";
}
protected void initializeState(EmulatorTestRunner testRunner, Program program) throws Exception {
// These eliminate "uninitialized register" errors. Not strictly needed, but helps find actual problems.
testRunner.setRegister("SP", 0x0);
testRunner.setRegister("R1", 0x0);
testRunner.setRegister("Y", 0x0);
testRunner.setRegister("W", 0x0);
testRunner.setRegister("SREG", 0x0);
}
@Override
protected void setAnalysisOptions(Options analysisOptions) {
super.setAnalysisOptions(analysisOptions);
analysisOptions.setBoolean("Reference", false); // too many bad disassemblies
analysisOptions.setBoolean("Data Reference", false);
}
public static Test suite() {
return ProcessorEmulatorTestAdapter.buildEmulatorTestSuite(AVR8_31_GCC_O0_EmulatorTest.class);
}
}
@@ -0,0 +1,59 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test.processors;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.test.processors.support.EmulatorTestRunner;
import ghidra.test.processors.support.ProcessorEmulatorTestAdapter;
import junit.framework.Test;
public class AVR8_31_GCC_O3_EmulatorTest extends ProcessorEmulatorTestAdapter {
private static final String LANGUAGE_ID = "avr8:LE:16:default";
private static final String COMPILER_SPEC_ID = "gcc";
private static final String[] REG_DUMP_SET = new String[] {};
public AVR8_31_GCC_O3_EmulatorTest(String name) throws Exception {
super(name, LANGUAGE_ID, COMPILER_SPEC_ID, REG_DUMP_SET);
}
@Override
protected String getProcessorDesignator() {
return "AVR8_31_GCC_O3";
}
protected void initializeState(EmulatorTestRunner testRunner, Program program) throws Exception {
// These eliminate "uninitialized register" errors. Not strictly needed, but helps find actual problems.
testRunner.setRegister("SP", 0x0);
testRunner.setRegister("R1", 0x0);
testRunner.setRegister("Y", 0x0);
testRunner.setRegister("W", 0x0);
testRunner.setRegister("SREG", 0x0);
}
@Override
protected void setAnalysisOptions(Options analysisOptions) {
super.setAnalysisOptions(analysisOptions);
analysisOptions.setBoolean("Reference", false); // too many bad disassemblies
analysisOptions.setBoolean("Data Reference", false);
}
public static Test suite() {
return ProcessorEmulatorTestAdapter.buildEmulatorTestSuite(AVR8_31_GCC_O3_EmulatorTest.class);
}
}
@@ -0,0 +1,59 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test.processors;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.test.processors.support.EmulatorTestRunner;
import ghidra.test.processors.support.ProcessorEmulatorTestAdapter;
import junit.framework.Test;
public class AVR8_51_GCC_O0_EmulatorTest extends ProcessorEmulatorTestAdapter {
private static final String LANGUAGE_ID = "avr8:LE:16:extended";
private static final String COMPILER_SPEC_ID = "gcc";
private static final String[] REG_DUMP_SET = new String[] {};
public AVR8_51_GCC_O0_EmulatorTest(String name) throws Exception {
super(name, LANGUAGE_ID, COMPILER_SPEC_ID, REG_DUMP_SET);
}
@Override
protected String getProcessorDesignator() {
return "AVR8_51_GCC_O0";
}
protected void initializeState(EmulatorTestRunner testRunner, Program program) throws Exception {
// These eliminate "uninitialized register" errors. Not strictly needed, but helps find actual problems.
testRunner.setRegister("SP", 0x0);
testRunner.setRegister("R1", 0x0);
testRunner.setRegister("Y", 0x0);
testRunner.setRegister("W", 0x0);
testRunner.setRegister("SREG", 0x0);
}
@Override
protected void setAnalysisOptions(Options analysisOptions) {
super.setAnalysisOptions(analysisOptions);
analysisOptions.setBoolean("Reference", false); // too many bad disassemblies
analysisOptions.setBoolean("Data Reference", false);
}
public static Test suite() {
return ProcessorEmulatorTestAdapter.buildEmulatorTestSuite(AVR8_51_GCC_O0_EmulatorTest.class);
}
}
@@ -0,0 +1,59 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test.processors;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.test.processors.support.EmulatorTestRunner;
import ghidra.test.processors.support.ProcessorEmulatorTestAdapter;
import junit.framework.Test;
public class AVR8_51_GCC_O3_EmulatorTest extends ProcessorEmulatorTestAdapter {
private static final String LANGUAGE_ID = "avr8:LE:16:extended";
private static final String COMPILER_SPEC_ID = "gcc";
private static final String[] REG_DUMP_SET = new String[] {};
public AVR8_51_GCC_O3_EmulatorTest(String name) throws Exception {
super(name, LANGUAGE_ID, COMPILER_SPEC_ID, REG_DUMP_SET);
}
@Override
protected String getProcessorDesignator() {
return "AVR8_51_GCC_O3";
}
protected void initializeState(EmulatorTestRunner testRunner, Program program) throws Exception {
// These eliminate "uninitialized register" errors. Not strictly needed, but helps find actual problems.
testRunner.setRegister("SP", 0x0);
testRunner.setRegister("R1", 0x0);
testRunner.setRegister("Y", 0x0);
testRunner.setRegister("W", 0x0);
testRunner.setRegister("SREG", 0x0);
}
@Override
protected void setAnalysisOptions(Options analysisOptions) {
super.setAnalysisOptions(analysisOptions);
analysisOptions.setBoolean("Reference", false); // too many bad disassemblies
analysisOptions.setBoolean("Data Reference", false);
}
public static Test suite() {
return ProcessorEmulatorTestAdapter.buildEmulatorTestSuite(AVR8_51_GCC_O3_EmulatorTest.class);
}
}
@@ -0,0 +1,59 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test.processors;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.test.processors.support.EmulatorTestRunner;
import ghidra.test.processors.support.ProcessorEmulatorTestAdapter;
import junit.framework.Test;
public class AVR8_6_GCC_O0_EmulatorTest extends ProcessorEmulatorTestAdapter {
private static final String LANGUAGE_ID = "avr8:LE:16:atmega256";
private static final String COMPILER_SPEC_ID = "gcc";
private static final String[] REG_DUMP_SET = new String[] {};
public AVR8_6_GCC_O0_EmulatorTest(String name) throws Exception {
super(name, LANGUAGE_ID, COMPILER_SPEC_ID, REG_DUMP_SET);
}
@Override
protected String getProcessorDesignator() {
return "AVR8_6_GCC_O0";
}
protected void initializeState(EmulatorTestRunner testRunner, Program program) throws Exception {
// These eliminate "uninitialized register" errors. Not strictly needed, but helps find actual problems.
testRunner.setRegister("SP", 0x0);
testRunner.setRegister("R1", 0x0);
testRunner.setRegister("Y", 0x0);
testRunner.setRegister("W", 0x0);
testRunner.setRegister("SREG", 0x0);
}
@Override
protected void setAnalysisOptions(Options analysisOptions) {
super.setAnalysisOptions(analysisOptions);
analysisOptions.setBoolean("Reference", false); // too many bad disassemblies
analysisOptions.setBoolean("Data Reference", false);
}
public static Test suite() {
return ProcessorEmulatorTestAdapter.buildEmulatorTestSuite(AVR8_6_GCC_O0_EmulatorTest.class);
}
}
@@ -0,0 +1,59 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.test.processors;
import ghidra.framework.options.Options;
import ghidra.program.model.listing.Program;
import ghidra.test.processors.support.EmulatorTestRunner;
import ghidra.test.processors.support.ProcessorEmulatorTestAdapter;
import junit.framework.Test;
public class AVR8_6_GCC_O3_EmulatorTest extends ProcessorEmulatorTestAdapter {
private static final String LANGUAGE_ID = "avr8:LE:16:atmega256";
private static final String COMPILER_SPEC_ID = "gcc";
private static final String[] REG_DUMP_SET = new String[] {};
public AVR8_6_GCC_O3_EmulatorTest(String name) throws Exception {
super(name, LANGUAGE_ID, COMPILER_SPEC_ID, REG_DUMP_SET);
}
@Override
protected String getProcessorDesignator() {
return "AVR8_6_GCC_O3";
}
protected void initializeState(EmulatorTestRunner testRunner, Program program) throws Exception {
// These eliminate "uninitialized register" errors. Not strictly needed, but helps find actual problems.
testRunner.setRegister("SP", 0x0);
testRunner.setRegister("R1", 0x0);
testRunner.setRegister("Y", 0x0);
testRunner.setRegister("W", 0x0);
testRunner.setRegister("SREG", 0x0);
}
@Override
protected void setAnalysisOptions(Options analysisOptions) {
super.setAnalysisOptions(analysisOptions);
analysisOptions.setBoolean("Reference", false); // too many bad disassemblies
analysisOptions.setBoolean("Data Reference", false);
}
public static Test suite() {
return ProcessorEmulatorTestAdapter.buildEmulatorTestSuite(AVR8_6_GCC_O3_EmulatorTest.class);
}
}