Replace __popcntq with two _popcnt32.
authorKirill Yukhin <kirill.yukhin@gmail.com>
Fri, 1 Dec 2017 06:25:26 +0000 (06:25 +0000)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Fri, 1 Dec 2017 06:25:26 +0000 (06:25 +0000)
gcc/testsuite/
* gcc.target/i386/avx512f-vpcompressb-2.c: Fix popcnt for 64b case.

From-SVN: r255292

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512f-vpcompressb-2.c

index 74211182335de3049e332d061bb824a5acac8293..66ca1d2d315d36878d8482b2414c44d0bd930d54 100644 (file)
@@ -1,3 +1,7 @@
+2016-11-17  Kirill Yukhin  <kirill.yukhin@gmail.com>
+
+       * gcc.target/i386/avx512f-vpcompressb-2.c: Fix popcnt for 32-bit mode.
+
 2017-12-01  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/83222
index bd1fb451413c3ec9c3701eff848f611ffd34bb13..4f159630504f899591033e41bcaf040202605bd6 100644 (file)
@@ -4,7 +4,7 @@
 /* { dg-require-effective-target avx512vbmi2 } */
 
 #define AVX512F
-
+#include <stdio.h>
 #define AVX512VBMI2
 #include "avx512f-helper.h"
 
@@ -47,7 +47,8 @@ TEST (void)
 
   // Swt
   if (AVX512F_LEN == 512)
-    mask_bit_count = __popcntq(mask);
+    mask_bit_count = _popcnt32((int)(mask & (((long long)1 << 32) - 1)))
+                    + _popcnt32((int)((long long)mask >> 32));
   else
     mask_bit_count = __popcntd(mask);
   compressed_mask = ((long long)1 << mask_bit_count) - 1;