From patchwork Fri Apr 22 17:58:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1621075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=jCclj09f; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KlMb1017Jz9s2R for ; Sat, 23 Apr 2022 03:58:20 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 637C93858D37 for ; Fri, 22 Apr 2022 17:58:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 637C93858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1650650298; bh=Ru8oXawwwn0GjNxURFSTuAe79cfc2SER6UDfzlVD04Q=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jCclj09f+sabCOimefNfX/MDXCXqZxd8YHkM/9nvfLiUJaODYCgIhZywDf6jOIP0S x6EvRd/a13QQGxD7VyZ06fhyB9DOAotbN0ovCEgeiRC5D4T6CZ4NmcfpuPd/J5DjDm Bu7dZEAqC6PdEeW/YFHQZC24iAzeBLyp09Oi5uII= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by sourceware.org (Postfix) with ESMTPS id CA9CC3858D37 for ; Fri, 22 Apr 2022 17:58:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CA9CC3858D37 Received: by mail-pl1-x62b.google.com with SMTP id q1so11283930plx.13 for ; Fri, 22 Apr 2022 10:58:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Ru8oXawwwn0GjNxURFSTuAe79cfc2SER6UDfzlVD04Q=; b=Q6buyip2NuJOyNufwxRpa5+dpDXPVpBpNqZh88blTO2IQzmehHzdTGtHtERemwQxkE FAVwami5f12DoQTjFKVe6yPf9StWlnmywGLd2H+7TgNK7/Spm8ykjTzE6LaaWB7MAkDj aSgN82UQNC3e7aMRcfN1+u63YjnqYoASOnsku9IqKgZHkhiQdkjnqcs7G4p/5Eo0u7jG lMBzij8c6OjYGE3ZAYrfDD6Yz0J04xlI/x4rEsyEHM7RwaT9+rCwz5i0d6e5C+kkCCY9 mjhjB/I7yhEdj/KG1tdz4kUT8fSttzm4h3Ddg6LD+f11WgDWqs9k0f26vHv4Bi8Y0aml rkPw== X-Gm-Message-State: AOAM533B1oLN7nXcLwHM0jeVwAMt4jTK+ygkoQHlkQAFEmQQXkWj0Zer YLtG3wI/cJVdVHIdvamCNI/ONaKcxYQ= X-Google-Smtp-Source: ABdhPJz8a1ZM1kiiCBjlNcq+iv4YveAD4pmp6opUaAtyBQeMLWEHIYSbZnfjFLKkwwSS4wW75yf4og== X-Received: by 2002:a17:90b:3806:b0:1d2:6e95:f5cc with SMTP id mq6-20020a17090b380600b001d26e95f5ccmr6688325pjb.23.1650650281798; Fri, 22 Apr 2022 10:58:01 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.35.133]) by smtp.gmail.com with ESMTPSA id p4-20020a637404000000b00375948e63d6sm2643660pgc.91.2022.04.22.10.58.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 10:58:01 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 39327C0262; Fri, 22 Apr 2022 10:58:00 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH] x86-64: Fix SSE2 memcmp and SSSE3 memmove for x32 Date: Fri, 22 Apr 2022 10:58:00 -0700 Message-Id: <20220422175800.1262332-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3026.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Sender: "Libc-alpha" Clear the upper 32 bits in RDX (memory size) for x32 to fix FAIL: string/tst-size_t-memcmp FAIL: string/tst-size_t-memcmp-2 FAIL: string/tst-size_t-memcpy FAIL: wcsmbs/tst-size_t-wmemcmp on x32 introduced by 8804157ad9 x86: Optimize memcmp SSE2 in memcmp.S 26b2478322 x86: Reduce code size of mem{move|pcpy|cpy}-ssse3 --- sysdeps/x86_64/memcmp.S | 4 ++++ sysdeps/x86_64/multiarch/memmove-ssse3.S | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sysdeps/x86_64/memcmp.S b/sysdeps/x86_64/memcmp.S index b153694048..5718a7da86 100644 --- a/sysdeps/x86_64/memcmp.S +++ b/sysdeps/x86_64/memcmp.S @@ -46,6 +46,10 @@ .text ENTRY(MEMCMP) +# ifdef __ILP32__ + /* Clear the upper 32 bits. */ + movl %edx, %edx +# endif #ifdef USE_AS_WMEMCMP /* Use 0xffff to test for mismatches on pmovmskb bitmask. Store in ecx for code size. This is preferable to using `incw` as diff --git a/sysdeps/x86_64/multiarch/memmove-ssse3.S b/sysdeps/x86_64/multiarch/memmove-ssse3.S index 215583e7bd..310ff62b86 100644 --- a/sysdeps/x86_64/multiarch/memmove-ssse3.S +++ b/sysdeps/x86_64/multiarch/memmove-ssse3.S @@ -27,6 +27,10 @@ ENTRY(MEMMOVE_CHK) END(MEMMOVE_CHK) ENTRY_P2ALIGN(MEMMOVE, 6) +# ifdef __ILP32__ + /* Clear the upper 32 bits. */ + movl %edx, %edx +# endif movq %rdi, %rax L(start): cmpq $16, %rdx