diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-09-04 23:59:36 -0700 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:17 +0100 |
commit | 81397a9f53440ed6fb816480784fd9b14a3fca57 (patch) | |
tree | 76a41d0ebf02be308f7262f3fd3c260fcd783a1f /gcc/testsuite/rust/execute | |
parent | 9753ae307b89cc1e6934ecc16736abe2158a7333 (diff) | |
download | gcc-81397a9f53440ed6fb816480784fd9b14a3fca57.zip gcc-81397a9f53440ed6fb816480784fd9b14a3fca57.tar.gz gcc-81397a9f53440ed6fb816480784fd9b14a3fca57.tar.bz2 |
gccrs: Provide input operand for gccrs
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::asm_construct_inputs):
Provide input operand for gccrs
* expand/rust-macro-builtins-asm.cc (parse_reg_operand_in):
Move expr to In
(expand_inline_asm_strings):
Add comments to debug strings
gcc/testsuite/ChangeLog:
* rust/compile/inline_asm_parse_operand.rs:
Remove inout, functionality not supported. Remove redundant {}
* rust/execute/torture/inline_asm_mov_x_5_ARM.rs: Add operand in
* rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: Likewise
Diffstat (limited to 'gcc/testsuite/rust/execute')
-rw-r--r-- | gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_ARM.rs | 14 | ||||
-rw-r--r-- | gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_x86_64.rs | 19 |
2 files changed, 28 insertions, 5 deletions
diff --git a/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_ARM.rs b/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_ARM.rs index 4e76260..0c867df 100644 --- a/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_ARM.rs +++ b/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_ARM.rs @@ -1,5 +1,5 @@ /* { dg-do run { target arm*-*-* } } */ -/* { dg-output "5\r*\n" }*/ +/* { dg-output "5\r*\n9\r*\n" }*/ #![feature(rustc_attrs)] #[rustc_builtin_macro] @@ -13,12 +13,24 @@ extern "C" { fn main() -> i32 { let mut _x: i32 = 0; + let mut _y: i32 = 9; + unsafe { asm!( "mov {}, 5", out(reg) _x ); printf("%d\n\0" as *const str as *const i8, _x); + }; + + unsafe { + asm!( + "mov {}, {}", + in(reg) _y, + out(reg) _x + ); + printf("%d\n\0" as *const str as *const i8, _x); } + 0 } diff --git a/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_x86_64.rs b/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_x86_64.rs index c6086e0..5fbbb68 100644 --- a/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_x86_64.rs +++ b/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_x86_64.rs @@ -1,5 +1,5 @@ /* { dg-do run { target x86_64*-*-* } } */ -/* { dg-output "5\r*\n" }*/ +/* { dg-output "5\r*\n9\r*\n" }*/ #![feature(rustc_attrs)] #[rustc_builtin_macro] @@ -12,13 +12,24 @@ extern "C" { } fn main() -> i32 { - let mut _x: i32 = 0; + let mut x: i32 = 0; + let mut _y: i32 = 9; // Mark it as _y since it is only used as input operand, not printing + unsafe { asm!( "mov $5, {}", - out(reg) _x + out(reg) x + ); + printf("%d\n\0" as *const str as *const i8, x); + }; + + unsafe { + asm!( + "mov {}, {}", + in(reg) _y, + out(reg) x, ); - printf("%d\n\0" as *const str as *const i8, _x); + printf("%d\n\0" as *const str as *const i8, x); } 0 } |