mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
nak: Follow memcpy semantics with OpParCopy
Destination first followed by source. Otherwise, we'll screw ourselves up endlessly. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
parent
831d1ee2d6
commit
ced6b44ba6
5 changed files with 9 additions and 9 deletions
|
|
@ -640,8 +640,8 @@ impl<'a> ShaderFromNir<'a> {
|
|||
nir_op_pack_64_2x32_split => {
|
||||
let dst_ssa = dst.as_ssa().unwrap();
|
||||
let mut pcopy = OpParCopy::new();
|
||||
pcopy.push(srcs[0], dst_ssa[0].into());
|
||||
pcopy.push(srcs[1], dst_ssa[1].into());
|
||||
pcopy.push(dst_ssa[0].into(), srcs[0]);
|
||||
pcopy.push(dst_ssa[1].into(), srcs[1]);
|
||||
self.instrs.push(Instr::new_boxed(Op::ParCopy(pcopy)));
|
||||
}
|
||||
nir_op_u2f32 => {
|
||||
|
|
@ -1158,7 +1158,7 @@ impl<'a> ShaderFromNir<'a> {
|
|||
let vec_dst = *dst.as_ssa().unwrap();
|
||||
for (i, dst) in vec_dst.iter().enumerate() {
|
||||
let i = u16::try_from(i).unwrap();
|
||||
pcopy.push(cb.offset(i * 4).into(), (*dst).into());
|
||||
pcopy.push((*dst).into(), cb.offset(i * 4).into());
|
||||
}
|
||||
self.instrs.push(Instr::new_boxed(Op::ParCopy(pcopy)));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -2911,12 +2911,12 @@ impl OpParCopy {
|
|||
self.srcs.is_empty()
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> Zip<slice::Iter<'_, Src>, slice::Iter<'_, Dst>> {
|
||||
pub fn iter(&self) -> Zip<slice::Iter<'_, Dst>, slice::Iter<'_, Src>> {
|
||||
assert!(self.srcs.len() == self.dsts.len());
|
||||
self.srcs.iter().zip(&self.dsts)
|
||||
self.dsts.iter().zip(&self.srcs)
|
||||
}
|
||||
|
||||
pub fn push(&mut self, src: Src, dst: Dst) {
|
||||
pub fn push(&mut self, dst: Dst, src: Src) {
|
||||
assert!(self.srcs.len() == self.dsts.len());
|
||||
self.srcs.push(src);
|
||||
self.dsts.push(dst);
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ impl<'a> LegalizeInstr<'a> {
|
|||
*/
|
||||
if vec_comps.get(&ssa).is_some() {
|
||||
let copy = self.ssa_alloc.alloc(ssa.file());
|
||||
pcopy.push(ssa.into(), copy.into());
|
||||
pcopy.push(copy.into(), ssa.into());
|
||||
new_vec[usize::from(c)] = copy;
|
||||
} else {
|
||||
vec_comps.insert(ssa);
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ impl CopyPropPass {
|
|||
self.add_copy(dst[0], SrcType::I32, neg.src.ineg());
|
||||
}
|
||||
Op::ParCopy(pcopy) => {
|
||||
for (src, dst) in pcopy.iter() {
|
||||
for (dst, src) in pcopy.iter() {
|
||||
let dst = dst.as_ssa().unwrap();
|
||||
assert!(dst.comps() == 1);
|
||||
self.add_copy(dst[0], SrcType::GPR, *src);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ impl DeadCodePass {
|
|||
}
|
||||
Op::ParCopy(pcopy) => {
|
||||
assert!(instr.pred.is_true());
|
||||
for (src, dst) in pcopy.iter() {
|
||||
for (dst, src) in pcopy.iter() {
|
||||
if self.is_dst_live(dst) {
|
||||
self.mark_src_live(src);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue