From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id B3F38385783B for ; Fri, 20 Aug 2021 14:08:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B3F38385783B Received: by mail-pj1-x102d.google.com with SMTP id hv22-20020a17090ae416b0290178c579e424so7310299pjb.3 for ; Fri, 20 Aug 2021 07:08:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cM5i/rODhszpAWJWM1GL9nRVWVyVA/t79XTun+STvNs=; b=AV7GKRHXY/T2PZY1beGinAnQ3pgC07jNoimA5YQoIquN+9UO0N8jav3EbDuVxb4OM+ /KxIkhks/UQ6SJM8NyuSDSEFLCmqKC01f/1YRUrnlenTakj5Q6WTMc7Zseucl1cXmvU1 7EjKwzwHX8ernrKUZ1Ef/Qu8J9Hm1aY9gm+Vm7gSQv/VY2n/ZOz23WYCVYLhn2OEUm6d U0LoKY7DLMeRjX+oBX5ABO20yso/k6QPLuab8aTWbpqDlDkhht+EXJzdep28TuUHwdg1 A4iVSDTHWPI7o8vxDrpcWhoBPc6G5WH9BHmmDOzDIQqh6JXL/63DYUNya456Y8+JF/Vm t6Vw== X-Gm-Message-State: AOAM531Nuowl0iredBQ2oMEFXevGYWON3t5JJ6YJduS4IfagXPcjGoEU m5IPWiE7c5MlHJtsDrh6ykNgIfiwRXzj2cJ5VhA= X-Google-Smtp-Source: ABdhPJxW3XP7zMilmt5TjUblJqu1vErmBr8xX/JACQiom59kD9abDYQPhjXNUXaujVMcD38jYW/IUcwWG3TYhnuwSDk= X-Received: by 2002:a17:90a:9cf:: with SMTP id 73mr4886096pjo.136.1629468524889; Fri, 20 Aug 2021 07:08:44 -0700 (PDT) MIME-Version: 1.0 References: <20210819191021.3766894-1-hjl.tools@gmail.com> In-Reply-To: From: "H.J. Lu" Date: Fri, 20 Aug 2021 07:08:08 -0700 Message-ID: Subject: Re: [PATCH] Update string/test-memmove.c to cover 16KB copy To: Noah Goldstein Cc: GNU C Library Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3031.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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-List-Received-Date: Fri, 20 Aug 2021 14:08:47 -0000 On Thu, Aug 19, 2021 at 8:10 PM Noah Goldstein wrote: > > > > On Thu, Aug 19, 2021, 2:10 PM H.J. Lu via Libc-alpha wrote: >> >> --- >> string/test-memmove.c | 49 +++++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 49 insertions(+) >> >> diff --git a/string/test-memmove.c b/string/test-memmove.c >> index b271248b1d..812f6bde9e 100644 >> --- a/string/test-memmove.c >> +++ b/string/test-memmove.c >> @@ -312,6 +312,52 @@ do_test2 (size_t offset) >> munmap ((void *) large_buf, size); >> } >> >> +static void >> +do_test3 (void) > > > I think it may be cleaner to make > bytes_move and offset function arguments. Fixed. >> +{ >> + /* Copy 16KB data. */ >> + size_t bytes_move = 16384; > > > I think this should be a function argument. Fixed. >> + size_t size = 16384 * 3; >> + uint32_t *buf; >> + >> + buf = mmap (NULL, size, PROT_READ | PROT_WRITE, >> + MAP_PRIVATE | MAP_ANON, -1, 0); >> + >> + if (buf == MAP_FAILED) >> + error (EXIT_UNSUPPORTED, errno, "mmap failed"); >> + >> + size_t arr_size = bytes_move / sizeof (uint32_t); >> + size_t i; >> + >> + FOR_EACH_IMPL (impl, 0) >> + { >> + for (i = 0; i < arr_size; i++) >> + buf[i] = (uint32_t) i; >> + >> + uint32_t *dst = &buf[arr_size + 3]; > > > I think + 3 should be a variable and passed to the function. Fixed. >> + >> +#ifdef TEST_BCOPY >> + CALL (impl, (char *) buf, (char *) dst, bytes_move); >> +#else >> + CALL (impl, (char *) dst, (char *) buf, bytes_move); >> +#endif >> + >> + for (i = 0; i < arr_size; i++) >> + { >> + if (dst[i] != (uint32_t) i) >> + { >> + error (0, 0, >> + "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%zd\"", >> + impl->name, dst, buf, i); >> + ret = 1; >> + break; >> + } >> + } >> + } >> + >> + munmap ((void *) buf, size); >> +} >> + >> int >> test_main (void) >> { >> @@ -356,6 +402,9 @@ test_main (void) >> do_test2 (0x200000); >> do_test2 (0x4000000 - 1); >> do_test2 (0x4000000); >> + >> + do_test3 (); >> >> + >> return ret; >> } >> >> -- >> 2.31.1 > > > Okay with this patch but see comments. I sent out the v2 patch. Thanks. -- H.J.