public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "hubicka at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113235] SMHasher SHA3-256 benchmark is almost 40% slower vs. Clang (not enough complete loop peeling) Date: Fri, 05 Jan 2024 21:03:59 +0000 [thread overview] Message-ID: <bug-113235-4-wKCU19smXd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-113235-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113235 --- Comment #6 from Jan Hubicka <hubicka at gcc dot gnu.org> --- The internal loops are: static const unsigned keccakf_rotc[24] = { 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14, 27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44 }; static const unsigned keccakf_piln[24] = { 10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4, 15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1 }; static void keccakf(ulong64 s[25]) { int i, j, round; ulong64 t, bc[5]; for(round = 0; round < SHA3_KECCAK_ROUNDS; round++) { /* Theta */ for(i = 0; i < 5; i++) bc[i] = s[i] ^ s[i + 5] ^ s[i + 10] ^ s[i + 15] ^ s[i + 20]; for(i = 0; i < 5; i++) { t = bc[(i + 4) % 5] ^ ROL64(bc[(i + 1) % 5], 1); for(j = 0; j < 25; j += 5) s[j + i] ^= t; } /* Rho Pi */ t = s[1]; for(i = 0; i < 24; i++) { j = keccakf_piln[i]; bc[0] = s[j]; s[j] = ROL64(t, keccakf_rotc[i]); t = bc[0]; } /* Chi */ for(j = 0; j < 25; j += 5) { for(i = 0; i < 5; i++) bc[i] = s[j + i]; for(i = 0; i < 5; i++) s[j + i] ^= (~bc[(i + 1) % 5]) & bc[(i + 2) % 5]; } s[0] ^= keccakf_rndc[round]; } } I suppose with complete unrolling this will propagate, partly stay in registers and fold. I think increasing the default limits, especially -O3 may make sense. Value of 16 is there for very long time (I think since the initial implementation).
next prev parent reply other threads:[~2024-01-05 21:03 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-04 16:53 [Bug rtl-optimization/113235] New: SMHasher SHA3-256 benchmark is almost 40% slower vs. Clang on AMD Zen 4 aros at gmx dot com 2024-01-04 17:05 ` [Bug target/113235] " aros at gmx dot com 2024-01-04 17:09 ` xry111 at gcc dot gnu.org 2024-01-04 17:27 ` [Bug target/113235] SMHasher SHA3-256 benchmark is almost 40% slower vs. Clang xry111 at gcc dot gnu.org 2024-01-05 19:54 ` hubicka at gcc dot gnu.org 2024-01-05 20:26 ` [Bug target/113235] SMHasher SHA3-256 benchmark is almost 40% slower vs. Clang (not enough complete loop peeling) hubicka at gcc dot gnu.org 2024-01-05 21:03 ` hubicka at gcc dot gnu.org [this message] 2024-01-08 14:54 ` rguenth at gcc dot gnu.org 2024-01-08 14:55 ` rguenth at gcc dot gnu.org 2024-04-24 16:02 ` hubicka at gcc dot gnu.org 2024-04-24 16:41 ` dmalcolm at gcc dot gnu.org 2024-04-24 16:44 ` pinskia at gcc dot gnu.org 2024-04-24 16:47 ` pinskia at gcc dot gnu.org 2024-04-24 16:51 ` xry111 at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-113235-4-wKCU19smXd@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).