diff options
| author | bors <bors@rust-lang.org> | 2021-03-16 10:05:46 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-16 10:05:46 +0000 |
| commit | f24ce9b0140d9be5a336954e878d0c1522966bb8 (patch) | |
| tree | 652b4ddb515deb444280ee580bfe64dfeca2ee75 /src/test/rustdoc | |
| parent | 195ad4830e11a544391abe296b146450dea8411b (diff) | |
| parent | ba00ddc39a99ed70ba107902767db8d4837af921 (diff) | |
| download | rust-f24ce9b0140d9be5a336954e878d0c1522966bb8.tar.gz rust-f24ce9b0140d9be5a336954e878d0c1522966bb8.zip | |
Auto merge of #82838 - Amanieu:rustdoc_asm, r=nagisa
Allow rustdoc to handle asm! of foreign architectures This allows rustdoc to process code containing `asm!` for architectures other than the current one. Since this never reaches codegen, we just replace target-specific registers and register classes with a dummy one. Fixes #82869
Diffstat (limited to 'src/test/rustdoc')
| -rw-r--r-- | src/test/rustdoc/asm-foreign.rs | 20 | ||||
| -rw-r--r-- | src/test/rustdoc/asm-foreign2.rs | 11 |
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/rustdoc/asm-foreign.rs b/src/test/rustdoc/asm-foreign.rs new file mode 100644 index 00000000000..570ed043dd9 --- /dev/null +++ b/src/test/rustdoc/asm-foreign.rs @@ -0,0 +1,20 @@ +// Make sure rustdoc accepts asm! for a foreign architecture. + +#![feature(asm)] + +// @has asm_foreign/fn.aarch64.html +pub unsafe fn aarch64(a: f64, b: f64) -> f64 { + let c; + asm!("add {:d}, {:d}, d0", out(vreg) c, in(vreg) a, in("d0") { + || {}; + b + }); + c +} + +// @has asm_foreign/fn.x86.html +pub unsafe fn x86(a: f64, b: f64) -> f64 { + let c; + asm!("addsd {}, {}, xmm0", out(xmm_reg) c, in(xmm_reg) a, in("xmm0") b); + c +} diff --git a/src/test/rustdoc/asm-foreign2.rs b/src/test/rustdoc/asm-foreign2.rs new file mode 100644 index 00000000000..34e313e7eac --- /dev/null +++ b/src/test/rustdoc/asm-foreign2.rs @@ -0,0 +1,11 @@ +// only-aarch64 +// Make sure rustdoc accepts options(att_syntax) asm! on non-x86 targets. + +#![feature(asm)] + +// @has asm_foreign2/fn.x86.html +pub unsafe fn x86(x: i64) -> i64 { + let y; + asm!("movq {}, {}", in(reg) x, out(reg) y, options(att_syntax)); + y +} |
