public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] testsuite/i386: Fix XOP and FMA4 checking functions [PR98036].
@ 2020-11-27 17:44 Uros Bizjak
  0 siblings, 0 replies; only message in thread
From: Uros Bizjak @ 2020-11-27 17:44 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 2139 bytes --]

Add missing returns and remove unnecessary postfix increments.

2020-11-27  Uroš Bizjak  <ubizjak@gmail.com>

    PR testsuite/98036

gcc/testsuite/
    * gcc.target/i386/fma4-256-maccXX.c (check_maccps):
    Remove unnecessary postfix increment on a returned variable.
    (check_maccpd): Ditto.
    * gcc.target/i386/fma4-256-msubXX.c (check_msubps): Ditto.
    (check_msubpd): Ditto.
    * gcc.target/i386/fma4-256-nmaccXX.c (check_nmaccps): Ditto.
    (check_nmaccpd): Ditto.
    * gcc.target/i386/fma4-256-nmsubXX.c (check_nmsubps): Ditto.
    (check_nmsubpd): Ditto.
    * gcc.target/i386/fma4-maccXX.c (check_maccps): Ditto.
    (check_maccpd): Ditto.
    (check_maccss): Ditto.
    (check_maccsd): Ditto.
    * gcc.target/i386/fma4-msubXX.c (check_msubps): Ditto.
    (check_msubpd): Ditto.
    (check_msubss): Ditto.
    (check_msubsd): Ditto.
    * gcc.target/i386/fma4-nmaccXX.c (check_nmaccps): Ditto.
    (check_nmaccpd): Ditto.
    (check_nmaccss): Ditto.
    (check_nmaccsd): Ditto.
    * gcc.target/i386/fma4-nmsubXX.c (check_nmsubps): Ditto.
    (check_nmsubpd): Ditto.
    (check_nmsubss): Ditto.
    (check_nmsubsd): Ditto.
    * gcc.target/i386/xop-haddX.c (check_sbyte2word): Add missing return.
    (check_sbyte2dword):
    Remove unnecessary postfix increment on a returned value.
    (check_sbyte2qword): Ditto.
    (check_sword2dword): Add missing return.
    (check_sword2qword):
    Remove unnecessary postfix increment on a returned value.
    (check_dword2qword): Add missing return.
    * gcc.target/i386/xop-hadduX.c (check_byte2word): Add missing return.
    (check_byte2dword):
    Remove unnecessary postfix increment on a returned value.
    (check_byte2qword): Ditto.
    (check_word2dword): Add missing return.
    (check_word2qword):
    Remove unnecessary postfix increment on a returned value.
    (check_word2qword): Add missing return.
    * gcc.target/i386/xop-hsubX.c (check_sbyte2word): Add missing return.
    (check_sword2dword): Ditto.
    (check_sword2qword): Ditto.

Tested on x86_64-linux-gnu {,-m32}.

Pushed to mainline.

Uros.

[-- Attachment #2: t.diff.txt --]
[-- Type: text/plain, Size: 13955 bytes --]

diff --git a/gcc/testsuite/gcc.target/i386/fma4-256-maccXX.c b/gcc/testsuite/gcc.target/i386/fma4-256-maccXX.c
index 134200af72a..ee0ddf171f4 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-256-maccXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-256-maccXX.c
@@ -17,7 +17,6 @@ union
   double d[NUM * 4];
 } dst, res, src1, src2, src3;
 
-
 /* Note that in macc*,msub*,mnmacc* and mnsub* instructions, the intermdediate 
    product is not rounded, only the addition is rounded. */
 
@@ -56,7 +55,7 @@ check_maccps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -70,7 +69,7 @@ check_maccpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
diff --git a/gcc/testsuite/gcc.target/i386/fma4-256-msubXX.c b/gcc/testsuite/gcc.target/i386/fma4-256-msubXX.c
index d6cafb4d542..0251eb2bce9 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-256-msubXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-256-msubXX.c
@@ -55,7 +55,7 @@ check_msubps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -69,7 +69,7 @@ check_msubpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
@@ -92,5 +92,4 @@ fma4_test (void)
   
   if (check_msubpd ()) 
     abort ();
-  
 }
diff --git a/gcc/testsuite/gcc.target/i386/fma4-256-nmaccXX.c b/gcc/testsuite/gcc.target/i386/fma4-256-nmaccXX.c
index 261f302f2f7..d9671f3da43 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-256-nmaccXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-256-nmaccXX.c
@@ -55,7 +55,7 @@ check_nmaccps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -69,7 +69,7 @@ check_nmaccpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
@@ -92,5 +92,4 @@ fma4_test (void)
   
   if (check_nmaccpd ()) 
     abort ();
