diff options
author | badumbatish <tanghocle456@gmail.com> | 2024-08-27 18:15:26 -0700 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-03-19 15:32:07 +0100 |
commit | 23eb5d2c3a03e262e164342c18dfb8f61017f01f (patch) | |
tree | a0d02266f4688e70b0ffd9fc3bc657cdd0c4fe72 /gcc/testsuite | |
parent | d3be8cb777bc74f85b4e06df054b42c441bf5df9 (diff) | |
download | gcc-23eb5d2c3a03e262e164342c18dfb8f61017f01f.zip gcc-23eb5d2c3a03e262e164342c18dfb8f61017f01f.tar.gz gcc-23eb5d2c3a03e262e164342c18dfb8f61017f01f.tar.bz2 |
gccrs: Make inline mov compiles
gcc/rust/ChangeLog:
* backend/rust-compile-asm.cc (CompileAsm::asm_build_expr):
Remove debug
* expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings):
properly formatted via rust instead of c
(parse_asm): formatted comment
(parse_format_strings): formatted comment
* hir/tree/rust-hir-expr.h: fix is_simple_asm()
gcc/testsuite/ChangeLog:
* rust/compile/inline_asm_parse_operand.rs: Fix format asm
* rust/compile/inline_asm_parse_output_operand.rs:
Fix format asm
* rust/execute/torture/inline_asm_mov_x_5.rs: Move to...
* rust/execute/inline_asm_mov_x_5.rs: ...here.
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/rust/compile/inline_asm_parse_operand.rs | 14 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/inline_asm_parse_output_operand.rs | 2 | ||||
-rw-r--r-- | gcc/testsuite/rust/execute/inline_asm_mov_x_5.rs (renamed from gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5.rs) | 5 |
3 files changed, 13 insertions, 8 deletions
diff --git a/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs b/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs index dfce295..e0efe1c 100644 --- a/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs +++ b/gcc/testsuite/rust/compile/inline_asm_parse_operand.rs @@ -2,13 +2,13 @@ #[rustc_builtin_macro] macro_rules! asm { - () => {} + () => {}; } -fn main() { +fn main() -> i32 { unsafe { asm!( - "add {0:e}, {0:e}", + "add {}, {}", in(reg) 0 ); } @@ -20,18 +20,20 @@ fn main() { let _num2: i32 = 20; unsafe { asm!( - "add {0}, {0}", + "add {}, {}", inout(reg) num1 =>_num1, in(reg) _num2, ); } - let mut _output_testing : u32 = 0; + let mut _output_testing: u32 = 0; unsafe { asm!( - "add {0}, {0}", + "add {}, {}", in(reg) _num1, //out(reg) _, ); } + + 0 } diff --git a/gcc/testsuite/rust/compile/inline_asm_parse_output_operand.rs b/gcc/testsuite/rust/compile/inline_asm_parse_output_operand.rs index 3134c73..a67fff5 100644 --- a/gcc/testsuite/rust/compile/inline_asm_parse_output_operand.rs +++ b/gcc/testsuite/rust/compile/inline_asm_parse_output_operand.rs @@ -10,7 +10,7 @@ fn main() { let mut _num2: i32 = 10; unsafe { asm!( - "mov {0}, 4", + "mov {}, 4", out(reg) _num1, out(reg) _num2, ); diff --git a/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5.rs b/gcc/testsuite/rust/execute/inline_asm_mov_x_5.rs index 18bc87a..e09ea1a 100644 --- a/gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5.rs +++ b/gcc/testsuite/rust/execute/inline_asm_mov_x_5.rs @@ -1,9 +1,11 @@ -#![feature(rustc_attrs)] +/* { dg-output "5\r*\n" }*/ +#![feature(rustc_attrs)] #[rustc_builtin_macro] macro_rules! asm { () => {}; } + extern "C" { fn printf(s: *const i8, ...); } @@ -15,5 +17,6 @@ fn main() { "mov {}, 5", out(reg) _x ); + printf("%d\n\0" as *const str as *const i8, _x); } } |