diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2021-05-17 13:56:17 -0400 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2021-05-18 22:57:39 -0400 |
commit | e68d6fcccae10f325799b965875744470adc7281 (patch) | |
tree | 1462d77f20a74034cc39fe049094caca630c132f /string | |
parent | 3f500e7202476500fdc70f98d796d4103705638f (diff) | |
download | glibc-e68d6fcccae10f325799b965875744470adc7281.tar.gz glibc-e68d6fcccae10f325799b965875744470adc7281.tar.xz glibc-e68d6fcccae10f325799b965875744470adc7281.zip |
x86: Expand bench-memcmp.c and test-memcmp.c
No bug. This commit adds some additional performance test cases to bench-memcmp.c and test-memcmp.c. The new benchtests include some medium range sizes, as well as small sizes near page cross. The new correctness tests correspond with the new benchtests though add some additional cases for checking the page cross logic. Signed-off-by: Noah Goldstein <goldstein.w.n@gmail.com> Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
Diffstat (limited to 'string')
-rw-r--r-- | string/test-memcmp.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/string/test-memcmp.c b/string/test-memcmp.c index 02ea9b782d..fbda26a41e 100644 --- a/string/test-memcmp.c +++ b/string/test-memcmp.c @@ -111,11 +111,11 @@ do_test (size_t align1, size_t align2, size_t len, int exp_result) if (len == 0) return; - align1 &= 63; + align1 &= (4096 - CHARBYTES); if (align1 + (len + 1) * CHARBYTES >= page_size) return; - align2 &= 63; + align2 &= (4096 - CHARBYTES); if (align2 + (len + 1) * CHARBYTES >= page_size) return; @@ -487,18 +487,40 @@ test_main (void) printf ("\t%s", impl->name); putchar ('\n'); - for (i = 1; i < 16; ++i) + for (i = 1; i < 32; ++i) { do_test (i * CHARBYTES, i * CHARBYTES, i, 0); do_test (i * CHARBYTES, i * CHARBYTES, i, 1); do_test (i * CHARBYTES, i * CHARBYTES, i, -1); } - for (i = 0; i < 16; ++i) + for (i = 0; i < 32; ++i) { do_test (0, 0, i, 0); do_test (0, 0, i, 1); do_test (0, 0, i, -1); + do_test (4096 - i, 0, i, 0); + do_test (4096 - i, 0, i, 1); + do_test (4096 - i, 0, i, -1); + do_test (4095, 0, i, 0); + do_test (4095, 0, i, 1); + do_test (4095, 0, i, -1); + do_test (4095, 4095, i, 0); + do_test (4095, 4095, i, 1); + do_test (4095, 4095, i, -1); + do_test (4000, 95, i, 0); + do_test (4000, 95, i, 1); + do_test (4000, 95, i, -1); + } + + for (i = 33; i < 385; i += 32) + { + do_test (0, 0, i, 0); + do_test (0, 0, i, 1); + do_test (0, 0, i, -1); + do_test (i, 0, i, 0); + do_test (0, i, i, 1); + do_test (i, i, i, -1); } for (i = 1; i < 10; ++i) @@ -506,13 +528,19 @@ test_main (void) do_test (0, 0, 2 << i, 0); do_test (0, 0, 2 << i, 1); do_test (0, 0, 2 << i, -1); - do_test (0, 0, 16 << i, 0); do_test ((8 - i) * CHARBYTES, (2 * i) * CHARBYTES, 16 << i, 0); + do_test (0, 0, 16 << i, 0); do_test (0, 0, 16 << i, 1); do_test (0, 0, 16 << i, -1); + do_test (i, 0, 2 << i, 0); + do_test (0, i, 2 << i, 1); + do_test (i, i, 2 << i, -1); + do_test (i, 0, 16 << i, 0); + do_test (0, i, 16 << i, 1); + do_test (i, i, 16 << i, -1); } - for (i = 1; i < 8; ++i) + for (i = 1; i < 10; ++i) { do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 0); do_test (i * CHARBYTES, 2 * (i * CHARBYTES), 8 << i, 1); |