Skip to content

Commit 30d2a79

Browse files
Rollup merge of #142285 - workingjubilee:dont-use-bad-assembly, r=nnethercote
tests: Do not run afoul of asm.validity.non-exhaustive in input-stats This addresses one of the three powerpc64-unknown-linux-musl test failures in #142280 I was motivated to cover it myself because technically this is also compile-time UB if we compile a program that has `asm!` with x86-64-specific instructions on another platform. That'll only mean something if this is ever switched to build-pass, or if checking emits object code, but conveniently "nop" is valid assembly on all platforms anyone has implemented Rust codegen for. Even the weird ones LLVM doesn't support, like PA-RISC or Common Intermediate Language. ...except GPUs. Not sure about those. r? ``@nnethercote``
2 parents 6f23443 + 3a5187a commit 30d2a79

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/ui/stats/input-stats.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ check-pass
22
//@ compile-flags: -Zinput-stats
33
//@ only-64bit
4+
//@ needs-asm-support
45
// layout randomization affects the hir stat output
56
//@ needs-deterministic-layouts
67
//
@@ -49,5 +50,7 @@ fn main() {
4950
_ => {}
5051
}
5152

52-
unsafe { asm!("mov rdi, 1"); }
53+
// NOTE(workingjubilee): do GPUs support NOPs? remove this cfg if they do
54+
#[cfg(not(any(target_arch = "nvptx64", target_arch = "spirv", target_arch = "amdgpu")))]
55+
unsafe { asm!("nop"); }
5356
}

0 commit comments

Comments
 (0)