mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 17:02:25 +00:00
Check for POPCNT instruction
This commit is contained in:
parent
210e67d831
commit
ec894e7cb3
@ -127,9 +127,10 @@ enum class InstructionFail
|
||||
SSSE3 = 2,
|
||||
SSE4_1 = 3,
|
||||
SSE4_2 = 4,
|
||||
AVX = 5,
|
||||
AVX2 = 6,
|
||||
AVX512 = 7
|
||||
POPCNT = 5,
|
||||
AVX = 6,
|
||||
AVX2 = 7,
|
||||
AVX512 = 8
|
||||
};
|
||||
|
||||
const char * instructionFailToString(InstructionFail fail)
|
||||
@ -146,6 +147,8 @@ const char * instructionFailToString(InstructionFail fail)
|
||||
return "SSE4.1";
|
||||
case InstructionFail::SSE4_2:
|
||||
return "SSE4.2";
|
||||
case InstructionFail::POPCNT:
|
||||
return "POPCNT";
|
||||
case InstructionFail::AVX:
|
||||
return "AVX";
|
||||
case InstructionFail::AVX2:
|
||||
@ -189,6 +192,16 @@ void checkRequiredInstructionsImpl(volatile InstructionFail & fail)
|
||||
__asm__ volatile ("pcmpgtq %%xmm0, %%xmm0" : : : "xmm0");
|
||||
#endif
|
||||
|
||||
/// Defined by -msse4.2
|
||||
#if defined(__POPCNT__)
|
||||
fail = InstructionFail::POPCNT;
|
||||
{
|
||||
uint64_t a = 0;
|
||||
uint64_t b = 0;
|
||||
__asm__ volatile ("popcnt %1, %0" : "=r"(a) :"r"(b) : );
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__AVX__)
|
||||
fail = InstructionFail::AVX;
|
||||
__asm__ volatile ("vaddpd %%ymm0, %%ymm0, %%ymm0" : : : "ymm0");
|
||||
|
@ -1,4 +1,5 @@
|
||||
Instruction check fail. The CPU does not support SSSE3 instruction set.
|
||||
Instruction check fail. The CPU does not support SSE4.1 instruction set.
|
||||
Instruction check fail. The CPU does not support SSE4.2 instruction set.
|
||||
Instruction check fail. The CPU does not support POPCNT instruction set.
|
||||
1
|
||||
|
@ -9,8 +9,13 @@ ${CLICKHOUSE_LOCAL} --query "SELECT max(value LIKE '%sanitize%') FROM system.bui
|
||||
|
||||
command=$(command -v ${CLICKHOUSE_LOCAL})
|
||||
|
||||
qemu-x86_64-static -cpu qemu64 $command --query "SELECT 1" 2>&1 | grep -v -F "warning: TCG doesn't support requested feature" ||:
|
||||
qemu-x86_64-static -cpu qemu64,+ssse3 $command --query "SELECT 1" 2>&1 | grep -v -F "warning: TCG doesn't support requested feature" ||:
|
||||
qemu-x86_64-static -cpu qemu64,+ssse3,+sse4.1 $command --query "SELECT 1" 2>&1 | grep -v -F "warning: TCG doesn't support requested feature" ||:
|
||||
qemu-x86_64-static -cpu qemu64,+ssse3,+sse4.1,+sse4.2 $command --query "SELECT 1" 2>&1 | grep -v -F "warning: TCG doesn't support requested feature" ||:
|
||||
function run_with_cpu()
|
||||
{
|
||||
qemu-x86_64-static -cpu "$@" $command --query "SELECT 1" 2>&1 | grep -v -F "warning: TCG doesn't support requested feature" ||:
|
||||
}
|
||||
|
||||
run_with_cpu qemu64
|
||||
run_with_cpu qemu64,+ssse3
|
||||
run_with_cpu qemu64,+ssse3,+sse4.1
|
||||
run_with_cpu qemu64,+ssse3,+sse4.1,+sse4.2
|
||||
run_with_cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt
|
||||
|
Loading…
Reference in New Issue
Block a user