about summary refs log tree commit diff
path: root/tests/codegen
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-12 08:31:43 +0000
committerbors <bors@rust-lang.org>2024-10-12 08:31:43 +0000
commit8f8bee4f60d9d3769f75c70d558c27a95761c554 (patch)
treed0f78ea651e7174ee2b5d2cac08adfdb06bfc908 /tests/codegen
parentfb20e4d3b96d1de459d086980a8b99d5060ad9fe (diff)
parent5e477c91072b228df9c816474d93b9e9b8b4a9c6 (diff)
downloadrust-8f8bee4f60d9d3769f75c70d558c27a95761c554.tar.gz
rust-8f8bee4f60d9d3769f75c70d558c27a95761c554.zip
Auto merge of #131581 - tgross35:rollup-vul4kol, r=tgross35
Rollup of 7 pull requests

Successful merges:

 - #124874 (intrinsics fmuladdf{32,64}: expose llvm.fmuladd.* semantics)
 - #130962 (Migrate lib's `&Option<T>` into `Option<&T>`)
 - #131289 (stabilize duration_consts_float)
 - #131310 (Support clobber_abi in MSP430 inline assembly)
 - #131546 (Make unused_parens's suggestion considering expr's attributes.)
 - #131565 (Remove deprecation note in the `non_local_definitions` lint)
 - #131576 (Flatten redundant test module `run_make_support::diff::tests::tests`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/codegen')
-rw-r--r--tests/codegen/asm-msp430-clobbers.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/codegen/asm-msp430-clobbers.rs b/tests/codegen/asm-msp430-clobbers.rs
new file mode 100644
index 00000000000..c00c04f3088
--- /dev/null
+++ b/tests/codegen/asm-msp430-clobbers.rs
@@ -0,0 +1,36 @@
+//@ assembly-output: emit-asm
+//@ compile-flags: --target msp430-none-elf
+//@ needs-llvm-components: msp430
+
+#![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: @sr_clobber
+// CHECK: call void asm sideeffect "", "~{sr}"()
+#[no_mangle]
+pub unsafe fn sr_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: @clobber_abi
+// CHECK: asm sideeffect "", "={r11},={r12},={r13},={r14},={r15}"()
+#[no_mangle]
+pub unsafe fn clobber_abi() {
+    asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags));
+}