-
 }
diff --git a/gcc/testsuite/gcc.target/i386/fma4-256-nmsubXX.c b/gcc/testsuite/gcc.target/i386/fma4-256-nmsubXX.c
index ccbdf0e9d6f..385cd950b97 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-256-nmsubXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-256-nmsubXX.c
@@ -55,7 +55,7 @@ check_nmsubps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -69,7 +69,7 @@ check_nmsubpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
@@ -92,5 +92,4 @@ fma4_test (void)
   
   if (check_nmsubpd (&dst.y[i], &src1.d[i * 2], &src2.d[i * 2], &src3.d[i * 2])) 
     abort ();
-
 }
diff --git a/gcc/testsuite/gcc.target/i386/fma4-maccXX.c b/gcc/testsuite/gcc.target/i386/fma4-maccXX.c
index 4b4c00596a7..d401d4ed413 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-maccXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-maccXX.c
@@ -17,7 +17,6 @@ union
   double d[NUM * 2];
 } dst, res, src1, src2, src3;
 
-
 /* Note that in macc*,msub*,mnmacc* and mnsub* instructions, the intermdediate 
    product is not rounded, only the addition is rounded. */
 
@@ -56,7 +55,7 @@ check_maccps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -70,7 +69,7 @@ check_maccpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 
@@ -84,7 +83,7 @@ check_maccss ()
       if (dst.f[i] != res.f[i]) 
 	check_fails++;
     }	
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -97,7 +96,7 @@ check_maccsd ()
       if (dst.d[i] != res.d[i]) 
 	check_fails++;
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
@@ -132,5 +131,4 @@ fma4_test (void)
   
   if (check_maccsd ()) 
     abort ();
-
 }
diff --git a/gcc/testsuite/gcc.target/i386/fma4-msubXX.c b/gcc/testsuite/gcc.target/i386/fma4-msubXX.c
index eed75580e8d..192cb5d624c 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-msubXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-msubXX.c
@@ -55,7 +55,7 @@ check_msubps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -69,10 +69,9 @@ check_msubpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
-
 static int
 check_msubss ()
 {
@@ -83,7 +82,7 @@ check_msubss ()
       if (dst.f[i] != res.f[i]) 
 	check_fails++;
     }	
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -96,7 +95,7 @@ check_msubsd ()
       if (dst.d[i] != res.d[i]) 
 	check_fails++;
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
diff --git a/gcc/testsuite/gcc.target/i386/fma4-nmaccXX.c b/gcc/testsuite/gcc.target/i386/fma4-nmaccXX.c
index 9abf7460477..7a89fb0820c 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-nmaccXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-nmaccXX.c
@@ -55,7 +55,7 @@ check_nmaccps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -69,10 +69,9 @@ check_nmaccpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
-
 static int
 check_nmaccss ()
 {
@@ -83,7 +82,7 @@ check_nmaccss ()
       if (dst.f[i] != res.f[i]) 
 	check_fails++;
     }	
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -96,7 +95,7 @@ check_nmaccsd ()
       if (dst.d[i] != res.d[i]) 
 	check_fails++;
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
@@ -112,7 +111,6 @@ fma4_test (void)
   if (check_nmaccps ()) 
     abort ();
   
-
   for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_nmacc_ss (src1.x[i], src2.x[i], src3.x[i]);
   
@@ -126,12 +124,10 @@ fma4_test (void)
   
   if (check_nmaccpd ()) 
     abort ();
-  
 
   for (i = 0; i < NUM; i++)
     dst.y[i] = _mm_nmacc_sd (src1.y[i], src2.y[i], src3.y[i]);
   
   if (check_nmaccsd ()) 
     abort ();
-
 }
diff --git a/gcc/testsuite/gcc.target/i386/fma4-nmsubXX.c b/gcc/testsuite/gcc.target/i386/fma4-nmsubXX.c
index 85fbecddb3d..c0bce417e11 100644
--- a/gcc/testsuite/gcc.target/i386/fma4-nmsubXX.c
+++ b/gcc/testsuite/gcc.target/i386/fma4-nmsubXX.c
@@ -55,7 +55,7 @@ check_nmsubps ()
 	if (dst.f[i + j] != res.f[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -69,10 +69,9 @@ check_nmsubpd ()
 	if (dst.d[i + j] != res.d[i + j]) 
 	  check_fails++;
       }
-  return check_fails++;
+  return check_fails;
 }
 
