bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Warnings in count-one-bits.h


From: Gisle Vanem
Subject: Warnings in count-one-bits.h
Date: Tue, 26 May 2020 14:35:29 +0200
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0


The lines in count-one-bits.h:
#  pragma intrinsic __cpuid
#  pragma intrinsic __popcnt
#  pragma intrinsic __popcnt64

triggers these warnings:
  count-one-bits.h(79): warning C4083: expected '('; found identifier '__cpuid'
  count-one-bits.h(80): warning C4083: expected '('; found identifier '__popcnt'
  count-one-bits.h(81): warning C4083: expected '('; found identifier 
'__popcnt64'

But the above can be written as:
  #  pragma intrinsic (__cpuid, __popcnt)
  #  ifdef _WIN64
  #  pragma intrinsic (__popcnt64)
  #  endif

Since on MSVC-2019/x86, I get:
 warning C4163: '__popcnt64': not available as an intrinsic function

It seems '__popcnt64' is an intrinsic on x64 only:
 
https://docs.microsoft.com/en-us/cpp/intrinsics/popcnt16-popcnt-popcnt64?view=vs-2019

PS. Using clang-cl compiling the same file:
  ./count-one-bits.h(79,22): warning: '__cpuid' is not a recognized builtin;
  consider including <intrin.h> to access non-builtin intrinsics
  [-Wignored-pragma-intrinsic]
  #  pragma intrinsic (__cpuid, __popcnt)
                       ^

--
--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]