Skip to content

Commit

Permalink
s390x: Fix regalloc checker error (bytecodealliance#4973)
Browse files Browse the repository at this point in the history
For ShiftRR and VecShiftRR, if shift_reg is zero_reg(), the
instruction does not actually use any register value.

Fixes bytecodealliance#4969
  • Loading branch information
uweigand authored Sep 28, 2022
1 parent cdecc85 commit 83bb6fd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cranelift/codegen/src/isa/s390x/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ fn s390x_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandC
} => {
collector.reg_def(rd);
collector.reg_use(rn);
collector.reg_use(shift_reg);
if shift_reg != zero_reg() {
collector.reg_use(shift_reg);
}
}
&Inst::RxSBG { rd, rn, .. } => {
collector.reg_mod(rd);
Expand Down Expand Up @@ -744,7 +746,9 @@ fn s390x_get_operands<F: Fn(VReg) -> VReg>(inst: &Inst, collector: &mut OperandC
} => {
collector.reg_def(rd);
collector.reg_use(rn);
collector.reg_use(shift_reg);
if shift_reg != zero_reg() {
collector.reg_use(shift_reg);
}
}
&Inst::VecSelect { rd, rn, rm, ra, .. } => {
collector.reg_def(rd);
Expand Down

0 comments on commit 83bb6fd

Please sign in to comment.