From patchwork Tue May 23 14:41:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 98023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2194618vqo; Tue, 23 May 2023 07:42:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6CfUkoO5jNDcISV2Z69R5Kwxxpy57zJxbcN/C3x2Mw1+CSFXUVNK9yjzl9dMlukhh2m5e9 X-Received: by 2002:aa7:d0c7:0:b0:50b:caae:784 with SMTP id u7-20020aa7d0c7000000b0050bcaae0784mr11388590edo.20.1684852966760; Tue, 23 May 2023 07:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684852966; cv=none; d=google.com; s=arc-20160816; b=0teCankasLOIZne3KrN8nHW3v8FCh5VDTaVqNYkLQY0Yt9WDritVSHnChcaESJiSPf /ji24AnpvYkpicgkwBwcxSOLcd4MQspB61aFZ4EX+uQYriniYardHB0QWzTIfaHdGANj czb1M9TeXtp8W0D+XhFbodVHmnygzLhrN3KMHzt2zZIOVY2jDFstL/7wEEsinx61PApN Ge9aLo4fhmaFbPfsjB3fSz6nKc82BvW1gHBtv17ijqhr5RmOhS+nmYt28uzNjV/mSRCG 1q8I8uQF14bYq0iLEdoDnLwujynEj01rtkU4Ak3yFYYiyWLy9iOW4SeJz4h4dYAGgyD2 vAVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=x83oJXxrNfREPyi00CcrgxmPX0dwePYIA92lKycQ7Tw=; b=DF4lW5Mu4VQ0WC0U1jO/wcfg/YBxF8ait0VrJlUMHAVqPEdgRof70+Zf63c7oQ45Ax s6Lq5mU7xNiyxx+LfH1pi19Z3HOSxIyiDGGLgM3S0+GHhwP+E67CKFjKyHEhvxMcg727 z3UOU6UpprnHRCSMHxo9UXtgjzxicqlo1Qej70qE8sJbPjoxC6euGFkHXlnWJCDIBord tgprDvKQVya1RVQqQoypsG+JUK6382Q66lWVEOeRefX7OFRag75DQqol8dm/bmaeDgqS 5gxy3NWaXa0eK83m/MlD3R+oAGwa/R7eMOvONq6z/G7gvVNWEs7+lfeNfj5aGtwaWPOd KynA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bgtfQZkS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id y21-20020a056402135500b0050a021d39besi4994081edw.454.2023.05.23.07.42.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=bgtfQZkS; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5FDE33858C27 for ; Tue, 23 May 2023 14:42:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5FDE33858C27 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684852965; bh=x83oJXxrNfREPyi00CcrgxmPX0dwePYIA92lKycQ7Tw=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=bgtfQZkSW/gAZmf+FnWqQmtbxnLIiy+VyJ39vLWqW/5lftHDaho9QBxkhLB/Ak3ty hrzLOUmwgQsHeDIQu5pXFivEEKmLEorvxqsmV4Azb7d4CrZ5CwfC8B+LtGd888pIor CfB3rv87A7m+TL/fYfUKiZeuUHirnvfPtIEAhzBA= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 48C1D3858D35 for ; Tue, 23 May 2023 14:41:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 48C1D3858D35 Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6af6f5fc42aso2811080a34.1 for ; Tue, 23 May 2023 07:41:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684852917; x=1687444917; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=x83oJXxrNfREPyi00CcrgxmPX0dwePYIA92lKycQ7Tw=; b=Zx3VYxqp0E2MjOn8BfOQeoTcJYdxyA+/eivmQNXLBTVVAo2Gg9Yo5nuf+epQ5SevHg zWcM96al71Raud5zNdtCsN66w0VjxbMHORDlnN3ofEf3RFh+chk5HREg4KQucVLK8HFx h2Pdt2AhyvPbM64h5FMfXL7izxvG9fSlbuu4yj5wiIAgKD9AIGPZHlFDmGAKpQaNPsmj qQ74D+8RjLYobMReB0T/CMMlYkAi/yNatHLfB/OjkrnujBEn1M0OG2Tr/EkN/tCGvVbU whfRPizXMMg1EO0MAPbHauOuZNoTnbm+U0/wQTeuHJdHUb5ZVrJaiq/HOnLY6XYkG87D 16IQ== X-Gm-Message-State: AC+VfDy4VmkIQKa16PR6kx+Dh8oovVMy7T8MfZef+FItEH/3JETKihp4 kBSiyx68vF8DoHvnPqQjOXBJOGpJRAbedxX9qq1dfM5p X-Received: by 2002:a05:6830:18eb:b0:6af:7940:390f with SMTP id d11-20020a05683018eb00b006af7940390fmr3838131otf.33.1684852917724; Tue, 23 May 2023 07:41:57 -0700 (PDT) Received: from localhost.localdomain ([139.178.84.207]) by smtp.gmail.com with ESMTPSA id o11-20020a9d764b000000b006ab2af64f34sm3465346otl.13.2023.05.23.07.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 07:41:57 -0700 (PDT) To: gcc-patches@gcc.gnu.org, stam.markianos-wright@arm.com, Kyrylo.Tkachov@arm.com Cc: Christophe Lyon Subject: [PATCH] [arm] testsuite: make mve_intrinsic_type_overloads-int.c libc-agnostic Date: Tue, 23 May 2023 14:41:45 +0000 Message-Id: <20230523144145.315887-1-christophe.lyon@linaro.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766696384149443370?= X-GMAIL-MSGID: =?utf-8?q?1766696384149443370?= Glibc defines int32_t as 'int' while newlib defines it as 'long int'. Although these correspond to the same size, g++ complains when using the 'wrong' version: invalid conversion from 'long int*' to 'int32_t*' {aka 'int*'} [-fpermissive] or invalid conversion from 'int*' to 'int32_t*' {aka 'long int*'} [-fpermissive] when calling vst1q(int32*, int32x4_t) with a first parameter of type 'long int *' (resp. 'int *') To make this test pass with any type of toolchain, this patch defines 'word_type' according to which libc is in use. 2023-05-23 Christophe Lyon gcc/testsuite/ * gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c: Support both definitions of int32_t. --- .../mve_intrinsic_type_overloads-int.c | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c index 7947dc024bc..ab51cc8b323 100644 --- a/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c +++ b/gcc/testsuite/gcc.target/arm/mve/intrinsics/mve_intrinsic_type_overloads-int.c @@ -47,14 +47,22 @@ foo2 (short * addr, int16x8_t value) vst1q (addr, value); } -void -foo3 (int * addr, int32x4_t value) -{ - vst1q (addr, value); /* { dg-warning "invalid conversion" "" { target c++ } } */ -} +/* Glibc defines int32_t as 'int' while newlib defines it as 'long int'. + + Although these correspond to the same size, g++ complains when using the + 'wrong' version: + invalid conversion from 'long int*' to 'int32_t*' {aka 'int*'} [-fpermissive] + + The trick below is to make this test pass whether using glibc-based or + newlib-based toolchains. */ +#if defined(__GLIBC__) +#define word_type int +#else +#define word_type long int +#endif void -foo4 (long * addr, int32x4_t value) +foo3 (word_type * addr, int32x4_t value) { vst1q (addr, value); } @@ -78,13 +86,7 @@ foo7 (unsigned short * addr, uint16x8_t value) } void -foo8 (unsigned int * addr, uint32x4_t value) -{ - vst1q (addr, value); /* { dg-warning "invalid conversion" "" { target c++ } } */ -} - -void -foo9 (unsigned long * addr, uint32x4_t value) +foo8 (unsigned word_type * addr, uint32x4_t value) { vst1q (addr, value); }