From patchwork Sun Jan 7 15:53:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 1883381 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gjlay.de header.i=@gjlay.de header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=EE2hjI/U; dkim=fail reason="signature verification failed" header.d=gjlay.de header.i=@gjlay.de header.a=ed25519-sha256 header.s=strato-dkim-0003 header.b=LQofz33E; 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 4T7MDX5StNz1yPH for ; Mon, 8 Jan 2024 02:53:31 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E3ACB3858287 for ; Sun, 7 Jan 2024 15:53:28 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.217]) by sourceware.org (Postfix) with ESMTPS id BA31E3858418 for ; Sun, 7 Jan 2024 15:53:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BA31E3858418 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gjlay.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=gjlay.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BA31E3858418 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=81.169.146.217 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704642789; cv=pass; b=Cm7ZrF39DJHdIcPM/fk14huiKAXAsAQAk4qtM+FqVR3ybQ/hkaeLKCZPT69pXmYztatzwM2EKKwZt1Lm2vUyh/JQnh7Hdmb7SzQP3VL3uX+5xBsQtQocKNgsbebx5hZQc+thRGd89VtJy0MmHipROgwHiEyEJ6Ff5BOhXEiqeWA= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1704642789; c=relaxed/simple; bh=QOionnMNBaHZe/IoXPfUHeNFTzv1DbTu6JzWd/BZvbs=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version:To: From:Subject; b=tlCActXdG2Ie+akRpq/6gcDrzQXXMHOPGjwpPX/R0hwRTCwzFq9fqWt16FU+jjLYBT0VaEK1Kx8QG1L4/IBqLf+bpfGTL+jV0sz+9wvc5oxVNGCMoW4Yo/nmLw5EyjfthrGL5f7JsIoSPppyWM6IE6QQ8RoPayn51hEp/IgSBsg= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; t=1704642785; cv=none; d=strato.com; s=strato-dkim-0002; b=DgVGUFhQmfTstA8DLUGTcNKqNDRE6cOMwqXv90YRjH94V2Scd29cLb7XcuVPKEnS1C u6SOmntuQk4BueEI7Ru45c3rLJ98hoZnPNAvP4WITD/0q4T5AC1fcB9dY76FsUiyPb02 kpjMA68m5CyB2RD1JdG5eIpo4YKkk7ROA2V8lkgFpYmI+OJRYvTefH3jnhFqUi4EXra8 QWRho2TbCmr73CAfz4O3bYKRpcUaIfOX38WRmFiDd/C01CbA/GyuisnvJtCDXWLeNxCJ yb5AmAzEviOJNkUbeKL7RTIZx+5+HNOQS38fmBdYcjYlu09q0HYvQimlDDB47nMerd/F nD/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1704642785; s=strato-dkim-0002; d=strato.com; h=Subject:From:To:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=Ou/uQPtVk4i6aKRcdfT9AO4ZPFmGG8vPzYWIUBt+QQw=; b=nfyIdKjRG64YtezmE8EO5JnuQDEtKqh3d7tZsgWkE3n4rMAiuQKIWTKi9TE8k3XQJ/ 6hEDjR9pIrSoV0Ehjf3JvIToK8Zs9cUP09jP3NlqnUNTjbK2/W72SiJaw7ybgOhG+IH9 d7IDsGTgZyohmR3D7FaK3JzkyU8PUNAZlxjsxU+00MIhAS4CqDZ5xqcwhydEB+aS7I5A VmPqWk6MtJoIbxx436QSvZHBBHxRrzhlpQc51KoGIsxAoLCcuX1nhzF2TjU8LxMAW9PA vkH2FnLH3/dD6mb8U4xfV8TXA7EblKklvEG/XA0cPHY1T0laS9h+fA5ObVJxe7ji0t/+ qTPA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1704642785; s=strato-dkim-0002; d=gjlay.de; h=Subject:From:To:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=Ou/uQPtVk4i6aKRcdfT9AO4ZPFmGG8vPzYWIUBt+QQw=; b=EE2hjI/U9K1D4XylFMNIvGB3IUQfkIe3x0S9NY1r8H2Aad+G449awCeSUVK6sFJMfF OytTkQ0gKNAps71eUGzAZC+cZMG+pnkQPidHOahsow8+qcTDxk4U7BL8xq/XZPma+7kG dk+IFxaXAjnCf2Ggn+eNTeRJVHyGiTzaYquBlCfdZwkjwRsvUH4YiWFWSkwuI9vIRidF 0UZaFPiGY2S4HRYw5ScI9xovHes3Vw03LuvhgdNxRhhEYjb6cqEVzIKPoGRr98lOQ0Ik LnFZ2qJW6viZUKi/iLWpGT7DZY0qmfeMoQEoWqE5PiYiUTSRITVgQe5iJItgut57gJ5h +eSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1704642785; s=strato-dkim-0003; d=gjlay.de; h=Subject:From:To:Date:Message-ID:Cc:Date:From:Subject:Sender; bh=Ou/uQPtVk4i6aKRcdfT9AO4ZPFmGG8vPzYWIUBt+QQw=; b=LQofz33EuwYBJ+YP8fpM1YWIW1lTFFFnsIvPTeOPs/2qbx4L3EnV/kycB2aIzEb+Xp WFhgkbEyQCRokubeiSAw== X-RZG-AUTH: ":LXoWVUeid/7A29J/hMvvT3koxZnKT7Qq0xotTetVnKkSjsSjq3WhKPVxx3mY" Received: from [192.168.2.102] by smtp.strato.de (RZmta 49.10.2 DYNA|AUTH) with ESMTPSA id 641e88007Fr5JoH (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate) for ; Sun, 7 Jan 2024 16:53:05 +0100 (CET) Message-ID: Date: Sun, 7 Jan 2024 16:53:04 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Content-Language: en-US To: gcc-patches@gcc.gnu.org From: Georg-Johann Lay Subject: [patch, testsuite, applied] PR52641 Fix more fallout from sloppy tests. X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, 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 Made some tests more generic so they can pass on more targets. Johann --- testsuite/52641: Fix fallout from sloppy tests. gcc/testsuite/ PR testsuite/52641 * gcc.dg/torture/pr110838.c: Use proper shift offset to get MSB or int. * gcc.dg/torture/pr112282.c: Use at least 32 bits for :20 bit-fields. * gcc.dg/tree-ssa/bitcmp-5.c: Use integral type with 32 bits or more. * gcc.dg/tree-ssa/bitcmp-6.c: Same. * gcc.dg/tree-ssa/cltz-complement-max.c: Same. * gcc.dg/tree-ssa/cltz-max.c: Same. * gcc.dg/tree-ssa/if-to-switch-8.c: Use literals that fit int. * gcc.dg/tree-ssa/if-to-switch-9.c [avr]: Set case-values-threshold=3. * gcc.dg/tree-ssa/negneg-3.c: Discriminate [not] large_double. * gcc.dg/tree-ssa/phi-opt-25b.c: Use types of correct widths for __builtin_bswapN. * gcc.dg/tree-ssa/pr55177-1.c: Same. * gcc.dg/tree-ssa/popcount-max.c: Use int32_t where required. * gcc.dg/tree-ssa/pr111583-1.c: Use intptr_t as needed. * gcc.dg/tree-ssa/pr111583-2.c: Same. diff --git a/gcc/testsuite/gcc.dg/torture/pr110838.c b/gcc/testsuite/gcc.dg/torture/pr110838.c index f039bd6c8ea..ae2874b6d0d 100644 --- a/gcc/testsuite/gcc.dg/torture/pr110838.c +++ b/gcc/testsuite/gcc.dg/torture/pr110838.c @@ -5,10 +5,12 @@ typedef __UINT8_TYPE__ uint8_t; typedef __INT8_TYPE__ int8_t; typedef uint8_t pixel; +#define MSB (__CHAR_BIT__ * __SIZEOF_INT__ - 1) + /* get the sign of input variable (TODO: this is a dup, make common) */ static inline int8_t signOf(int x) { - return (x >> 31) | ((int)((((uint32_t)-x)) >> 31)); + return (x >> MSB) | ((int)((((uint32_t)-x)) >> MSB)); } __attribute__((noipa)) diff --git a/gcc/testsuite/gcc.dg/torture/pr112282.c b/gcc/testsuite/gcc.dg/torture/pr112282.c index 6190b90cf66..cfe364f9a84 100644 --- a/gcc/testsuite/gcc.dg/torture/pr112282.c +++ b/gcc/testsuite/gcc.dg/torture/pr112282.c @@ -1,5 +1,11 @@ /* { dg-do run } */ +#if __SIZEOF_INT__ < 4 +#define Xint __INT32_TYPE__ +#else +#define Xint int +#endif + int printf(const char *, ...); void abort (); /* We need an abort that isn't noreturn. */ @@ -10,8 +16,8 @@ void __attribute__((noipa)) my_abort () int a, g, h, i, v, w = 2, x, y, ab, ac, ad, ae, af, ag; static int f, j, m, n, p, r, u, aa; struct b { - int c : 20; - int d : 20; + Xint c : 20; + Xint d : 20; int e : 10; }; static struct b l, o, q = {3, 3, 5}; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c index a6be14294b4..8def5ad3cca 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c @@ -6,6 +6,9 @@ of `(a & b) CMP a` and `(a | b) CMP a` which can be optimized to 1. */ +#if __SIZEOF_INT__ < 4 +#define int __INT32_TYPE__ +#endif /* For `&`, the non-negativeness of b is not taken into account. */ int f_and_le(int len) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c index a86a19fbef2..cea377489eb 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c @@ -6,6 +6,10 @@ of `(a & b) CMP a` and `(a | b) CMP a` which can be optimized to 0. */ +#if __SIZEOF_INT__ < 4 +#define int __INT32_TYPE__ +#endif + /* For `&`, the non-negativeness of b is not taken into account. */ int f_and_gt(int len) { len &= 0xfffff; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c b/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c index 1a29ca52e42..7b3599a8a4e 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c @@ -3,6 +3,10 @@ #define PREC (__CHAR_BIT__) +#if __SIZEOF_INT__ < 4 +#define int __INT32_TYPE__ +#endif + int clz_complement_count1 (unsigned char b) { int c = 0; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c b/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c index a6bea3d3389..78b0d017be8 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c @@ -3,6 +3,10 @@ #define PREC (__CHAR_BIT__) +#if __SIZEOF_INT__ < 4 +#define int __INT32_TYPE__ +#endif + int clz_count1 (unsigned char b) { int c = 0; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c index f4d06fed2b6..36cb74b7279 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c @@ -20,7 +20,7 @@ int foo(int a, int b) else if (a == 10) global2 = 12345; else if (a == 1) - global2 = 123456; + global2 = 23456; } } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c index e67198bf8c3..ce6dc341ded 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c @@ -1,6 +1,7 @@ /* PR tree-optimization/88702 */ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-iftoswitch-optimized" } */ +/* { dg-additional-options "--param=case-values-threshold=3" { target { avr-*-* } } } */ int IsHTMLWhitespace(int aChar) { return aChar == 0x0009 || aChar == 0x000A || diff --git a/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c b/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c index 9deb9f6f320..96031454832 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c @@ -12,4 +12,5 @@ DEF(0, unsigned, long long) DEF(1, unsigned, unsigned long long) DEF(2, double, float) -/* { dg-final { scan-tree-dump-times "negate_expr" 6 "optimized"} } */ +/* { dg-final { scan-tree-dump-times "negate_expr" 6 "optimized" { target { large_double } } } } */ +/* { dg-final { scan-tree-dump-times "negate_expr" 4 "optimized" { target { ! large_double } } } } */ diff --git a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c index 0fd9b004a03..2cb4361dc00 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c @@ -5,17 +5,17 @@ /* Test to make sure unrelated arguments and comparisons don't get optimized incorrectly. */ -unsigned short test_bswap16(unsigned short x, unsigned short y) +__UINT16_TYPE__ short test_bswap16(__UINT16_TYPE__ x, __UINT16_TYPE__ y) { return x ? __builtin_bswap16(y) : 0; } -unsigned int test_bswap32(unsigned int x, unsigned int y) +__UINT32_TYPE__ test_bswap32(__UINT32_TYPE__ x, __UINT32_TYPE__ y) { return x ? __builtin_bswap32(y) : 0; } -unsigned long long test_bswap64(unsigned long long x, unsigned long long y) +__UINT64_TYPE__ test_bswap64(__UINT64_TYPE__ x, __UINT64_TYPE__ y) { return x ? __builtin_bswap64(y) : 0; } diff --git a/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c b/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c index ca7204cbc3c..8f012626f50 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c @@ -3,7 +3,7 @@ #define PREC (__CHAR_BIT__) -int count1 (unsigned char b) { +__INT32_TYPE__ count1 (unsigned char b) { int c = 0; while (b) { @@ -16,7 +16,7 @@ int count1 (unsigned char b) { return 34567; } -int count2 (unsigned char b) { +__INT32_TYPE__ count2 (unsigned char b) { int c = 0; while (b) { diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c index 1dd8dbcf1d8..0dda1a72b57 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c @@ -12,7 +12,7 @@ int main() a = 1; for (; a; a++) { { - long b = j, d = h; + __INTPTR_TYPE__ b = j, d = h; int c = 0; while (d--) *(char *)b++ = c; diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c index 0ee21854552..68d28116229 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c @@ -18,7 +18,7 @@ static short m(unsigned k) { const unsigned short *n[65]; g = &n[4]; k || l(); - long a = k; + __INTPTR_TYPE__ a = k; char i = 0; unsigned long j = k; while (j--) diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c index de1a264345c..2630707e061 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c @@ -1,10 +1,10 @@ /* { dg-do compile } */ /* { dg-options "-O2 -fdump-tree-optimized" } */ -extern int x; +extern __INT32_TYPE__ x; void foo(void) { - int a = __builtin_bswap32(x); + __INT32_TYPE__ a = __builtin_bswap32(x); a &= 0x5a5b5c5d; x = __builtin_bswap32(a); }