Skip to content

Commit

Permalink
add tests back
Browse files Browse the repository at this point in the history
  • Loading branch information
clamchowder committed Apr 26, 2024
1 parent 3607ce4 commit fe3d369
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 20 deletions.
42 changes: 22 additions & 20 deletions AsmGen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,28 @@ class Program
static void Main(string[] args)
{
List<IUarchTest> tests = new List<IUarchTest>();
tests.Add(new RobTest(384, 768, 1));
tests.Add(new ZeroRobTest(384, 768, 1));
tests.Add(new IntRfTest(200, 400, 1));
tests.Add(new FpRfTest(280, 400, 1));
tests.Add(new MixIntVec128RfTest(250, 500, 1));
tests.Add(new Fadd256RfTest(280, 400, 1));
tests.Add(new MixFAdd256and32RfTest(280, 400, 1));
tests.Add(new FlagRfTest(200, 400, 1));
tests.Add(new LdqTest(150, 256, 1));
tests.Add(new StqTest(100, 512, 1));
tests.Add(new AddSchedTest(64, 180, 1));
tests.Add(new MulSchedTest(64, 180, 1));
tests.Add(new RobTest(128, 512, 1));
tests.Add(new ZeroRobTest(128, 512, 1));
tests.Add(new IntRfTest(96, 256, 1));
tests.Add(new FpRfTest(96, 256, 1));
tests.Add(new MixIntVec128RfTest(96, 300, 1));
tests.Add(new Fadd256RfTest(64, 256, 1));
tests.Add(new MixFAdd256and32RfTest(64, 256, 1));
tests.Add(new FlagRfTest(64, 256, 1));
tests.Add(new LdqTest(32, 160, 1));
tests.Add(new StqTest(32, 100, 1));
tests.Add(new AddSchedTest(16, 100, 1));
tests.Add(new MulSchedTest(4, 64, 1));
tests.Add(new LeaSchedTest(4, 64, 1));
tests.Add(new MaddSchedTest(4, 64, 1));
tests.Add(new JumpSchedTest(4, 64, 1));
tests.Add(new TakenJumpSchedTest(64, 180, 1));
tests.Add(new LoadSchedTest(50, 120, 1));
tests.Add(new StoreSchedTest(20, 80, 1));
tests.Add(new StoreDataSchedTest(20, 80, 1));
tests.Add(new TakenJumpSchedTest(4, 64, 1));
tests.Add(new LoadSchedTest(4, 72, 1));
tests.Add(new StoreSchedTest(4, 72, 1));
tests.Add(new StoreDataSchedTest(4, 80, 1));
tests.Add(new MixAddJumpSchedTest(64, 180, 1));
tests.Add(new FaddSchedTest(64, 180, 1));
tests.Add(new FcmpSchedTest(4, 120, 1));
tests.Add(new FaddSchedTest(32, 180, 1));
tests.Add(new FcmpSchedTest(32, 120, 1));
tests.Add(new JsCvtSched(8, 120, 1));
tests.Add(new MixAddvJsCvtSched(8, 120, 1));
tests.Add(new AddvSched(8, 120, 1));
Expand Down Expand Up @@ -73,8 +74,9 @@ static void Main(string[] args)
tests.Add(new FaddNsq(16, 80, 1, 140)); // x2
tests.Add(new MixAddvJsCvtNsq(8, 80, 1));
tests.Add(new AddvNsq(8, 48, 1, 60));
tests.Add(new StoreNsq(8, 30, 1)); // x2
tests.Add(new LoadNsq(8, 30, 1)); // x2
tests.Add(new StoreNsq(8, 120, 1)); // x2
tests.Add(new LoadNsq(8, 70, 1)); // x2
tests.Add(new JumpNsqTest(8, 100, 1));

// avx-512
tests.Add(new Vec512RfTest(128, 600, 1));
Expand Down
40 changes: 40 additions & 0 deletions AsmGen/tests/JumpNsqTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Text;

namespace AsmGen
{
public class JumpNsqTest : UarchTest
{
public JumpNsqTest(int low, int high, int step)
{
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step);
this.Prefix = "jumpnsq";
this.Description = "Scheduler, Not-Taken Jumps, excluding possible nsq";
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr";
this.GetFunctionCallParameters = "structIterations, A";
this.DivideTimeByCount = false;
}

public override bool SupportsIsa(IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.amd64) return true;
// if (isa == IUarchTest.ISA.aarch64) return true;
// if (isa == IUarchTest.ISA.mips64) return true;
// if (isa == IUarchTest.ISA.riscv) return true;
return false;
}

public override void GenerateAsm(StringBuilder sb, IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.amd64)
{
string[] dependentJumps = new string[1];
dependentJumps[0] = " cmp %rdi, %rsi\n je jumpnsq_reallybadthing";
string[] independentJumps = new string[1];
independentJumps[0] = " cmp %r13, %r14\n je jumpnsq_reallybadthing";
UarchTestHelpers.GenerateX86AsmNsqTestFuncs(sb, this.Counts[this.Counts.Length - 1], this.Counts, this.Prefix, dependentJumps, independentJumps);

sb.AppendLine("jumpnsq_reallybadthing:\n int3");
}
}
}
}
36 changes: 36 additions & 0 deletions AsmGen/tests/LeaSchedTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Text;

namespace AsmGen
{
public class LeaSchedTest : UarchTest
{
public LeaSchedTest(int low, int high, int step)
{
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step);
this.Prefix = "leasched";
this.Description = "Scheduler, lea with base + index + offset";
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr";
this.GetFunctionCallParameters = "structIterations, A";
this.DivideTimeByCount = false;
}

public override bool SupportsIsa(IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.amd64) return true;
return false;
}

public override void GenerateAsm(StringBuilder sb, IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.amd64)
{
string[] unrolledAdds = new string[4];
unrolledAdds[0] = " lea 128(%r15, %rdi), %r15";
unrolledAdds[1] = " lea 128(%r14, %rdi), %r14";
unrolledAdds[2] = " lea 128(%r13, %rdi), %r13";
unrolledAdds[3] = " lea 128(%r12, %rdi), %r12";
UarchTestHelpers.GenerateX86AsmStructureTestFuncs(sb, this.Counts, this.Prefix, unrolledAdds, unrolledAdds, includePtrChasingLoads: false);
}
}
}
}
15 changes: 15 additions & 0 deletions AsmGen/tests/LoadNsq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,26 @@ public LoadNsq(int low, int high, int step)
public override bool SupportsIsa(IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.aarch64) return true;
if (isa == IUarchTest.ISA.amd64) return true;
return false;
}

public override void GenerateAsm(StringBuilder sb, IUarchTest.ISA isa)
{
if (isa == IUarchTest.ISA.amd64)
{
string[] dep = new string[3];
dep[0] = " mov (%r8, %rdi, 4), %r15";
dep[1] = " mov (%r8, %rdi, 4), %r14";
dep[2] = " mov (%r8, %rdi, 4), %r13";

string[] indep = new string[3];
indep[0] = " mov (%r8), %r15";
indep[1] = " mov (%r8), %r14";
indep[2] = " mov (%r8), %r13";

UarchTestHelpers.GenerateX86AsmNsqTestFuncs(sb, this.Counts[this.Counts.Length - 1], this.Counts, this.Prefix, dep, indep, ptrChasingLoadsInSq: true);
}
if (isa == IUarchTest.ISA.aarch64)
{
string[] dep = new string[3];
Expand Down

0 comments on commit fe3d369

Please sign in to comment.