test coverage for integers on stack for sys

This commit is contained in:
veclav talica 2023-09-20 12:44:50 +05:00
parent ec59936d42
commit bb91e60199

View File

@ -208,14 +208,28 @@ fn addInt6(a: u64, b: u32, c: u16, d: u8, e: u64, f: i32) callconv(.SysV) void {
@panic("addInt6"); @panic("addInt6");
} }
fn addInt7(a: u64, b: u32, c: u16, d: u8, e: u64, f: i32, sa: u32) callconv(.SysV) void {
@setAlignStack(16);
if ((a + b + c + d + e + @as(u64, @intCast(f)) + sa) != 30)
@panic("addInt7");
}
fn addInt8(a: u64, b: u32, c: u16, d: u8, e: u64, f: i32, sa: u32, sb: u8) callconv(.SysV) void {
@setAlignStack(16);
if ((a + b + c + d + e + @as(u64, @intCast(f)) + sa + sb) != 40)
@panic("addInt8");
}
const opZov1Int = generateOpZovSysvFromPrototype(addInt1) catch unreachable; const opZov1Int = generateOpZovSysvFromPrototype(addInt1) catch unreachable;
const opZov2Ints = generateOpZovSysvFromPrototype(addInt2) catch unreachable; const opZov2Ints = generateOpZovSysvFromPrototype(addInt2) catch unreachable;
const opZov3Ints = generateOpZovSysvFromPrototype(addInt3) catch unreachable; const opZov3Ints = generateOpZovSysvFromPrototype(addInt3) catch unreachable;
const opZov4Ints = generateOpZovSysvFromPrototype(addInt4) catch unreachable; const opZov4Ints = generateOpZovSysvFromPrototype(addInt4) catch unreachable;
const opZov5Ints = generateOpZovSysvFromPrototype(addInt5) catch unreachable; const opZov5Ints = generateOpZovSysvFromPrototype(addInt5) catch unreachable;
const opZov6Ints = generateOpZovSysvFromPrototype(addInt6) catch unreachable; const opZov6Ints = generateOpZovSysvFromPrototype(addInt6) catch unreachable;
const opZov7Ints = generateOpZovSysvFromPrototype(addInt7) catch unreachable;
const opZov8Ints = generateOpZovSysvFromPrototype(addInt8) catch unreachable;
test "integer register passing" { test "integer parameter passing" {
const code = [_]tolmac.Word{ const code = [_]tolmac.Word{
@as(tolmac.Word, @intFromPtr(&tolmac.opPushWord)), @as(tolmac.Word, @intFromPtr(&tolmac.opPushWord)),
1, 1,
@ -241,6 +255,16 @@ test "integer register passing" {
4, 4,
@as(tolmac.Word, @intFromPtr(opZov6Ints)), @as(tolmac.Word, @intFromPtr(opZov6Ints)),
@as(tolmac.Word, @intFromPtr(&addInt6)), @as(tolmac.Word, @intFromPtr(&addInt6)),
@as(tolmac.Word, @intFromPtr(&tolmac.opPushWord)),
15,
@as(tolmac.Word, @intFromPtr(opZov7Ints)),
@as(tolmac.Word, @intFromPtr(&addInt7)),
@as(tolmac.Word, @intFromPtr(&tolmac.opPushWord)),
10,
@as(tolmac.Word, @intFromPtr(opZov8Ints)),
@as(tolmac.Word, @intFromPtr(&addInt8)),
@as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)),
@as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)),
@as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)), @as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)),
@as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)), @as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)),
@as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)), @as(tolmac.Word, @intFromPtr(&tolmac.opSinkWord)),