|
| 1 | +//@ assembly-output: emit-asm |
| 2 | +//@ revisions: rv32i rv64i rv32e |
| 3 | +//@[rv32i] compile-flags: --target riscv32i-unknown-none-elf |
| 4 | +//@[rv32i] needs-llvm-components: riscv |
| 5 | +//@[rv64i] compile-flags: --target riscv64imac-unknown-none-elf |
| 6 | +//@[rv64i] needs-llvm-components: riscv |
| 7 | +//@[rv32e] compile-flags: --target riscv32e-unknown-none-elf |
| 8 | +//@[rv32e] needs-llvm-components: riscv |
| 9 | +// ignore-tidy-linelength |
| 10 | + |
| 11 | +#![crate_type = "rlib"] |
| 12 | +#![feature(no_core, rustc_attrs, lang_items)] |
| 13 | +#![no_core] |
| 14 | + |
| 15 | +#[lang = "sized"] |
| 16 | +trait Sized {} |
| 17 | + |
| 18 | +#[rustc_builtin_macro] |
| 19 | +macro_rules! asm { |
| 20 | + () => {}; |
| 21 | +} |
| 22 | + |
| 23 | +// CHECK-LABEL: @flags_clobber |
| 24 | +// CHECK: call void asm sideeffect "", "~{vtype},~{vl},~{vxsat},~{vxrm}"() |
| 25 | +#[no_mangle] |
| 26 | +pub unsafe fn flags_clobber() { |
| 27 | + asm!("", options(nostack, nomem)); |
| 28 | +} |
| 29 | + |
| 30 | +// CHECK-LABEL: @no_clobber |
| 31 | +// CHECK: call void asm sideeffect "", ""() |
| 32 | +#[no_mangle] |
| 33 | +pub unsafe fn no_clobber() { |
| 34 | + asm!("", options(nostack, nomem, preserves_flags)); |
| 35 | +} |
| 36 | + |
| 37 | +// CHECK-LABEL: @clobber_abi |
| 38 | +// rv32i: asm sideeffect "", "={x1},={x5},={x6},={x7},={x10},={x11},={x12},={x13},={x14},={x15},={x16},={x17},={x28},={x29},={x30},={x31},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() |
| 39 | +// rv64i: asm sideeffect "", "={x1},={x5},={x6},={x7},={x10},={x11},={x12},={x13},={x14},={x15},={x16},={x17},={x28},={x29},={x30},={x31},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() |
| 40 | +// rv32e: asm sideeffect "", "={x1},={x5},={x6},={x7},={x10},={x11},={x12},={x13},={x14},={x15},~{f0},~{f1},~{f2},~{f3},~{f4},~{f5},~{f6},~{f7},~{f10},~{f11},~{f12},~{f13},~{f14},~{f15},~{f16},~{f17},~{f28},~{f29},~{f30},~{f31},~{v0},~{v1},~{v2},~{v3},~{v4},~{v5},~{v6},~{v7},~{v8},~{v9},~{v10},~{v11},~{v12},~{v13},~{v14},~{v15},~{v16},~{v17},~{v18},~{v19},~{v20},~{v21},~{v22},~{v23},~{v24},~{v25},~{v26},~{v27},~{v28},~{v29},~{v30},~{v31}"() |
| 41 | +#[no_mangle] |
| 42 | +pub unsafe fn clobber_abi() { |
| 43 | + asm!("", clobber_abi("C"), options(nostack, nomem, preserves_flags)); |
| 44 | +} |
0 commit comments