-
 static int
 check_nmsubss ()
 {
@@ -83,7 +82,7 @@ check_nmsubss ()
       if (dst.f[i] != res.f[i]) 
 	check_fails++;
     }	
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -96,7 +95,7 @@ check_nmsubsd ()
       if (dst.d[i] != res.d[i]) 
 	check_fails++;
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static void
@@ -111,7 +110,6 @@ fma4_test (void)
   
   if (check_nmsubps (&dst.x[i], &src1.f[i * 4], &src2.f[i * 4], &src3.f[i * 4])) 
     abort ();
-  
 
   for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_nmsub_ss (src1.x[i], src2.x[i], src3.x[i]);
@@ -126,12 +124,10 @@ fma4_test (void)
   
   if (check_nmsubpd (&dst.y[i], &src1.d[i * 2], &src2.d[i * 2], &src3.d[i * 2])) 
     abort ();
-  
 
   for (i = 0; i < NUM; i++)
     dst.y[i] = _mm_nmsub_sd (src1.y[i], src2.y[i], src3.y[i]);
   
   if (check_nmsubsd (&dst.y[i], &src1.d[i * 2], &src2.d[i * 2], &src3.d[i * 2])) 
     abort ();
-
 }
diff --git a/gcc/testsuite/gcc.target/i386/xop-haddX.c b/gcc/testsuite/gcc.target/i386/xop-haddX.c
index 7d3220baffe..68f27528c23 100644
--- a/gcc/testsuite/gcc.target/i386/xop-haddX.c
+++ b/gcc/testsuite/gcc.target/i386/xop-haddX.c
@@ -34,7 +34,6 @@ init_sword ()
     src1.si[i] = i;
 }
 
