diff options
| author | Taiki Endo <te316e89@gmail.com> | 2024-11-25 23:11:17 +0900 |
|---|---|---|
| committer | Taiki Endo <te316e89@gmail.com> | 2024-11-25 23:11:17 +0900 |
| commit | 59f01cdbf48795ab8d6752b8a4bbe0e4540c30a5 (patch) | |
| tree | ba4096408b0f8cac2c3a08b24c6f1646a7bddd57 /tests/codegen/asm | |
| parent | 1278dad1e9a46a3a6fb5de80a5620cd2e58196cb (diff) | |
| download | rust-59f01cdbf48795ab8d6752b8a4bbe0e4540c30a5.tar.gz rust-59f01cdbf48795ab8d6752b8a4bbe0e4540c30a5.zip | |
Support predicate registers (clobber-only) in Hexagon inline assembly
Diffstat (limited to 'tests/codegen/asm')
| -rw-r--r-- | tests/codegen/asm/hexagon-clobbers.rs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/codegen/asm/hexagon-clobbers.rs b/tests/codegen/asm/hexagon-clobbers.rs new file mode 100644 index 00000000000..6bb662ead99 --- /dev/null +++ b/tests/codegen/asm/hexagon-clobbers.rs @@ -0,0 +1,37 @@ +//@ revisions: hexagon +//@[hexagon] compile-flags: --target hexagon-unknown-linux-musl +//@[hexagon] needs-llvm-components: hexagon +//@ compile-flags: -Zmerge-functions=disabled + +#![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: @flags_clobber +// CHECK: call void asm sideeffect "", ""() +#[no_mangle] +pub unsafe fn flags_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: @p0_clobber +// CHECK: call void asm sideeffect "", "~{p0}"() +#[no_mangle] +pub unsafe fn p0_clobber() { + asm!("", out("p0") _, options(nostack, nomem, preserves_flags)); +} |
