diff options
| author | Taiki Endo <te316e89@gmail.com> | 2024-11-07 21:19:03 +0900 |
|---|---|---|
| committer | Taiki Endo <te316e89@gmail.com> | 2024-11-07 21:19:03 +0900 |
| commit | 241f82ad915b167992ec9d3bb729f095a7829424 (patch) | |
| tree | 929b6fb781d5536274cb0cef82d76d81e1eba399 /tests/codegen | |
| parent | c07aa1e17199e27f6f7ac8f3307bca7bda0084b6 (diff) | |
| download | rust-241f82ad915b167992ec9d3bb729f095a7829424.tar.gz rust-241f82ad915b167992ec9d3bb729f095a7829424.zip | |
Basic inline assembly support for SPARC and SPARC64
Diffstat (limited to 'tests/codegen')
| -rw-r--r-- | tests/codegen/asm/sparc-clobbers.rs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/codegen/asm/sparc-clobbers.rs b/tests/codegen/asm/sparc-clobbers.rs new file mode 100644 index 00000000000..843abd55352 --- /dev/null +++ b/tests/codegen/asm/sparc-clobbers.rs @@ -0,0 +1,40 @@ +//@ revisions: sparc sparcv8plus sparc64 +//@[sparc] compile-flags: --target sparc-unknown-none-elf +//@[sparc] needs-llvm-components: sparc +//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu +//@[sparcv8plus] needs-llvm-components: sparc +//@[sparc64] compile-flags: --target sparc64-unknown-linux-gnu +//@[sparc64] needs-llvm-components: sparc + +#![crate_type = "rlib"] +#![feature(no_core, rustc_attrs, lang_items, asm_experimental_arch)] +#![no_core] + +#[lang = "sized"] +trait Sized {} + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} + +// CHECK-LABEL: @cc_clobber +// CHECK: call void asm sideeffect "", "~{icc},~{fcc0},~{fcc1},~{fcc2},~{fcc3}"() +#[no_mangle] +pub unsafe fn cc_clobber() { + asm!("", options(nostack, nomem)); +} + +// CHECK-LABEL: @no_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn no_clobber() { + asm!("", options(nostack, nomem, preserves_flags)); +} + +// CHECK-LABEL: @y_clobber +// CHECK: call void asm sideeffect "", "~{y}"() +#[no_mangle] +pub unsafe fn y_clobber() { + asm!("", out("y") _, options(nostack, nomem, preserves_flags)); +} |
