-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/clamchowder/Microbenchmarks
- Loading branch information
Showing
7 changed files
with
195 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
using System.Text; | ||
|
||
namespace AsmGen | ||
{ | ||
public class AddNsq : UarchTest | ||
{ | ||
private int totalOps; | ||
public AddNsq(int low, int high, int step, int totalOps) | ||
{ | ||
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step); | ||
this.Prefix = "addnsq" + totalOps; | ||
this.Description = "Integer adds, excluding possible NSQ"; | ||
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr, float *floatArr"; | ||
this.GetFunctionCallParameters = "structIterations, A, fpArr"; | ||
this.DivideTimeByCount = false; | ||
this.totalOps = totalOps; | ||
} | ||
|
||
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[] depInstrs = new string[2]; | ||
depInstrs[0] = " add %rdi, %r15"; | ||
depInstrs[1] = " add %rdi, %r14"; | ||
|
||
string[] indepInstrs = new string[2]; | ||
indepInstrs[0] = " add %r13, %r11"; | ||
indepInstrs[1] = " add %r12, %r11"; | ||
UarchTestHelpers.GenerateX86AsmNsqTestFuncs(sb, this.totalOps, this.Counts, this.Prefix, depInstrs, indepInstrs, false); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Text; | ||
|
||
namespace AsmGen | ||
{ | ||
public class PdepSchedTest : UarchTest | ||
{ | ||
public PdepSchedTest(int low, int high, int step) | ||
{ | ||
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step); | ||
this.Prefix = "pdepsched"; | ||
this.Description = "Scheduler, PDEP"; | ||
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] = " pdep %rdi, %r15, %r15"; | ||
unrolledAdds[1] = " pdep %rdi, %r14, %r14"; | ||
unrolledAdds[2] = " pdep %rdi, %r13, %r13"; | ||
unrolledAdds[3] = " pdep %rdi, %r12, %r12"; | ||
UarchTestHelpers.GenerateX86AsmStructureTestFuncs(sb, this.Counts, this.Prefix, unrolledAdds, unrolledAdds, includePtrChasingLoads: false); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Text; | ||
|
||
namespace AsmGen | ||
{ | ||
public class StoreDataNsq : UarchTest | ||
{ | ||
public StoreDataNsq(int low, int high, int step) | ||
{ | ||
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step); | ||
this.Prefix = "storedatansq"; | ||
this.Description = "Store Data Scheduler, excluding NSQ"; | ||
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr, float *floatArr"; | ||
this.GetFunctionCallParameters = "structIterations, A, fpArr"; | ||
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[] dependentLoads = new string[4]; | ||
dependentLoads[0] = " mov %rdi, (%r8)"; | ||
dependentLoads[1] = " mov %rdi, 8(%r8)"; | ||
dependentLoads[2] = " mov %rdi, 16(%r8)"; | ||
dependentLoads[3] = " mov %rdi, 24(%r8)"; | ||
|
||
string[] independentLoads = new string[4]; | ||
independentLoads[0] = " mov %r14, (%r8)"; | ||
independentLoads[1] = " mov %r14, 8(%r8)"; | ||
independentLoads[2] = " mov %r14, 16(%r8)"; | ||
independentLoads[3] = " mov %r14, 24(%r8)"; | ||
UarchTestHelpers.GenerateX86AsmNsqTestFuncs(sb, this.Counts[this.Counts.Length - 1], this.Counts, this.Prefix, dependentLoads, independentLoads); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using System.Text; | ||
|
||
namespace AsmGen | ||
{ | ||
public class VecMulNsq : UarchTest | ||
{ | ||
private int totalOps; | ||
public VecMulNsq(int low, int high, int step, int totalOps) | ||
{ | ||
this.Counts = UarchTestHelpers.GenerateCountArray(low, high, step); | ||
this.Prefix = "vecmulnsq" + totalOps; | ||
this.Description = "Vector Integer Multiply, excluding possible NSQ"; | ||
this.FunctionDefinitionParameters = "uint64_t iterations, int *arr, float *floatArr"; | ||
this.GetFunctionCallParameters = "structIterations, A, fpArr"; | ||
this.DivideTimeByCount = false; | ||
this.totalOps = totalOps; | ||
} | ||
|
||
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 postLoadInstrs = " mov %rdi, %r15\n add %r8, %r15\n movdqu (%r15), %xmm1"; | ||
string initInstrs = " movdqu (%r8), %xmm2"; | ||
string[] depInstrs = new string[4]; | ||
depInstrs[0] = " pmulld %xmm1, %xmm0"; | ||
depInstrs[1] = " pmulld %xmm1, %xmm3"; | ||
depInstrs[2] = " pmulld %xmm1, %xmm4"; | ||
depInstrs[3] = " pmulld %xmm1, %xmm5"; | ||
|
||
string[] indepInstrs = new string[2]; | ||
indepInstrs[0] = " pmulld %xmm2, %xmm6"; | ||
indepInstrs[1] = " pmulld %xmm2, %xmm7"; | ||
UarchTestHelpers.GenerateX86AsmNsqTestFuncs(sb, this.totalOps, this.Counts, this.Prefix, depInstrs, indepInstrs, false, initInstrs, postLoadInstrs); | ||
} | ||
else if (isa == IUarchTest.ISA.aarch64) | ||
{ | ||
string postLoadInstrs1 = " ldr s16, [x2, w25, uxtw #2]"; | ||
string initInstrs = " ldr s15, [x2]"; | ||
string[] depInstrs = new string[4]; | ||
depInstrs[0] = " fadd s0, s0, s16"; | ||
depInstrs[1] = " fadd s1, s1, s16"; | ||
depInstrs[2] = " fadd s2, s2, s16"; | ||
depInstrs[3] = " fadd s3, s3, s16"; | ||
|
||
string[] indepInstrs = new string[4]; | ||
indepInstrs[0] = " fadd s17, s17, s15"; | ||
indepInstrs[1] = " fadd s18, s18, s15"; | ||
indepInstrs[2] = " fadd s19, s19, s15"; | ||
indepInstrs[3] = " fadd s20, s20, s15"; | ||
UarchTestHelpers.GenerateArmAsmNsqTestFuncs(sb, this.totalOps, this.Counts, this.Prefix, depInstrs, indepInstrs, false, initInstrs, | ||
postLoadInstrs: postLoadInstrs1); | ||
} | ||
} | ||
} | ||
} |