summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@collabora.com>2022-11-11 15:02:07 -0600
committerEric Engestrom <eric@engestrom.ch>2022-12-14 20:47:00 +0000
commit3b5c8ec1a9b31d99dd2a0192ea7d46b19c36dde8 (patch)
treedf9bf050a7736ac64cf3da4b1b654d73a0486bb5
parentaf63185bda10036657e229c1c56e37669d04939d (diff)
downloadmesa-3b5c8ec1a9b31d99dd2a0192ea7d46b19c36dde8.tar.gz
r600/nir: Fix u64vec2 immediate lowering
There were a couple of issues here: 1. We should be using nir_const_value_for_uint instead of setting the union fields directly to ensure the rest of the union is zeroed. 2. It was always filling out the first two components of val even if the incoming constant had 2 64-bit components. Fixes: 165fb5117bf7 ("r600/sfn: add lowering passes to get 64 bit ops lowered to 32 bit vec2") Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19689> (cherry picked from commit f3f1c28f8e6d40823e3d12415a8d0ea622f9fa20)
-rw-r--r--.pick_status.json2
-rw-r--r--src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp8
2 files changed, 5 insertions, 5 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 81e516629d6..cb024654a3b 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4054,7 +4054,7 @@
"description": "r600/nir: Fix u64vec2 immediate lowering",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": "165fb5117bf70402e66d34538d4085e060f57fea"
},
diff --git a/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp b/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp
index 9828802ba2c..09f294ca481 100644
--- a/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp
+++ b/src/gallium/drivers/r600/sfn/sfn_nir_lower_64bit.cpp
@@ -929,12 +929,12 @@ Lower64BitToVec2::lower(nir_instr *instr)
}
case nir_instr_type_load_const: {
auto lc = nir_instr_as_load_const(instr);
- assert(lc->def.num_components < 3);
- nir_const_value val[4] = {{0}};
+ assert(lc->def.num_components <= 2);
+ nir_const_value val[4];
for (uint i = 0; i < lc->def.num_components; ++i) {
uint64_t v = lc->value[i].u64;
- val[0].u32 = v & 0xffffffff;
- val[1].u32 = (v >> 32) & 0xffffffff;
+ val[i * 2 + 0] = nir_const_value_for_uint(v & 0xffffffff, 32);
+ val[i * 2 + 1] = nir_const_value_for_uint(v >> 32, 32);
}
return nir_build_imm(b, 2 * lc->def.num_components, 32, val);