]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
testsuite/52641: Fix fallout from sloppy tests.
authorGeorg-Johann Lay <avr@gjlay.de>
Sun, 7 Jan 2024 15:53:21 +0000 (16:53 +0100)
committerGeorg-Johann Lay <avr@gjlay.de>
Sun, 7 Jan 2024 15:53:21 +0000 (16:53 +0100)
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.

14 files changed:
gcc/testsuite/gcc.dg/torture/pr110838.c
gcc/testsuite/gcc.dg/torture/pr112282.c
gcc/testsuite/gcc.dg/tree-ssa/bitcmp-5.c
gcc/testsuite/gcc.dg/tree-ssa/bitcmp-6.c
gcc/testsuite/gcc.dg/tree-ssa/cltz-complement-max.c
gcc/testsuite/gcc.dg/tree-ssa/cltz-max.c
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-8.c
gcc/testsuite/gcc.dg/tree-ssa/if-to-switch-9.c
gcc/testsuite/gcc.dg/tree-ssa/negneg-3.c
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-25b.c
gcc/testsuite/gcc.dg/tree-ssa/popcount-max.c
gcc/testsuite/gcc.dg/tree-ssa/pr111583-1.c
gcc/testsuite/gcc.dg/tree-ssa/pr111583-2.c
gcc/testsuite/gcc.dg/tree-ssa/pr55177-1.c

index f039bd6c8ea28d20e98418b694ba1da225c0d5fe..ae2874b6d0d9dee023861da245e0524eec645ae7 100644 (file)
@@ -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))
index 6190b90cf66fdf4cad6f49cc2c0aa0cbb13abdb1..cfe364f9a8417c3ca89c5c2387a64b42af3fee27 100644 (file)
@@ -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};
index a6be14294b4e316b81a7ca2ce2facdb3d7a03df7..8def5ad3cca4c7ed9945485fefea2017a3780b54 100644 (file)
@@ -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) {
index a86a19fbef2a2edc90d00571c7bfcdab88ef3e8c..cea377489eb3a8c59b3a75d309042917855f44fa 100644 (file)
@@ -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;
index 1a29ca52e42e50822e4e3213b2cb008b766d0318..7b3599a8a4e7074e8dcac848e77c2d6ce04cc36a 100644 (file)
@@ -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;
 
index a6bea3d338940efee2e7e1c95a5941525945af9e..78b0d017be8e5e368560484987ae31d104c77109 100644 (file)
@@ -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;
 
index f4d06fed2b6a30b4de6a8052288c84855b2a4cd8..36cb74b7279481aea203fd7bb0f97983ce3a197a 100644 (file)
@@ -20,7 +20,7 @@ int foo(int a, int b)
     else if (a == 10)
       global2 = 12345;
     else if (a == 1)
-      global2 = 123456;
+      global2 = 23456;
   }
 }
 
index e67198bf8c38256a4db6cda880518e55ecc2edc7..ce6dc341deda57502bfb4179e20de5c43f6652c2 100644 (file)
@@ -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 ||              
index 9deb9f6f3201eb43bee0a9eda369778879abf885..960314548320ae93a405ecd17e859b6572810c52 100644 (file)
@@ -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 } } } } */
index 0fd9b004a038cb7ab4aa85ee6319fc40a89a64ef..2cb4361dc0010ca39d8e394de4dc812cbcda38f3 100644 (file)
@@ -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;
 }
index ca7204cbc3cea636183408e24d7dd36d702ffdb2..8f012626f5001491b00e5588cf57aad026634b2a 100644 (file)
@@ -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) {
index 1dd8dbcf1d81a37b30f4246a715220a50f1b577f..0dda1a72b5764fa433fa32da474c2770aff8a170 100644 (file)
@@ -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;
index 0ee218545526af0f216cbb811baef7b4fe85aa5e..68d28116229dc30a2cd0e9b459c2c5e0561d9a38 100644 (file)
@@ -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--)
index de1a264345cdd854dcd5e9253ccb703787e89259..2630707e061d2deda05a68051a79797ea8846858 100644 (file)
@@ -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);
 }