summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Crocker <bcrocker@redhat.com>2017-02-10 18:08:07 -0500
committerEmil Velikov <emil.l.velikov@gmail.com>2017-03-15 14:39:55 +0000
commit9130d79f7a7e7881a948619c75c4610962a7691e (patch)
treecc6a4f4f03afa17b66794a497b1580f85517eb87 /src
parentf17a1534973d451a87b21e5808596564d33be385 (diff)
gallivm: Override getHostCPUName() "generic" w/ "pwr8" (v4)
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 (4.0), 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. This workaround fixes failures in the Piglit arb_gpu_shader_fp64 conversion tests on POWER8NVL processors. (V4: add similar comment in the code.) Signed-off-by: Ben Crocker <bcrocker@redhat.com> Cc: 12.0 13.0 17.0 <mesa-stable@lists.freedesktop.org> Acked-by: Emil Velikov <emil.velikov@collabora.com> (cherry picked from commit b934aae36410e09892e772b26f61fed5d037fc69)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index d13039c0507..9b6195576d8 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -634,6 +634,19 @@ 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)
+ /*
+ * Versions of LLVM prior to 4.0 lacked a table entry for "POWER8NVL",
+ * resulting in (big-endian) "generic" being returned on
+ * little-endian Power8NVL systems. The result was that code that
+ * attempted to load the least significant 32 bits of a 64-bit quantity
+ * from memory loaded the wrong half. This resulted in failures in some
+ * Piglit tests, e.g.
+ * .../arb_gpu_shader_fp64/execution/conversion/frag-conversion-explicit-double-uint
+ */
+ if (MCPU == "generic")
+ MCPU = "pwr8";
+#endif
builder.setMCPU(MCPU);
if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) {
debug_printf("llc -mcpu option: %s\n", MCPU.str().c_str());