|
From: <sv...@va...> - 2006-01-27 21:23:27
|
Author: sewardj
Date: 2006-01-27 21:23:23 +0000 (Fri, 27 Jan 2006)
New Revision: 5597
Log:
Track vex r1555 (Change the way Vex represents architecture variants
into something more flexible.)
Modified:
trunk/coregrind/m_machine.c
trunk/coregrind/m_main.c
Modified: trunk/coregrind/m_machine.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_machine.c 2006-01-27 15:11:31 UTC (rev 5596)
+++ trunk/coregrind/m_machine.c 2006-01-27 21:23:23 UTC (rev 5597)
@@ -309,28 +309,29 @@
=20
if (have_sse2 && have_sse1) {
va =3D VexArchX86;
- vai.subarch =3D VexSubArchX86_sse2;
+ vai.hwcaps =3D VEX_HWCAPS_X86_SSE1;
+ vai.hwcaps |=3D VEX_HWCAPS_X86_SSE2;
VG_(machine_x86_have_mxcsr) =3D 1;
return True;
}
=20
if (have_sse1) {
va =3D VexArchX86;
- vai.subarch =3D VexSubArchX86_sse1;
+ vai.hwcaps =3D VEX_HWCAPS_X86_SSE1;
VG_(machine_x86_have_mxcsr) =3D 1;
return True;
}
=20
- va =3D VexArchX86;
- vai.subarch =3D VexSubArchX86_sse0;
+ va =3D VexArchX86;
+ vai.hwcaps =3D 0; /*baseline - no sse at all*/
VG_(machine_x86_have_mxcsr) =3D 0;
return True;
}
=20
#elif defined(VGA_amd64)
vg_assert(VG_(has_cpuid)());
- va =3D VexArchAMD64;
- vai.subarch =3D VexSubArch_NONE;
+ va =3D VexArchAMD64;
+ vai.hwcaps =3D 0; /*baseline - SSE2 */
return True;
=20
#elif defined(VGA_ppc32)
@@ -353,53 +354,71 @@
tmp_act.sa_flags &=3D ~VKI_SA_RESETHAND;
tmp_act.sa_flags &=3D ~VKI_SA_SIGINFO;
=20
+ /* standard FP insns */
+ have_F =3D True;
tmp_act.ksa_handler =3D handler_sigill;
VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
-
- have_fp =3D True;
if (__builtin_setjmp(env_sigill)) {
- have_fp =3D False;
+ have_F =3D False;
} else {
__asm__ __volatile__("fmr 0,0");
}
=20
+ /* Altivec insns */
+ have_V =3D True;
tmp_act.ksa_handler =3D handler_sigill;
VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
-
- have_vmx =3D True;
if (__builtin_setjmp(env_sigill)) {
- have_vmx =3D False;
+ have_V =3D False;
} else {
__asm__ __volatile__("vor 0,0,0");
}
=20
+ /* General-Purpose optional (fsqrt, fsqrts) */
+ have_FX =3D True;
+ tmp_act.ksa_handler =3D handler_sigill;
+ VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ if (__builtin_setjmp(env_sigill)) {
+ have_FX =3D False;
+ } else {
+ __asm__ __volatile__("fsqrt 0,0");
+ }
+
+ /* Graphics optional (stfiwx, fres, frsqrte, fsel) */
+ have_GX =3D True;
+ tmp_act.ksa_handler =3D handler_sigill;
+ VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ if (__builtin_setjmp(env_sigill)) {
+ have_GX =3D False;
+ } else {
+ __asm__ __volatile__("fsqrte 0,0");
+ }
+
VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
=20
- /* VG_(printf)("FP %d VMX %d\n", (Int)have_fp, (Int)have_vmx); */
+ if (0)
+ VG_(printf)("F %d V %d FX %d GX %d\n",=20
+ (Int)have_F, (Int)have_V, (Int)have_FX, (Int)have_GX=
);
=20
- /* We can only support 3 cases, not 4 (vmx but no fp). So make
- fp a prerequisite for vmx. */
- if (have_vmx && !have_fp)
- have_vmx =3D False;
+ /* Make FP a prerequisite for VMX (bogusly so), and for FX and GX. =
*/
+ if (have_V && !have_F)
+ have_V =3D False;
+ if (have_FX && !have_F)
+ have_FX =3D False;
+ if (have_GX && !have_F)
+ have_GX =3D False;
=20
- VG_(machine_ppc32_has_FP) =3D have_fp ? 1 : 0;
- VG_(machine_ppc32_has_VMX) =3D have_vmx ? 1 : 0;
+ VG_(machine_ppc32_has_FP) =3D have_F ? 1 : 0;
+ VG_(machine_ppc32_has_VMX) =3D have_V ? 1 : 0;
=20
va =3D VexArchPPC32;
=20
- if (have_fp =3D=3D False && have_vmx =3D=3D False) {
- vai.subarch =3D VexSubArchPPC32_I;
- }
- else if (have_fp =3D=3D True && have_vmx =3D=3D False) {
- vai.subarch =3D VexSubArchPPC32_FI;
- }
- else if (have_fp =3D=3D True && have_vmx =3D=3D True) {
- vai.subarch =3D VexSubArchPPC32_VFI;
- } else {
- /* this can't happen. */
- vg_assert2(0, "VG_(machine_get_hwcaps)(ppc32)");
- }
+ vai.hwcaps =3D 0;
+ if (have_F) vai.hwcaps |=3D VEX_HWCAPS_PPC32_F;
+ if (have_V) vai.hwcaps |=3D VEX_HWCAPS_PPC32_V;
+ if (have_FX) vai.hwcaps |=3D VEX_HWCAPS_PPC32_FX;
+ if (have_GX) vai.hwcaps |=3D VEX_HWCAPS_PPC32_GX;
=20
/* But we're not done yet: VG_(machine_ppc32_set_clszB) must be
called before we're ready to go. */
@@ -407,10 +426,11 @@
}
=20
#elif defined(VGA_ppc64)
- { vki_sigset_t saved_set, tmp_set;
+ { /* Same idiocy as for ppc32 - arse around with SIGILLs. */
+ vki_sigset_t saved_set, tmp_set;
struct vki_sigaction saved_act, tmp_act;
=20
- volatile Bool have_vmx;
+ volatile Bool have_fp, have_vmx;
=20
VG_(sigemptyset)(&tmp_set);
VG_(sigaddset)(&tmp_set, VKI_SIGILL);
@@ -423,26 +443,66 @@
tmp_act.sa_flags &=3D ~VKI_SA_RESETHAND;
tmp_act.sa_flags &=3D ~VKI_SA_SIGINFO;
=20
+ /* standard FP insns */
+ have_F =3D True;
tmp_act.ksa_handler =3D handler_sigill;
VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ if (__builtin_setjmp(env_sigill)) {
+ have_F =3D False;
+ } else {
+ __asm__ __volatile__("fmr 0,0");
+ }
=20
- have_vmx =3D True;
+ /* Altivec insns */
+ have_V =3D True;
+ tmp_act.ksa_handler =3D handler_sigill;
+ VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
if (__builtin_setjmp(env_sigill)) {
- have_vmx =3D False;
+ have_V =3D False;
} else {
__asm__ __volatile__("vor 0,0,0");
}
=20
+ /* General-Purpose optional (fsqrt, fsqrts) */
+ have_FX =3D True;
+ tmp_act.ksa_handler =3D handler_sigill;
+ VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ if (__builtin_setjmp(env_sigill)) {
+ have_FX =3D False;
+ } else {
+ __asm__ __volatile__("fsqrt 0,0");
+ }
+
+ /* Graphics optional (stfiwx, fres, frsqrte, fsel) */
+ have_GX =3D True;
+ tmp_act.ksa_handler =3D handler_sigill;
+ VG_(sigaction)(VKI_SIGILL, &tmp_act, NULL);
+ if (__builtin_setjmp(env_sigill)) {
+ have_GX =3D False;
+ } else {
+ __asm__ __volatile__("fsqrte 0,0");
+ }
+
VG_(sigaction)(VKI_SIGILL, &saved_act, NULL);
VG_(sigprocmask)(VKI_SIG_SETMASK, &saved_set, NULL);
=20
- /* VG_(printf)("VMX %d\n", (Int)have_vmx); */
+ if (0)
+ VG_(printf)("F %d V %d FX %d GX %d\n",=20
+ (Int)have_F, (Int)have_V, (Int)have_FX, (Int)have_GX=
);
=20
- VG_(machine_ppc64_has_VMX) =3D have_vmx ? 1 : 0;
+ /* on ppc64, if we don't even have FP, just give up. */
+ if (!have_F)
+ return False;
=20
+ VG_(machine_ppc64_has_VMX) =3D have_V ? 1 : 0;
+
va =3D VexArchPPC64;
- vai.subarch =3D have_vmx ? VexSubArchPPC64_VFI : VexSubArchPPC64_FI=
;
=20
+ vai.hwcaps =3D 0;
+ if (have_V) vai.hwcaps |=3D VEX_HWCAPS_PPC64_V;
+ if (have_FX) vai.hwcaps |=3D VEX_HWCAPS_PPC64_FX;
+ if (have_GX) vai.hwcaps |=3D VEX_HWCAPS_PPC64_GX;
+
/* But we're not done yet: VG_(machine_ppc64_set_clszB) must be
called before we're ready to go. */
return True;
Modified: trunk/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_main.c 2006-01-27 15:11:31 UTC (rev 5596)
+++ trunk/coregrind/m_main.c 2006-01-27 21:23:23 UTC (rev 5597)
@@ -1646,9 +1646,12 @@
}
=20
VG_(machine_get_VexArchInfo)( &vex_arch, &vex_archinfo );
- VG_(message)(Vg_DebugMsg, "Arch and subarch: %s, %s",
- LibVEX_ppVexArch ( vex_arch ),
- LibVEX_ppVexSubArch( vex_archinfo.subarc=
h ) );
+ VG_(message)(
+ Vg_DebugMsg,=20
+ "Arch and hwcaps: %s, %s",
+ LibVEX_ppVexArch ( vex_arch ),
+ LibVEX_ppVexHwCaps ( vex_arch, vex_archinfo.hwcaps )
+ );
VG_(message)(Vg_DebugMsg, "Valgrind library directory: %s", VG_(li=
bdir));
}
}
@@ -2080,9 +2083,11 @@
VG_(exit)(1);
}
VG_(machine_get_VexArchInfo)( &vex_arch, &vex_archinfo );
- VG_(debugLog)(1, "main", "... arch =3D %s, subarch =3D %s\n",
- LibVEX_ppVexArch ( vex_arch ),
- LibVEX_ppVexSubArch( vex_archinfo.subarch ) );
+ VG_(debugLog)(
+ 1, "main", "... arch =3D %s, hwcaps =3D %s\n",
+ LibVEX_ppVexArch ( vex_arch ),
+ LibVEX_ppVexHwCaps ( vex_arch, vex_archinfo.hwcaps )=20
+ );
}
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
|