From 9b1a296172df38561d650abf98ee2e1c77ac6fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Sch=C3=BCrmann?= Date: Mon, 19 Jul 2021 15:01:09 +0200 Subject: [PATCH] aco/optimizer: ensure to not erase high bits when propagating packed constants Packed constants with non-zero values in the high half might have been propagated as 16 bit, dropping the high half. Cc: mesa-stable Closes: #5070 Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_optimizer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 8e4daaa8167..f6198e4b465 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -194,7 +194,8 @@ struct ssa_info { add_label(label_literal); val = constant; - if (chip >= GFX8 && !op16.isLiteral()) + /* check that no upper bits are lost in case of packed 16bit constants */ + if (chip >= GFX8 && !op16.isLiteral() && op16.constantValue64() == constant) add_label(label_constant_16bit); if (!op32.isLiteral())