From patchwork Mon Dec 11 13:40:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Dapp X-Patchwork-Id: 1874505 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=G9MavLfj; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SpjYz4C5Nz20Gc for ; Tue, 12 Dec 2023 00:40:55 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 735AE38582B2 for ; Mon, 11 Dec 2023 13:40:53 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by sourceware.org (Postfix) with ESMTPS id 09BD13858C50 for ; Mon, 11 Dec 2023 13:40:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 09BD13858C50 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 09BD13858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::631 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702302042; cv=none; b=W+IU45hApdliE7gvi6yTQpvdHGyUuSbKz3LZTai+T1gh8CJj45OkMOjXhKg14ZADBpAfEMb2lHyjhlR8r1Lp4TEqfwN7gB+eNxvUPg/6Xuo/xABibgtRSe1hpCvBMGjYKWCkX+DZfPoAQyiQpGp+EwFL5ZX0PnXbrmQfRgfUajE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702302042; c=relaxed/simple; bh=m1NS1m2I1JR/2gmfbpWWzWlFPYy+D9E7JcHwquEj/cY=; h=DKIM-Signature:Message-ID:Date:MIME-Version:To:From:Subject; b=cizTeH5boxf8T93NgtgRhgmlBRud3/QRCJwIvdLZMi9R85doF8kxpIGmLYTrTFXMbl8WkuLUDDqubOIKuzrHCpyEzBH2hW7BMBrjv0/e0bpo1amoes2tq6bE2RqeIsMhnPKwjX0T7p+19lXc2OQ9/Kidof8Ow0iGSjnIkBJAZt0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a1c7d8f89a5so595692266b.2 for ; Mon, 11 Dec 2023 05:40:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702302038; x=1702906838; darn=gcc.gnu.org; h=content-transfer-encoding:subject:from:to:content-language:cc :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=vrjP2kPLDw6hrjM8Wc+Oy7ACL/esx2ST6pbXi5i1kG0=; b=G9MavLfjeaPOo44N9HX2xDhlg6d8XKD7QjJfggpVHJFyVaax+j7Ph/hFVOF7M66yj7 CdyuNUUObT1DqjtbOvDi0BiW2v1rKOWWmChsNvQ1K3ug74AMHOiDkk0yMq/MHt9PI29E ttIUfSgIfE2eO3ymqTskS+Y+GoYW+VCjzY26YLZ5rDsnbQHRemkCKGj7edb0bTKsxKVP n2GSo2DEimuU/MjiAkG7m+Gq6sp4HJMXXVZ3J3QHW8WNiBmuZReHozKdadWbeE1P4fJh 8e3jHpdTcuJI2GRTfbuaYbtmlgrN7RR/i5z1LpCtkjpxgQqM8GwOZx7NSpTuT44IhjyU t+Nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702302038; x=1702906838; h=content-transfer-encoding:subject:from:to:content-language:cc :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=vrjP2kPLDw6hrjM8Wc+Oy7ACL/esx2ST6pbXi5i1kG0=; b=YEy6oD38xp4PUzimNyYPayxYCSuCnPrbkFN9QVVIxC0+DAs1gnYexQ8v4/PHKWlzmT Zf8mz8zYSK0Z7gfhACtlNg1Ns8MDMseuDczbsaomg4nw1TzATvJApZ+KfWl7deU68SqT s1iFyLgJ3Ecxhe4h+6i/4cddHaQTNdfz7MQZuDhhZy14V/yxMxijHQSBFkZVP7pvbm/1 1/w3nEpbaBL92C9rWGeJvkJtOrkGUi8AXnljlZdoHwLssad60EoTELo0Ol5Fjlb6fIqV WCnNaEtOC/gol5P588lBuFwfmFpZPzEzkugjV2YtT886adm7tStH0x4XUGQjgd1hhSoc 2fAw== X-Gm-Message-State: AOJu0Yz0/16b+BaPJMB1gCEJTxxpwcegNLQ3t+Bqt/zh7mg8u2tJ80aL NZgqdNzQS2eOkPrb7fXPH/RO4yCJ05Y= X-Google-Smtp-Source: AGHT+IHBfz2yfqkuFbhaT84CmGboLKMg9gWiaM+8PEnjhMDs+6cvSh1GLLHXJlUo+QisDk0yC/ygHQ== X-Received: by 2002:a17:907:e92:b0:a1c:eb75:6a73 with SMTP id ho18-20020a1709070e9200b00a1ceb756a73mr2734326ejc.36.1702302038505; Mon, 11 Dec 2023 05:40:38 -0800 (PST) Received: from [192.168.1.23] (ip-149-172-150-237.um42.pools.vodafone-ip.de. [149.172.150.237]) by smtp.gmail.com with ESMTPSA id ub27-20020a170907c81b00b00a1df4387f16sm4901159ejc.95.2023.12.11.05.40.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Dec 2023 05:40:38 -0800 (PST) Message-ID: <76c97d30-6c37-4f90-95f7-4e6231dd4331@gmail.com> Date: Mon, 11 Dec 2023 14:40:37 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: rdapp.gcc@gmail.com Content-Language: en-US To: gcc-patches , palmer , Kito Cheng , jeffreyalaw , "juzhe.zhong@rivai.ai" , "Li, Pan2" From: Robin Dapp Subject: [PATCH] RISC-V: testsuite: Fix strcmp-run.c test. X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_MANYTO, KAM_SHORT, RCVD_IN_DNSWL_NONE, SCC_5_SHORT_WORD_LINES, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Hi, this fixes expectations in the strcmp-run test which would sometimes fail with newlib. The test expects libc strcmp return values and asserts the vectorized result is similar to those. Therefore hard-code the expected results instead of relying on a strcmp call. Pan has already tested in a lot of configurations and doesn't see failures anymore. I'd argue it's obvious enough to push it if nobody complains :) Regards Robin gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c: Adjust test expectation. --- .../riscv/rvv/autovec/builtin/strcmp-run.c | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c index 6dec7da91c1..adbe022e0ee 100644 --- a/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c +++ b/gcc/testsuite/gcc.target/riscv/rvv/autovec/builtin/strcmp-run.c @@ -1,8 +1,6 @@ /* { dg-do run } */ /* { dg-additional-options "-O3 -minline-strcmp" } */ -#include - int __attribute__ ((noipa)) foo (const char *s, const char *t) @@ -10,23 +8,26 @@ foo (const char *s, const char *t) return __builtin_strcmp (s, t); } -int -__attribute__ ((noipa, optimize ("0"))) -foo2 (const char *s, const char *t) -{ - return strcmp (s, t); -} - #define SZ 10 -int main () +int +main () { const char *s[SZ] = {"", "asdf", "0", "\0", "!@#$%***m1123fdnmoi43", "a", "z", "1", "9", "12345678901234567889012345678901234567890"}; + const int ref[SZ * SZ] + = {0, -97, -48, 0, -33, -97, -122, -49, -57, -49, 97, 0, 49, 97, 64, + 115, -25, 48, 40, 48, 48, -49, 0, 48, 15, -49, -74, -1, -9, -1, + 0, -97, -48, 0, -33, -97, -122, -49, -57, -49, 33, -64, -15, 33, 0, + -64, -89, -16, -24, -16, 97, -115, 49, 97, 64, 0, -25, 48, 40, 48, + 122, 25, 74, 122, 89, 25, 0, 73, 65, 73, 49, -48, 1, 49, 16, + -48, -73, 0, -8, -50, 57, -40, 9, 57, 24, -40, -65, 8, 0, 8, + 49, -48, 1, 49, 16, -48, -73, 50, -8, 0}; + for (int i = 0; i < SZ; i++) for (int j = 0; j < SZ; j++) - if (foo (s[i], s[j]) != foo2 (s[i], s[j])) + if (foo (s[i], s[j]) != ref [i * SZ + j]) __builtin_abort (); }