Skip to content
Snippets Groups Projects
Commit cefbc3f7 authored by Oded Gabbay's avatar Oded Gabbay Committed by Emil Velikov
Browse files

llvmpipe: convert double to long long instead of unsigned long long


round(val*dscale) produces a double result, as val and dscale are double.
However, LLVMConstInt receives unsigned long long, so there is an
implicit conversion from double to unsigned long long.
This is an undefined behavior. Therefore, we need to first explicitly
convert the round result to long long, and then let the compiler handle
conversion from that to unsigned long long.

This bug manifests itself in POWER, where all IMM values of -1 are being
converted to 0 implicitly, causing a wrong LLVM IR output.

Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
CC: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Reviewed-by: default avatarTom Stellard <thomas.stellard@amd.com>
Reviewed-by: default avatarRoland Scheidegger <sroland@vmware.com>
(cherry picked from commit 4f2290d1)
parent 3cbe492f
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment