From: jsing Date: Thu, 5 Jan 2023 04:44:20 +0000 (+0000) Subject: Add additional shift benchmarks that are useful on BN_BITS2 == 32 platforms X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=756fa007bd8313514ddc45a4052d5bdc70ddea48;p=openbsd Add additional shift benchmarks that are useful on BN_BITS2 == 32 platforms --- diff --git a/regress/lib/libcrypto/bn/bn_shift.c b/regress/lib/libcrypto/bn/bn_shift.c index 743a911cbee..2335ae62128 100644 --- a/regress/lib/libcrypto/bn/bn_shift.c +++ b/regress/lib/libcrypto/bn/bn_shift.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_shift.c,v 1.5 2022/12/23 02:13:15 jsing Exp $ */ +/* $OpenBSD: bn_shift.c,v 1.6 2023/01/05 04:44:20 jsing Exp $ */ /* * Copyright (c) 2022 Joel Sing * @@ -391,6 +391,12 @@ benchmark_bn_lshift_1(BIGNUM *bn) benchmark_bn_lshift(bn, 1); } +static void +benchmark_bn_lshift_16(BIGNUM *bn) +{ + benchmark_bn_lshift(bn, 16); +} + static void benchmark_bn_lshift_32(BIGNUM *bn) { @@ -403,6 +409,18 @@ benchmark_bn_lshift_64(BIGNUM *bn) benchmark_bn_lshift(bn, 64); } +static void +benchmark_bn_lshift_65(BIGNUM *bn) +{ + benchmark_bn_lshift(bn, 65); +} + +static void +benchmark_bn_lshift_80(BIGNUM *bn) +{ + benchmark_bn_lshift(bn, 80); +} + static void benchmark_bn_lshift_127(BIGNUM *bn) { @@ -461,6 +479,18 @@ benchmark_bn_rshift_64(BIGNUM *bn) benchmark_bn_rshift(bn, 64); } +static void +benchmark_bn_rshift_65(BIGNUM *bn) +{ + benchmark_bn_rshift(bn, 65); +} + +static void +benchmark_bn_rshift_80(BIGNUM *bn) +{ + benchmark_bn_rshift(bn, 80); +} + static void benchmark_bn_rshift_127(BIGNUM *bn) { @@ -481,6 +511,10 @@ struct benchmark benchmarks[] = { .desc = "BN_lshift(_, _, 1)", .func = benchmark_bn_lshift_1, }, + { + .desc = "BN_lshift(_, _, 16)", + .func = benchmark_bn_lshift_16, + }, { .desc = "BN_lshift(_, _, 32)", .func = benchmark_bn_lshift_32, @@ -489,6 +523,14 @@ struct benchmark benchmarks[] = { .desc = "BN_lshift(_, _, 64)", .func = benchmark_bn_lshift_64, }, + { + .desc = "BN_lshift(_, _, 65)", + .func = benchmark_bn_lshift_65, + }, + { + .desc = "BN_lshift(_, _, 80)", + .func = benchmark_bn_lshift_80, + }, { .desc = "BN_lshift(_, _, 127)", .func = benchmark_bn_lshift_127, @@ -502,13 +544,25 @@ struct benchmark benchmarks[] = { .func = benchmark_bn_rshift_1, }, { - .desc = "BN_rshift(_, _, 32)", + .desc = "BN_rshift(_, _, 16)", + .func = benchmark_bn_rshift_32, + }, + { + .desc = "BN_rshift(_, _, 16)", .func = benchmark_bn_rshift_32, }, { .desc = "BN_rshift(_, _, 64)", .func = benchmark_bn_rshift_64, }, + { + .desc = "BN_rshift(_, _, 65)", + .func = benchmark_bn_rshift_65, + }, + { + .desc = "BN_rshift(_, _, 80)", + .func = benchmark_bn_rshift_80, + }, { .desc = "BN_rshift(_, _, 127)", .func = benchmark_bn_rshift_127,