Skip to content

Commit

Permalink
Back out s390x changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcrichton committed Mar 16, 2023
1 parent 2cc1b60 commit daff19f
Show file tree
Hide file tree
Showing 22 changed files with 424 additions and 425 deletions.
17 changes: 8 additions & 9 deletions cranelift/codegen/src/isa/s390x/inst/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3587,18 +3587,17 @@ impl Inst {
if let Some(s) = state.take_stack_map() {
sink.add_stack_map(StackMapExtent::UpcomingBytes(2), s);
}
sink.add_trap(trap_code);
sink.put_data(&Inst::TRAP_OPCODE);
put_with_trap(sink, &enc_e(0x0000), trap_code);
}
&Inst::TrapIf { cond, trap_code } => {
let label = sink.defer_trap(trap_code, state.take_stack_map());

let off = sink.cur_offset();
sink.use_label_at_offset(off, label, LabelUse::BranchRI);

// Branch to the trap if condition is true.
// Branch over trap if condition is false.
let opcode = 0xa74; // BCR
put(sink, &enc_ri_c(opcode, cond.bits(), 2));
put(sink, &enc_ri_c(opcode, cond.invert().bits(), 4 + 2));
// Now emit the actual trap.
if let Some(s) = state.take_stack_map() {
sink.add_stack_map(StackMapExtent::UpcomingBytes(2), s);
}
put_with_trap(sink, &enc_e(0x0000), trap_code);
}
&Inst::JTSequence { ridx, ref targets } => {
let ridx = allocs.next(ridx);
Expand Down
4 changes: 2 additions & 2 deletions cranelift/codegen/src/isa/s390x/inst/emit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7041,8 +7041,8 @@ fn test_s390x_binemit() {
cond: Cond::from_mask(1),
trap_code: TrapCode::StackOverflow,
},
"A71400020000",
"jo #trap=stk_ovf",
"A7E400030000",
"jno 6 ; trap",
));

insns.push((
Expand Down
6 changes: 3 additions & 3 deletions cranelift/codegen/src/isa/s390x/inst/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3187,9 +3187,9 @@ impl Inst {
}
&Inst::Debugtrap => "debugtrap".to_string(),
&Inst::Trap { .. } => "trap".to_string(),
&Inst::TrapIf { cond, trap_code } => {
let cond = cond.pretty_print_default();
format!("j{cond} #trap={trap_code}")
&Inst::TrapIf { cond, .. } => {
let cond = cond.invert().pretty_print_default();
format!("j{} 6 ; trap", cond)
}
&Inst::JTSequence { ridx, ref targets } => {
let ridx = pretty_print_reg(ridx, allocs);
Expand Down
Loading

0 comments on commit daff19f

Please sign in to comment.