From c41e33f5192be028e10d4fd109f9029effc0e95e 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: (cherry picked from commit 9b1a296172df38561d650abf98ee2e1c77ac6fc2) --- .pick_status.json | 2 +- src/amd/compiler/aco_optimizer.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 390bdeb2777..48fb8932bee 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -877,7 +877,7 @@ "description": "aco/optimizer: ensure to not erase high bits when propagating packed constants", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": null }, diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 42f50cae8fc..eb2eea64ed2 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -192,7 +192,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())