[cfe-dev] [RFC] volatile mem* builtins

Joerg Sonnenberger via cfe-dev cfe-dev at lists.llvm.org
Thu May 7 14:13:15 PDT 2020


On Wed, May 06, 2020 at 03:40:43PM -0700, JF Bastien via cfe-dev wrote:
> I’d like to add volatile overloads to mem* builtins, and authored a patch: https://reviews.llvm.org/D79279 <https://reviews.llvm.org/D79279>

The major issue I have here is that it seems to seriously underspecify
what it is actually happening with the memory. Consider an
implementation of memset for example. It is entirely legal and
potentially even useful to check for length being >= two registers and
in that case implement it as
    write to [start, start+reglen)
    write to [start+len-reglen,start+len)
    write to (start+reglen)&(reglen-1) in reglen blocks until reaching
    the end

or variations to try to hide the unaligned head and tail case in the
main loop. This would violate the normal assumptions around volatile,
e.g. when using device memory.

Joerg


More information about the cfe-dev mailing list