/* set host AltiVec control word to the default mode expected
by VEX-generated code. */
- vsubuwm 3,3,3 /* generate zero */
+ lis 3,VG_(have_altivec)@ha
+ lwz 3,VG_(have_altivec)@l(3)
+ cmplwi 3,0
+ beq L1
+ /* generate vector {0x0,0x0,0x0,0x00010000} */
+ vspltisw 3,0x1 /* 4x 0x00000001 */
+ vspltisw 4,0x0 /* generate zero */
+ vsldoi 3,4,3,0x6 /* v3 = v3 >> 10 bytes */
mtvscr 3
-
+L1:
/* make a stack frame for the code we are calling */
stwu 1,-16(1)
//////////////////////////////////////////////////////////////////
// Architecture specifics
+#if defined(VGA_ppc32)
// PPC: what is the cache line size (for dcbz etc) ? This info is
// harvested on Linux at startup from the AT_SYSINFO entries. 0 means
// not-yet-set.
-#if defined(VGA_ppc32)
Int VG_(cache_line_size_ppc32) = 0;
+// Altivec enabled? Harvested on startup from the AT_HWCAP entry
+Int VG_(have_altivec) = 0;
#endif
// X86: set to 1 if the host is able to do {ld,st}mxcsr (load/store
break;
case AT_HWCAP:
- VG_(debugLog)(1, "main", "PPC32 hwcaps(1): 0x%x\n", (UInt)auxv->u.a_val);
- auxv->u.a_val &= ~0x10000000; /* claim there is no Altivec support */
- VG_(debugLog)(1, "main", "PPC32 hwcaps(2): 0x%x\n", (UInt)auxv->u.a_val);
+ VG_(debugLog)(1, "main", "PPC32 hwcaps: 0x%x\n", (UInt)auxv->u.a_val);
+ if ((auxv->u.a_val & 0x10000000) > 0)
+ VG_(have_altivec) = 1;
+ VG_(debugLog)(1, "main", "PPC32 AltiVec support: %u\n", VG_(have_altivec));
break;
# endif
#include "pub_core_aspacemgr.h"
#include "pub_core_cpuid.h"
#include "pub_core_machine.h" // For VG_(cache_line_size_ppc32)
+ // and VG_(have_altivec)
// and VG_(get_SP)
// and VG_(have_mxcsr_x86)
#include "pub_core_libcbase.h"
#elif defined(VGA_ppc32)
*vex_arch = VexArchPPC32;
- vai->subarch = VexSubArchPPC32_noAV;
+ vai->subarch = VG_(have_altivec) ? VexSubArchPPC32_AV
+ : VexSubArchPPC32_noAV;
vai->ppc32_cache_line_szB = VG_(cache_line_size_ppc32);
return True;
// Architecture specifics
+#if defined(VGA_ppc32)
// PPC: what is the cache line size (for dcbz etc) ?
// This info is harvested on Linux at startup from the AT_SYSINFO
// entries.
-#if defined(VGA_ppc32)
extern Int VG_(cache_line_size_ppc32);
+// Altivec enabled? Harvested on startup from the AT_HWCAP entry
+extern Int VG_(have_altivec);
#endif
// X86: set to 1 if the host is able to do {ld,st}mxcsr (load/store