This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug string/21662] New: memcmp-avx2-movbe.S lacks saturating subtraction for between_2_3
- From: "fweimer at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Fri, 23 Jun 2017 13:03:18 +0000
- Subject: [Bug string/21662] New: memcmp-avx2-movbe.S lacks saturating subtraction for between_2_3
- Auto-submitted: auto-generated
https://sourceware.org/bugzilla/show_bug.cgi?id=21662
Bug ID: 21662
Summary: memcmp-avx2-movbe.S lacks saturating subtraction for
between_2_3
Product: glibc
Version: 2.26
Status: NEW
Severity: normal
Priority: P2
Component: string
Assignee: fweimer at redhat dot com
Reporter: fweimer at redhat dot com
Target Milestone: ---
Target: x86-64
This code:
L(between_2_3):
/* Load as big endian with overlapping loads and bswap to avoid
branches. */
movzwl -2(%rdi, %rdx), %eax
movzwl -2(%rsi, %rdx), %ecx
shll $16, %eax
shll $16, %ecx
movzwl (%rdi), %edi
movzwl (%rsi), %esi
orl %edi, %eax
orl %esi, %ecx
bswap %eax
bswap %ecx
subl %ecx, %eax
ret
needs a saturating subtract because the full register is used.
Reproducer:
#include <string.h>
#include <stdio.h>
int
main (void)
{
const char *left = "\uA46D\u0291";
const char *right = "bar";
printf ("%d\n", memcmp (left, right, 2));
}
--
You are receiving this mail because:
You are on the CC list for the bug.