Index | Thread | Search

From:
Christian Weisgerber <naddy@mips.inka.de>
Subject:
Re: [PATCH] amd64: import optimized memcmp from FreeBSD
To:
tech@openbsd.org
Date:
Tue, 3 Dec 2024 22:31:06 +0100

Download raw body.

Thread
  • Steffen Nurpmeso:

    [PATCH] amd64: import optimized memcmp from FreeBSD

  • Christian Schulte:
    
    > Noticed this myself. I am quite confused right now, as I also wrote a bcmp
    > function in C and the compiler also generates faster code.
    
    Be careful about running afoul of clang's optimizations.
    
    Calls to memcmp(), memcpy(), memset() with known fixed sizes may
    be replaced by optimized inline code.
    
    Clang also recognizes some algorithms and replaces them with optimized
    code.  I would not be surprised if it recognized memcmp()-like code
    and replaced it with a call to memcmp().
    
    Check the generated assembly to be sure.
    
    -- 
    Christian "naddy" Weisgerber                          naddy@mips.inka.de
    
    
    
  • Steffen Nurpmeso:

    [PATCH] amd64: import optimized memcmp from FreeBSD