-
 static void
 init_sdword ()
 {
@@ -58,6 +57,7 @@ check_sbyte2word ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static int 
@@ -76,7 +76,7 @@ check_sbyte2dword ()
 	    check_fails++;
 	}
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -96,14 +96,14 @@ check_sbyte2qword ()
 	    check_fails++;
 	}
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
 check_sword2dword ()
 {
   int i, j, s, t, check_fails = 0;
-  for (i = 0; i < (NUM * 8); i = i + 8)
+  for (i = 0; i < NUM * 8; i = i + 8)
     {
       for (j = 0; j < 4; j++)
 	{
@@ -114,6 +114,7 @@ check_sword2dword ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static int 
@@ -132,14 +133,14 @@ check_sword2qword ()
 	    check_fails++;
 	}
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
 check_dword2qword ()
 {
   int i, j, s, t, check_fails = 0;
-  for (i = 0; i < (NUM * 4); i = i + 4)
+  for (i = 0; i < NUM * 4; i = i + 4)
     {
       for (j = 0; j < 2; j++)
 	{
@@ -150,6 +151,7 @@ check_dword2qword ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static void
@@ -163,15 +165,13 @@ xop_test (void)
     dst.x[i] = _mm_haddw_epi8 (src1.x[i]);
   
   if (check_sbyte2word())
-  abort ();
-  
+    abort ();
 
-  for (i = 0; i < (NUM ); i++)
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddd_epi8 (src1.x[i]);
   
   if (check_sbyte2dword())
     abort (); 
-  
 
   for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddq_epi8 (src1.x[i]);
@@ -179,10 +179,9 @@ xop_test (void)
   if (check_sbyte2qword())
     abort ();
 
-
   init_sword ();
 
-  for (i = 0; i < (NUM ); i++)
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddd_epi16 (src1.x[i]);
   
   if (check_sword2dword())
@@ -193,14 +192,12 @@ xop_test (void)
   
   if (check_sword2qword())
     abort ();
- 
 
   init_sdword ();
 
-    for (i = 0; i < NUM; i++)
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddq_epi32 (src1.x[i]);
   
   if (check_dword2qword())
     abort ();
-
 }
diff --git a/gcc/testsuite/gcc.target/i386/xop-hadduX.c b/gcc/testsuite/gcc.target/i386/xop-hadduX.c
index 9c7ea9a2a60..06a4a2ec6df 100644
--- a/gcc/testsuite/gcc.target/i386/xop-hadduX.c
+++ b/gcc/testsuite/gcc.target/i386/xop-hadduX.c
@@ -34,7 +34,6 @@ init_word ()
     src1.si[i] = i;
 }
 
-
 static void
 init_dword ()
 {
@@ -58,6 +57,7 @@ check_byte2word ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static int 
@@ -76,7 +76,7 @@ check_byte2dword ()
 	    check_fails++;
 	}
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
@@ -96,14 +96,14 @@ check_byte2qword ()
 	    check_fails++;
 	}
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
 check_word2dword ()
 {
   int i, j, s, t, check_fails = 0;
-  for (i = 0; i < (NUM * 8); i = i + 8)
+  for (i = 0; i < NUM * 8; i = i + 8)
     {
       for (j = 0; j < 4; j++)
 	{
@@ -114,6 +114,7 @@ check_word2dword ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static int 
@@ -132,14 +133,14 @@ check_word2qword ()
 	    check_fails++;
 	}
     }
-  return check_fails++;
+  return check_fails;
 }
 
 static int
 check_dword2qword ()
 {
   int i, j, s, t, check_fails = 0;
-  for (i = 0; i < (NUM * 4); i = i + 4)
+  for (i = 0; i < NUM * 4; i = i + 4)
     {
       for (j = 0; j < 2; j++)
 	{
@@ -150,6 +151,7 @@ check_dword2qword ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static void
@@ -167,7 +169,7 @@ xop_test (void)
   abort ();
   
   /* Check haddubd */
-  for (i = 0; i < (NUM ); i++)
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddd_epu8 (src1.x[i]);
   
   if (check_byte2dword())
@@ -183,14 +185,13 @@ xop_test (void)
   /* Check hadduwd */
   init_word ();
 
-  for (i = 0; i < (NUM ); i++)
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddd_epu16 (src1.x[i]);
   
   if (check_word2dword())
     abort (); 
    
   /* Check haddbuwq */
- 
   for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddq_epu16 (src1.x[i]);
   
@@ -199,7 +200,8 @@ xop_test (void)
  
   /* Check hadudq */
   init_dword ();
-    for (i = 0; i < NUM; i++)
+  
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_haddq_epu32 (src1.x[i]);
   
   if (check_dword2qword())
diff --git a/gcc/testsuite/gcc.target/i386/xop-hsubX.c b/gcc/testsuite/gcc.target/i386/xop-hsubX.c
index f0fa9b312f2..e4c4373805f 100644
--- a/gcc/testsuite/gcc.target/i386/xop-hsubX.c
+++ b/gcc/testsuite/gcc.target/i386/xop-hsubX.c
@@ -34,7 +34,6 @@ init_sword ()
     src1.si[i] = i;
 }
 
-
 static void
 init_sdword ()
 {
@@ -58,13 +57,14 @@ check_sbyte2word ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static int
 check_sword2dword ()
 {
   int i, j, s, t, check_fails = 0;
-  for (i = 0; i < (NUM * 8); i = i + 8)
+  for (i = 0; i < NUM * 8; i = i + 8)
     {
       for (j = 0; j < 4; j++)
 	{
@@ -75,13 +75,14 @@ check_sword2dword ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static int
 check_dword2qword ()
 {
   int i, j, s, t, check_fails = 0;
-  for (i = 0; i < (NUM * 4); i = i + 4)
+  for (i = 0; i < NUM * 4; i = i + 4)
     {
       for (j = 0; j < 2; j++)
 	{
@@ -92,6 +93,7 @@ check_dword2qword ()
 	    check_fails++;	
 	}
     }
+  return check_fails;
 }
 
 static void
@@ -106,13 +108,12 @@ xop_test (void)
     dst.x[i] = _mm_hsubw_epi8 (src1.x[i]);
   
   if (check_sbyte2word())
-  abort ();
-  
+    abort ();
 
   /* Check hsubwd */
   init_sword ();
 
-  for (i = 0; i < (NUM ); i++)
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_hsubd_epi16 (src1.x[i]);
   
   if (check_sword2dword())
@@ -120,7 +121,8 @@ xop_test (void)
    
    /* Check hsubdq */
   init_sdword ();
-    for (i = 0; i < NUM; i++)
+
+  for (i = 0; i < NUM; i++)
     dst.x[i] = _mm_hsubq_epi32 (src1.x[i]);
   
   if (check_dword2qword())

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-27 17:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-27 17:44 [PATCH] testsuite/i386: Fix XOP and FMA4 checking functions [PR98036] Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).