diff --git a/AsmGen/Program.cs b/AsmGen/Program.cs index ac44049..939dbe3 100644 --- a/AsmGen/Program.cs +++ b/AsmGen/Program.cs @@ -17,27 +17,28 @@ class Program static void Main(string[] args) { List tests = new List(); - 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)); @@ -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)); diff --git a/AsmGen/tests/JumpNsqTest.cs b/AsmGen/tests/JumpNsqTest.cs new file mode 100644 index 0000000..cf1b668 --- /dev/null +++ b/AsmGen/tests/JumpNsqTest.cs @@ -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"); + } + } + } +} diff --git a/AsmGen/tests/LeaSchedTest.cs b/AsmGen/tests/LeaSchedTest.cs new file mode 100644 index 0000000..18c7b6a --- /dev/null +++ b/AsmGen/tests/LeaSchedTest.cs @@ -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); + } + } + } +} diff --git a/AsmGen/tests/LoadNsq.cs b/AsmGen/tests/LoadNsq.cs index f65c8df..835862c 100644 --- a/AsmGen/tests/LoadNsq.cs +++ b/AsmGen/tests/LoadNsq.cs @@ -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];