Support clobber_abi in MSP430 inline assembly by taiki-e · Pull Request #131310 · rust-lang/rust (original) (raw)

@cr1901

Thanks for pointing that out, I missed that because it is unstable. However, it appears that *-interrupt ABIs are not currently supported in clobber_abi on other architectures as well. (Since dependence on other unstable features may prevent stabilization, their lack of support is maybe intentional.)

"x86-interrupt",
"avr-interrupt",
"avr-non-blocking-interrupt",
"riscv-interrupt-m",
"riscv-interrupt-s",

x86/x86_64:

InlineAsmArch::X86 => match name {
"C" | "system" "efiapi" "cdecl" "stdcall" "fastcall" => {
Ok(InlineAsmClobberAbi::X86)
}
_ => Err(&["C", "system", "efiapi", "cdecl", "stdcall", "fastcall"]),
},
InlineAsmArch::X86_64 => match name {
"C" | "system" if !target.is_like_windows => Ok(InlineAsmClobberAbi::X86_64SysV),
"C" | "system" if target.is_like_windows => Ok(InlineAsmClobberAbi::X86_64Win),
"win64" | "efiapi" => Ok(InlineAsmClobberAbi::X86_64Win),
"sysv64" => Ok(InlineAsmClobberAbi::X86_64SysV),
_ => Err(&["C", "system", "efiapi", "win64", "sysv64"]),
},

riscv:

InlineAsmArch::RiscV32 | InlineAsmArch::RiscV64 => match name {
"C" | "system" "efiapi" => Ok(InlineAsmClobberAbi::RiscV),
_ => Err(&["C", "system", "efiapi"]),
},

(clobber_abi for AVR is not yet supported)


This is because it is not a call void asm, but a very long one: call { i16, i16, i16, i16, i16 } asm

That test is based on the same test for s390x added in #130630, and call ... asm for s390x was call { i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, double, double, double } asm.
In #130630, I had originally intended to write everything call ..., but realized it would be too long for clobber_abi and omitted it. I left it at the other ones (flags and clobber-only registers) because I thought if they were not call void asm, something was wrong.

FYI, for x86_64, it is call { i32, i32, i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float, float } asm,
and call ... asm sideeffect "", is omitted in codegen test for clobber_abi:

// CHECK: ={ax},={cx},={dx},={si},={di},={r8},={r9},={r10},={r11},={xmm0},={xmm1},={xmm2},={xmm3},={xmm4},={xmm5},={xmm6},={xmm7},={xmm8},={xmm9},={xmm10},={xmm11},={xmm12},={xmm13},={xmm14},={xmm15},~{xmm16},~{xmm17},~{xmm18},~{xmm19},~{xmm20},~{xmm21},~{xmm22},~{xmm23},~{xmm24},~{xmm25},~{xmm26},~{xmm27},~{xmm28},~{xmm29},~{xmm30},~{xmm31},~{k0},~{k1},~{k2},~{k3},~{k4},~{k5},~{k6},~{k7},~{st},~{st(1)},~{st(2)},~{st(3)},~{st(4)},~{st(5)},~{st(6)},~{st(7)},~{tmm0},~{tmm1},~{tmm2},~{tmm3},~{tmm4},~{tmm5},~{tmm6},~{tmm7},~{dirflag},~{fpsr},~{flags},~{memory}