Skip to content
Snippets Groups Projects
Commit 982b5237 authored by Qiang Yu's avatar Qiang Yu Committed by Marge Bot
Browse files

ac/nir/ngg: fix nogs culling with nuw add


We should not use "nuw" here as negative add positive may wrap
around (negative is 0xffffff??).

This problem can be observed with LLVM15 (I can't see when LLVM14):
  %.neg = mul nsw i32 %31, -4
  %163 = add nuw nsw i32 %.neg, 16
  %164 = lshr i32 257, %.neg
  %165 = lshr i32 %164, %163

LLVM just assume %.neg is possitive, so pre-shift 0x01010101 by 16.
This get wrong value because we can't get back the shifted bits with
a negative shift right.

Fixes: 75dbb404 ("ac/nir: Remove byte permute from prefix sum of the repack sequence.")
Reviewed-by: default avatarTimur Kristóf <timur.kristof@gmail.com>
Signed-off-by: default avatarQiang Yu <yuq825@gmail.com>
Part-of: <mesa/mesa!19718>
parent e81c35d1
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