public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "witold.baryluk+gcc at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug d/107241] New: std.bitmanip.bigEndianToNative et al not inlined Date: Wed, 12 Oct 2022 18:53:57 +0000 [thread overview] Message-ID: <bug-107241-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107241 Bug ID: 107241 Summary: std.bitmanip.bigEndianToNative et al not inlined Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: d Assignee: ibuclaw at gdcproject dot org Reporter: witold.baryluk+gcc at gmail dot com Target Milestone: --- gdc fails to inline number of small functions that should fully inline and end in single instruction. on amd64 / x86, for example std.bitmanip.bigEndianToNative causes a chain of calls / jumps, even with @attribute("flatten") import std.bitmanip; import gcc.attributes; @attribute("flatten") size_t f(char[] b) { return std.bitmanip.bigEndianToNative!(size_t, 8)(cast(ubyte[8])(b[2..10])); } gcc -O3 -march=znver2 -frelease pure nothrow @nogc @safe ulong std.bitmanip.swapEndian!(ulong).swapEndian(const(ulong)): mov rax, rdi bswap rax ret pure nothrow @nogc @safe ulong std.bitmanip.endianToNativeImpl!(true, ulong, 8uL).endianToNativeImpl(ubyte[8]): jmp pure nothrow @nogc @safe ulong std.bitmanip.swapEndian!(ulong).swapEndian(const(ulong)) pure nothrow @nogc @safe ulong std.bitmanip.bigEndianToNative!(ulong, 8uL).bigEndianToNative(ubyte[8]): jmp pure nothrow @nogc @safe ulong std.bitmanip.endianToNativeImpl!(true, ulong, 8uL).endianToNativeImpl(ubyte[8]) ulong example.f(char[]): mov rdi, QWORD PTR [rsi+2] jmp pure nothrow @nogc @safe ulong std.bitmanip.bigEndianToNative!(ulong, 8uL).bigEndianToNative(ubyte[8]) No issues with LDC. ulong example.f(char[]): mov rax, qword ptr [rsi + 2] bswap rax ret godbolt: https://godbolt.org/z/Pj3f7oGso
next reply other threads:[~2022-10-12 18:53 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-12 18:53 witold.baryluk+gcc at gmail dot com [this message] 2022-10-12 18:56 ` [Bug d/107241] " pinskia at gcc dot gnu.org 2022-10-12 18:57 ` pinskia at gcc dot gnu.org 2022-10-13 5:45 ` ibuclaw at gdcproject dot 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-107241-4@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).