linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcmp.3: note about optimization to bcmp in LLVM 9
@ 2020-01-11 15:02 Shawn Landden
  2020-01-11 15:05 ` Shawn Landden
  2020-01-21 19:53 ` Michael Kerrisk (man-pages)
  0 siblings, 2 replies; 3+ messages in thread
From: Shawn Landden @ 2020-01-11 15:02 UTC (permalink / raw)
  To: linux-man; +Cc: Shawn Landden

---
 man3/memcmp.3 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/man3/memcmp.3 b/man3/memcmp.3
index 247eed223..6afca5ea4 100644
--- a/man3/memcmp.3
+++ b/man3/memcmp.3
@@ -84,10 +84,17 @@ because the required CPU time depends on the number of equal bytes.
 Instead, a function that performs comparisons in constant time is required.
 Some operating systems provide such a function (e.g., NetBSD's
 .BR consttime_memequal ()),
 but no such function is specified in POSIX.
 On Linux, it may be necessary to implement such a function oneself.
+.PP
+LLVM 9, released in 2019, and later will optimize a call
+.BR memcmp ()
+to a call to
+.BR bcmp (3)
+if the return value is only checked for equilivence to zero.
+.\" http://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations
 .SH SEE ALSO
 .BR bcmp (3),
 .BR bstring (3),
 .BR strcasecmp (3),
 .BR strcmp (3),
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] memcmp.3: note about optimization to bcmp in LLVM 9
  2020-01-11 15:02 [PATCH] memcmp.3: note about optimization to bcmp in LLVM 9 Shawn Landden
@ 2020-01-11 15:05 ` Shawn Landden
  2020-01-21 19:53 ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 3+ messages in thread
From: Shawn Landden @ 2020-01-11 15:05 UTC (permalink / raw)
  To: linux-man


11.01.2020, 10:02, "Shawn Landden" <shawn@git.icu>:
> ---
>  man3/memcmp.3 | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/man3/memcmp.3 b/man3/memcmp.3
> index 247eed223..6afca5ea4 100644
> --- a/man3/memcmp.3
> +++ b/man3/memcmp.3
> @@ -84,10 +84,17 @@ because the required CPU time depends on the number of equal bytes.
>  Instead, a function that performs comparisons in constant time is required.
>  Some operating systems provide such a function (e.g., NetBSD's
>  .BR consttime_memequal ()),
>  but no such function is specified in POSIX.
>  On Linux, it may be necessary to implement such a function oneself.
> +.PP
> +LLVM 9, released in 2019, and later will optimize a call
to
> +.BR memcmp ()
> +to a call to
> +.BR bcmp (3)
> +if the return value is only checked for equilivence to zero.
> +.\" http://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations
>  .SH SEE ALSO
>  .BR bcmp (3),
>  .BR bstring (3),
>  .BR strcasecmp (3),
>  .BR strcmp (3),
> --
> 2.20.1

-- 
Shawn Landden


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] memcmp.3: note about optimization to bcmp in LLVM 9
  2020-01-11 15:02 [PATCH] memcmp.3: note about optimization to bcmp in LLVM 9 Shawn Landden
  2020-01-11 15:05 ` Shawn Landden
@ 2020-01-21 19:53 ` Michael Kerrisk (man-pages)
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2020-01-21 19:53 UTC (permalink / raw)
  To: Shawn Landden, linux-man; +Cc: mtk.manpages

On 1/11/20 4:02 PM, Shawn Landden wrote:
> ---
>  man3/memcmp.3 | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/man3/memcmp.3 b/man3/memcmp.3
> index 247eed223..6afca5ea4 100644
> --- a/man3/memcmp.3
> +++ b/man3/memcmp.3
> @@ -84,10 +84,17 @@ because the required CPU time depends on the number of equal bytes.
>  Instead, a function that performs comparisons in constant time is required.
>  Some operating systems provide such a function (e.g., NetBSD's
>  .BR consttime_memequal ()),
>  but no such function is specified in POSIX.
>  On Linux, it may be necessary to implement such a function oneself.
> +.PP
> +LLVM 9, released in 2019, and later will optimize a call
> +.BR memcmp ()
> +to a call to
> +.BR bcmp (3)
> +if the return value is only checked for equilivence to zero.
> +.\" http://releases.llvm.org/9.0.0/docs/ReleaseNotes.html#noteworthy-optimizations

See my othermail. Wht is it relevant to document this 
compiler-specific detail?

Thanks,

Michael

>  .SH SEE ALSO
>  .BR bcmp (3),
>  .BR bstring (3),
>  .BR strcasecmp (3),
>  .BR strcmp (3),
> 


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-01-21 19:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-11 15:02 [PATCH] memcmp.3: note about optimization to bcmp in LLVM 9 Shawn Landden
2020-01-11 15:05 ` Shawn Landden
2020-01-21 19:53 ` Michael Kerrisk (man-pages)

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 NNTP newsgroup(s).