Skip to content

Commit b87f756

Browse files
committed
Fix building std_detect on s390x
1 parent c4743bd commit b87f756

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/inline_asm.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,26 @@ pub(crate) fn codegen_inline_asm_terminator<'tcx>(
5151
return;
5252
}
5353

54+
if fx.tcx.sess.target.arch == "s390x"
55+
&& template.len() == 3
56+
&& template[0] == InlineAsmTemplatePiece::String("stfle 0(".into())
57+
&& let InlineAsmTemplatePiece::Placeholder { operand_idx: 0, modifier: None, span: _ } =
58+
template[1]
59+
&& template[2] == InlineAsmTemplatePiece::String(")".into())
60+
{
61+
// FIXME no inline asm support for s390x yet, but stdarch needs it for feature detection
62+
match destination {
63+
Some(destination) => {
64+
let destination_block = fx.get_block(destination);
65+
fx.bcx.ins().jump(destination_block, &[]);
66+
}
67+
None => {
68+
fx.bcx.ins().trap(TrapCode::user(1 /* unreachable */).unwrap());
69+
}
70+
}
71+
return;
72+
}
73+
5474
let operands = operands
5575
.iter()
5676
.map(|operand| match *operand {

0 commit comments

Comments
 (0)