Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 Jun 2017 09:18:28 +0100
From:      David Chisnall <theraven@FreeBSD.org>
To:        Jilles Tjoelker <jilles@stack.nl>
Cc:        Konstantin Belousov <kostikbel@gmail.com>, FreeBSD Hackers <freebsd-hackers@freebsd.org>, Eric van Gyzen <vangyzen@FreeBSD.org>, toolchain@freebsd.org
Subject:   Re: Function attribute for optimization level
Message-ID:  <2C01E322-CD6F-4BE6-B973-5B6C839DA5DE@FreeBSD.org>
In-Reply-To: <20170605195719.GA46606@stack.nl>
References:  <85c47390-dd27-aa74-24fe-25a9a5352527@FreeBSD.org> <20170605100324.GV82323@kib.kiev.ua> <20170605110911.GZ82323@kib.kiev.ua> <20170605195719.GA46606@stack.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On 5 Jun 2017, at 20:57, Jilles Tjoelker <jilles@stack.nl> wrote:
>=20
> I would prefer using -ffreestanding or -fno-builtin only for the files
> which need it. For example, builtin memcpy() with a small constant =
size
> is useful to read and write data regardless of alignment and =
type-based
> aliasing restrictions. If the memcpy() becomes an external call, both
> code size and speed will be affected and the programmer will probably
> choose some other way such as unsafe pointer casts or reading one byte
> at a time.

In a non-freestanding environment, memcpy, memset, and memcmp calls are =
both translated early to LLVM intrinsics and then have special handling =
throughout the optimisation pipeline and in code generation.  We=E2=80=99r=
e likely to pay a noticeable penalty in code size and performance if we =
don=E2=80=99t allow the compiler to do these, above and beyond the cost =
of the call.

David




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?2C01E322-CD6F-4BE6-B973-5B6C839DA5DE>