Skip to content

Commit b3d403b

Browse files
author
florian
committed
Detect presence of sse3 instructions on x86.
Set VEX_HWCAPS_X86_SSE3 accordingly. This came about by grepping the source for VEX_HWCAPS_X86_SSE3 and observing that the flag was tested for (in VEX) but not set. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14803 a5019735-40e9-0310-863c-91ae7b9d1cf9
1 parent 0cd3559 commit b3d403b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

coregrind/m_machine.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ Bool VG_(machine_get_hwcaps)( void )
713713
LibVEX_default_VexArchInfo(&vai);
714714

715715
#if defined(VGA_x86)
716-
{ Bool have_sse1, have_sse2, have_cx8, have_lzcnt, have_mmxext;
716+
{ Bool have_sse1, have_sse2, have_sse3, have_cx8, have_lzcnt, have_mmxext;
717717
UInt eax, ebx, ecx, edx, max_extended;
718718
HChar vstr[13];
719719
vstr[0] = 0;
@@ -742,6 +742,7 @@ Bool VG_(machine_get_hwcaps)( void )
742742

743743
have_sse1 = (edx & (1<<25)) != 0; /* True => have sse insns */
744744
have_sse2 = (edx & (1<<26)) != 0; /* True => have sse2 insns */
745+
have_sse3 = (ecx & (1<<0)) != 0; /* True => have sse3 insns */
745746

746747
/* cmpxchg8b is a minimum requirement now; if we don't have it we
747748
must simply give up. But all CPUs since Pentium-I have it, so
@@ -775,7 +776,16 @@ Bool VG_(machine_get_hwcaps)( void )
775776

776777
va = VexArchX86;
777778
vai.endness = VexEndnessLE;
778-
if (have_sse2 && have_sse1 && have_mmxext) {
779+
780+
if (have_sse3 && have_sse2 && have_sse1 && have_mmxext) {
781+
vai.hwcaps = VEX_HWCAPS_X86_MMXEXT;
782+
vai.hwcaps |= VEX_HWCAPS_X86_SSE1;
783+
vai.hwcaps |= VEX_HWCAPS_X86_SSE2;
784+
vai.hwcaps |= VEX_HWCAPS_X86_SSE3;
785+
if (have_lzcnt)
786+
vai.hwcaps |= VEX_HWCAPS_X86_LZCNT;
787+
VG_(machine_x86_have_mxcsr) = 1;
788+
} else if (have_sse2 && have_sse1 && have_mmxext) {
779789
vai.hwcaps = VEX_HWCAPS_X86_MMXEXT;
780790
vai.hwcaps |= VEX_HWCAPS_X86_SSE1;
781791
vai.hwcaps |= VEX_HWCAPS_X86_SSE2;

0 commit comments

Comments
 (0)