public static void Setup() { s_assembler.Compile(ref s_overheadDelegate, Enumerable.Empty <Instruction>()); s_assembler.Compile(ref s_baselineDelegate, Assembler.SpillRegister(Register.RDI, Assembler.SpillRegister(Register.RSI, Assembler.IncrementStack(BytesToTest + 0x28, Assembler.SaveRcxToANonVolatileRegister( Assembler.ZeroStack(BytesToTest, 0x28, 0x4 )))))); s_assembler.Compile(ref s_improvedStosB, Assembler.SpillRegister(Register.RDI, Assembler.IncrementStack(BytesToTest + 0x28, Assembler.ZeroStack(BytesToTest, 0x28, 0x4 )))); s_assembler.Compile(ref s_improvedStosD, Assembler.SpillRegister(Register.RDI, Assembler.IncrementStack(BytesToTest + 0x28, Assembler.ZeroStack(BytesToTest, 0x28, 0x4 )))); s_assembler.Compile(ref s_improvedStosQ, Assembler.SpillRegister(Register.RDI, Assembler.IncrementStack(BytesToTest + 0x28, Assembler.ZeroStack(BytesToTest, 0x28, 0x4 )))); s_assembler.Compile(ref s_sse2, Assembler.IncrementStack(BytesToTest + 0x28, Assembler.ZeroStackSSE2(BytesToTest, 0x28 ))); }
private static IEnumerable <Type> GetTheTypes() { yield return(OverheadEstimateType()); foreach (var bytes in new[] { 32u, 64u /*, 128u, 256u, 512u, 1024u */ }) { var assembler = s_assembler; yield return(assembler.CompileDelegateType <IAsmDelegateVoid>( Assembler.SpillRegister(Register.RDI, Assembler.SpillRegister(Register.RSI, Assembler.IncrementStack(bytes + 0x28, Assembler.SaveRcxToANonVolatileRegister( Assembler.ZeroStack(bytes, 0x28, 0x4 ))))), "Baseline_" + bytes)); //yield return assembler.CompileDelegateType<IAsmDelegateVoid>( // Assembler.SpillRegister(Register.RDI, // Assembler.IncrementStack(bytes + 0x28, // Assembler.ZeroStack(bytes, 0x28, 0x1 // ))), "ImprovedStosB_" + bytes); //yield return assembler.CompileDelegateType<IAsmDelegateVoid>( // Assembler.SpillRegister(Register.RDI, // Assembler.IncrementStack(bytes + 0x28, // Assembler.ZeroStack(bytes, 0x28, 0x4 // ))), "ImprovedStosD_" + bytes); //yield return assembler.CompileDelegateType<IAsmDelegateVoid>( // Assembler.SpillRegister(Register.RDI, // Assembler.IncrementStack(bytes + 0x28, // Assembler.ZeroStack(bytes, 0x28, 0x8 // ))), "ImprovedStosQ_" + bytes); yield return(assembler.CompileDelegateType <IAsmDelegateVoid>( Assembler.IncrementStack(bytes + 0x28, Assembler.ZeroStackSSE2(bytes, 0x28 )), "SSE2_" + bytes)); } }