diff --git a/.pick_status.json b/.pick_status.json index 81ce62871f2..676321478b6 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -494,7 +494,7 @@ "description": "brw/copy: Fix handling of offset in extract_imm", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "580e1c592d90392a30185d8059499498748909fd", "notes": null diff --git a/src/intel/compiler/brw_opt_copy_propagation.cpp b/src/intel/compiler/brw_opt_copy_propagation.cpp index 94744b798a9..fe78cbc6924 100644 --- a/src/intel/compiler/brw_opt_copy_propagation.cpp +++ b/src/intel/compiler/brw_opt_copy_propagation.cpp @@ -1745,9 +1745,12 @@ extract_imm(brw_reg val, brw_reg_type type, unsigned offset) if (offset == 0 || bitsize == brw_type_size_bits(val.type)) return val; - assert(bitsize < brw_type_size_bits(val.type)); + /* The whole extracted value must come from bits that acutally exist in the + * original immediate value. + */ + assert((8 * offset) + bitsize <= brw_type_size_bits(val.type)); - val.u64 = (val.u64 >> (bitsize * offset)) & ((1ull << bitsize) - 1); + val.u64 = (val.u64 >> (8 * offset)) & ((1ull << bitsize) - 1); return val; }