[gcc/devel/rust/master] Merge #1459

Thomas Schwinge tschwinge@gcc.gnu.org
Tue Aug 16 19:04:53 GMT 2022


https://gcc.gnu.org/g:4665766d3cc9854d1609b71f673e96e0a340805c

commit 4665766d3cc9854d1609b71f673e96e0a340805c
Merge: 021e4953390 f68ecc7e591
Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com>
Date:   Tue Aug 16 10:39:44 2022 +0000

    Merge #1459
    
    1459: intrinsics: Add copy_nonoverlapping<T> r=CohenArthur a=CohenArthur
    
    intrinsics: Add copy_nonoverlapping<T>
    
    This intrinsic is similar to C's memcpy (or in our case, GCC's
    __builtin_memcpy) with the order of arguments swapped and knowledge
    about the type of the operands. So we can desugar the following calls:
    
    `copy_nonoverlapping::<T>(src, dst, count)`
    
    can be converted to
    
    `__builtin_memcpy(dst, src, count * size_of::<T>())`
    
    ~~Sadly, calling this intrinsic results in calls being optimized out for some reason. I'll open a separate issue to deal with that as I don't have the skills to resolve it.~~ fixed by not marking the function's declaration as `TREE_READONLY`
    
    Fixes #1450
    
    Co-authored-by: Arthur Cohen <arthur.cohen@embecosm.com>

Diff:

 gcc/rust/backend/rust-builtins.h                   |  8 +++
 gcc/rust/backend/rust-compile-intrinsic.cc         | 73 +++++++++++++++++++++-
 .../rust/execute/torture/copy_nonoverlapping1.rs   | 17 +++++
 3 files changed, 97 insertions(+), 1 deletion(-)


More information about the Gcc-cvs mailing list