diff --git a/plat/cpm/tests/build.lua b/plat/cpm/tests/build.lua index 8795262ad..81d17d4dc 100644 --- a/plat/cpm/tests/build.lua +++ b/plat/cpm/tests/build.lua @@ -6,7 +6,8 @@ plat_testsuite { method = "plat/cpm/emu+emu", skipsets = { "b", -- B is broken on i80 - "floats" -- floats aren't supported + "floats", -- floats aren't supported + "long-long", }, tests = { "./*.c" }, } diff --git a/plat/linux68k/tests/build.lua b/plat/linux68k/tests/build.lua index 6a4b847c8..221abc8d6 100644 --- a/plat/linux68k/tests/build.lua +++ b/plat/linux68k/tests/build.lua @@ -4,5 +4,8 @@ plat_testsuite { name = "tests", plat = "linux68k", method = "plat/linux68k/emu+emu68k", - skipsets = {"floats"}, -- FPU instructions not supported by emulator + skipsets = { + "floats", -- FPU instructions not supported by emulator + "long-long", + }, } diff --git a/plat/linuxmips/tests/build.lua b/plat/linuxmips/tests/build.lua index 529277fd9..b2b660568 100644 --- a/plat/linuxmips/tests/build.lua +++ b/plat/linuxmips/tests/build.lua @@ -4,5 +4,7 @@ plat_testsuite { name = "tests", plat = "linuxmips", method = "qemu-mipsel", --- skipsets = {"m2"}, + skipsets = { + "long-long", + }, } diff --git a/plat/linuxppc/tests/build.lua b/plat/linuxppc/tests/build.lua index 7ea6e5bb9..fe89558a6 100644 --- a/plat/linuxppc/tests/build.lua +++ b/plat/linuxppc/tests/build.lua @@ -3,5 +3,8 @@ include("tests/plat/build.lua") plat_testsuite { name = "tests", plat = "linuxppc", - method = "plat/linuxppc/emu+emuppc" + method = "plat/linuxppc/emu+emuppc", + skipsets = { + "long-long", + }, } diff --git a/plat/pc86/tests/build.lua b/plat/pc86/tests/build.lua index 84b70a171..e4d8286fe 100644 --- a/plat/pc86/tests/build.lua +++ b/plat/pc86/tests/build.lua @@ -4,5 +4,8 @@ plat_testsuite { name = "tests", plat = "pc86", method = "plat/pc86/emu+pc86emu", - skipsets = {"floats"}, -- FPU instructions not supported by emulator + skipsets = { + "floats", -- FPU instructions not supported by emulator + "long-long", + }, } diff --git a/tests/plat/build.lua b/tests/plat/build.lua index f7eecc0dd..72fd6afad 100644 --- a/tests/plat/build.lua +++ b/tests/plat/build.lua @@ -4,7 +4,7 @@ definerule("plat_testsuite", { plat = { type="string" }, method = { type="string" }, - sets = { type="table", default={"core", "b", "bugs", "m2", "floats"}}, + sets = { type="table", default={"core", "b", "bugs", "m2", "floats", "long-long"}}, skipsets = { type="table", default={}}, tests = { type="targets", default={} }, }, diff --git a/tests/plat/long-long/lladdsub_e.c b/tests/plat/long-long/lladdsub_e.c new file mode 100644 index 000000000..a1b248520 --- /dev/null +++ b/tests/plat/long-long/lladdsub_e.c @@ -0,0 +1,59 @@ +#include "test.h" + +struct neg { + long long a; + long long neg_a; /* -a */ +} negations[] = { + {0LL, 0LL}, + {2LL, -2LL}, + {-446020022096LL, 446020022096LL}, +}; + +struct s_addsub { + long long a; + long long b; + long long a_add_b; /* a + b */ + long long a_sub_b; /* a - b */ +} s_cases[] = { + {2LL, 1LL, 3LL, 1LL}, + {2LL, -1LL, 1LL, 3LL}, + /* a + b overflows 32 bits */ + {1930610480LL, 842500503LL, 2773110983LL, 1088109977LL}, + {-446020022096LL, 1037107331549LL, 591087309453LL, -1483127353645LL}, + {-737537585551LL, -847060446507LL, -1584598032058LL, 109522860956LL}, +}; + +struct u_addsub { + unsigned long long a; + unsigned long long b; + unsigned long long a_add_b; + unsigned long long a_sub_b; +} u_cases[] = { + {2ULL, 1ULL, 3ULL, 1ULL}, + /* a + b overflows 63 bits */ + {6092994517831567942ULL, 3716888886436146324ULL, + 9809883404267714266ULL, 2376105631395421618ULL}, +}; + +#define LEN(ary) (sizeof(ary) / sizeof(ary[0])) + +void _m_a_i_n(void) { + int i; + + for (i = 0; i < LEN(negations); i++) { + struct neg *n = &negations[i]; + ASSERT(n->a == -n->neg_a); + ASSERT(-n->a == n->neg_a); + } + for (i = 0; i < LEN(s_cases); i++) { + struct s_addsub *s = &s_cases[i]; + ASSERT(s->a + s->b == s->a_add_b); + ASSERT(s->a - s->b == s->a_sub_b); + } + for (i = 0; i < LEN(u_cases); i++) { + struct u_addsub *u = &u_cases[i]; + ASSERT(u->a + u->b == u->a_add_b); + ASSERT(u->a - u->b == u->a_sub_b); + } + finished(); +}