From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ot1-x330.google.com with SMTP id 46e09a7af769-6af6f5fc42aso2811080a34.1 for ; Tue, 23 May 2023 07:41:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1684852917; x=1687444917; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=x83oJXxrNfREPyi00CcrgxmPX0dwePYIA92lKycQ7Tw=; b=UG96wsI9Jt0/zBO2+ZLct2HP+IGdOEZwz0FA4MiQqXCj2sb9+Lf72qXbD+cccIEnlx 2TRqJ/uAfCZdSW+uG88QqPO4anSCQOM0lPaK4kzH7fp/vFafimsEegjq5RygOwF9txcU 6PYrUa61lNuDDr9ZDTzbdYgT6rD7WY/fOYEf+DC/mGZ4jifBFHBJDxZzkZebKDLyTqQg f4h4wL0oRCb+p4EGnJZOzLhTPdGZJJ8PQ4W02JO8eDsUSLw+vvatMBvBmG9sDySCopri zs2LQf5375UGmbZk/afsVDA7T8ubZv5sbHXzd2HfGIVeoESDEKWAuY3H0K9YuvALgQf4 Qthw== 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-Google-Smtp-Source: ACHHUZ55aXCX9XgY81DY0tPaGLoHTriiJ2jeqAY9OybLT79lJ+I4MfDK+S7kHZerQy5j0wUaBMCEhw== 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) From: Christophe Lyon 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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); } -- 2.34.1