[Mesa-dev] [PATCH 2/3] gallivm: Override getHostCPUName() "generic" w/ "pwr8" (v2)

Ben Crocker bcrocker at redhat.com
Mon Jan 16 23:31:07 UTC 2017


If llvm::sys::getHostCPUName() returns "generic", override
it with "pwr8" (on PPC64LE).

This is a work-around for a bug in LLVM: a table entry for "POWER8NVL"
is missing, resulting in (big-endian) "generic" being returned on
little-endian Power8NVL systems.  The result is that code that
attempts to load the least significant 32 bits of a 64-bit quantity in
memory loads the wrong half.

This omission should be fixed in the next version of LLVM,
but this work-around should be left in place in case some
future version of POWER<n> also ends up unrepresented in LLVM's table.

Signed-off-by: Ben Crocker <bcrocker at redhat.com>
---
 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index f7b31ee..cac81b9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -649,6 +649,10 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
     * when not using MCJIT so no instructions are generated which the old JIT
     * can't handle. Not entirely sure if we really need to do anything yet.
     */
+#if defined(PIPE_ARCH_LITTLE_ENDIAN)  && defined(PIPE_ARCH_PPC_64)
+   if (MCPU == "generic")
+      MCPU = "pwr8";
+#endif
    builder.setMCPU(MCPU);
    debug_printf("llc -mcpu option: %s\n", MCPU.str().c_str());
 #endif
-- 
2.7.4



More information about the mesa-dev mailing list