Run rustfmt on tests/assembly/
.
This commit is contained in:
parent
4af4ba2391
commit
d063c7b6c8
@ -14,7 +14,6 @@ ignore = [
|
||||
# - some contain syntax errors that cause rustfmt to give an error
|
||||
# - some UI tests are broken by different formatting
|
||||
# - some require special comments in a particular position (e.g. `EMIT_MIR` comments)
|
||||
"/tests/assembly/",
|
||||
"/tests/auxiliary/",
|
||||
"/tests/codegen/",
|
||||
"/tests/codegen-units/",
|
||||
|
@ -5,8 +5,8 @@
|
||||
|
||||
#![feature(portable_simd)]
|
||||
|
||||
use std::simd::Simd;
|
||||
use std::arch::asm;
|
||||
use std::simd::Simd;
|
||||
|
||||
#[target_feature(enable = "avx")]
|
||||
#[no_mangle]
|
||||
|
@ -18,7 +18,8 @@ pub unsafe fn sse41_blend_nofeature(x: __m128, y: __m128) -> __m128 {
|
||||
// CHECK: {{call .*_mm_blend_ps.*}}
|
||||
// CHECK-NOT: blendps
|
||||
// CHECK: ret
|
||||
#[inline(never)] |x, y| _mm_blend_ps(x, y, 0b0101)
|
||||
#[inline(never)]
|
||||
|x, y| _mm_blend_ps(x, y, 0b0101)
|
||||
};
|
||||
f(x, y)
|
||||
}
|
||||
@ -33,9 +34,8 @@ pub fn sse41_blend_noinline(x: __m128, y: __m128) -> __m128 {
|
||||
// CHECK: blendps
|
||||
// CHECK-NOT: _mm_blend_ps
|
||||
// CHECK: ret
|
||||
#[inline(never)] |x, y| unsafe {
|
||||
_mm_blend_ps(x, y, 0b0101)
|
||||
}
|
||||
#[inline(never)]
|
||||
|x, y| unsafe { _mm_blend_ps(x, y, 0b0101) }
|
||||
};
|
||||
f(x, y)
|
||||
}
|
||||
@ -52,9 +52,8 @@ pub fn sse41_blend_doinline(x: __m128, y: __m128) -> __m128 {
|
||||
// CHECK-NOT: _mm_blend_ps
|
||||
// CHECK: ret
|
||||
let f = {
|
||||
#[inline] |x, y| unsafe {
|
||||
_mm_blend_ps(x, y, 0b0101)
|
||||
}
|
||||
#[inline]
|
||||
|x, y| unsafe { _mm_blend_ps(x, y, 0b0101) }
|
||||
};
|
||||
f(x, y)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
//@ [opt-speed] compile-flags: -Copt-level=2 -Cdebug-assertions=no
|
||||
//@ [opt-size] compile-flags: -Copt-level=s -Cdebug-assertions=no
|
||||
#![crate_type = "rlib"]
|
||||
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(pointer_is_aligned_to)]
|
||||
|
||||
@ -16,9 +15,7 @@
|
||||
// CHECK: retq
|
||||
#[no_mangle]
|
||||
pub unsafe fn is_aligned_to_unchecked(ptr: *const u8, align: usize) -> bool {
|
||||
unsafe {
|
||||
std::intrinsics::assume(align.is_power_of_two())
|
||||
}
|
||||
unsafe { std::intrinsics::assume(align.is_power_of_two()) }
|
||||
ptr.is_aligned_to(align)
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pic
|
||||
//@ [x64] needs-llvm-components: x86
|
||||
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
#![crate_type = "rlib"]
|
||||
@ -17,9 +16,7 @@ trait Copy {}
|
||||
// CHECK: {{(jmpq|callq)}} *other_fn@GOTPCREL(%rip)
|
||||
#[no_mangle]
|
||||
pub fn call_other_fn() -> u8 {
|
||||
unsafe {
|
||||
other_fn()
|
||||
}
|
||||
unsafe { other_fn() }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: other_fn:
|
||||
@ -27,9 +24,9 @@ pub fn call_other_fn() -> u8 {
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
pub fn other_fn() -> u8 {
|
||||
unsafe {
|
||||
foreign_fn()
|
||||
}
|
||||
unsafe { foreign_fn() }
|
||||
}
|
||||
|
||||
extern "C" {fn foreign_fn() -> u8;}
|
||||
extern "C" {
|
||||
fn foreign_fn() -> u8;
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
//@ [x64] compile-flags: --target x86_64-unknown-linux-gnu -Crelocation-model=pie
|
||||
//@ [x64] needs-llvm-components: x86
|
||||
|
||||
|
||||
#![feature(no_core, lang_items)]
|
||||
#![no_core]
|
||||
#![crate_type = "rlib"]
|
||||
@ -18,9 +17,7 @@ trait Copy {}
|
||||
// CHECK: {{(jmp|callq)}} other_fn
|
||||
#[no_mangle]
|
||||
pub fn call_other_fn() -> u8 {
|
||||
unsafe {
|
||||
other_fn()
|
||||
}
|
||||
unsafe { other_fn() }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: other_fn:
|
||||
@ -30,9 +27,9 @@ pub fn call_other_fn() -> u8 {
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
pub fn other_fn() -> u8 {
|
||||
unsafe {
|
||||
foreign_fn()
|
||||
}
|
||||
unsafe { foreign_fn() }
|
||||
}
|
||||
|
||||
extern "C" {fn foreign_fn() -> u8;}
|
||||
extern "C" {
|
||||
fn foreign_fn() -> u8;
|
||||
}
|
||||
|
@ -10,12 +10,9 @@
|
||||
//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
#![feature(unsized_locals, unsized_fn_params)]
|
||||
|
||||
|
||||
// CHECK-LABEL: emptyfn:
|
||||
#[no_mangle]
|
||||
pub fn emptyfn() {
|
||||
@ -139,7 +136,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {
|
||||
// missing-NOT: __security_check_cookie
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: local_string_addr_taken
|
||||
#[no_mangle]
|
||||
pub fn local_string_addr_taken(f: fn(&String)) {
|
||||
@ -205,7 +201,7 @@ pub struct Gigastruct {
|
||||
not: u64,
|
||||
have: u64,
|
||||
array: u64,
|
||||
members: u64
|
||||
members: u64,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: local_large_var_moved
|
||||
@ -259,7 +255,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
|
||||
// EOF
|
||||
// ```
|
||||
|
||||
|
||||
// all: __security_check_cookie
|
||||
// strong: __security_check_cookie
|
||||
// basic: __security_check_cookie
|
||||
@ -267,7 +262,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
|
||||
// missing-NOT: __security_check_cookie
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
// A call to an external `alloca` function is *not* recognized as an
|
||||
// `alloca(3)` operation. This function is a compiler built-in, as the
|
||||
@ -320,7 +314,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
|
||||
// missing-NOT: __security_check_cookie
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: alloca_dynamic_arg
|
||||
#[no_mangle]
|
||||
pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
|
||||
@ -340,7 +333,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
|
||||
// this is support for the "unsized locals" unstable feature:
|
||||
// https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html.
|
||||
|
||||
|
||||
// CHECK-LABEL: unsized_fn_param
|
||||
#[no_mangle]
|
||||
pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
|
||||
@ -354,7 +346,6 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
|
||||
// alloca, and is therefore not protected by the `strong` or `basic`
|
||||
// heuristics.
|
||||
|
||||
|
||||
// We should have a __security_check_cookie call in `all` and `strong` modes but
|
||||
// LLVM does not support generating stack protectors in functions with funclet
|
||||
// based EH personalities.
|
||||
|
@ -10,12 +10,9 @@
|
||||
//@ compile-flags: -C opt-level=2 -Z merge-functions=disabled
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
#![feature(unsized_locals, unsized_fn_params)]
|
||||
|
||||
|
||||
// CHECK-LABEL: emptyfn:
|
||||
#[no_mangle]
|
||||
pub fn emptyfn() {
|
||||
@ -139,7 +136,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {
|
||||
// missing-NOT: __security_check_cookie
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: local_string_addr_taken
|
||||
#[no_mangle]
|
||||
pub fn local_string_addr_taken(f: fn(&String)) {
|
||||
@ -213,7 +209,7 @@ pub struct Gigastruct {
|
||||
not: u64,
|
||||
have: u64,
|
||||
array: u64,
|
||||
members: u64
|
||||
members: u64,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: local_large_var_moved
|
||||
@ -267,7 +263,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
|
||||
// EOF
|
||||
// ```
|
||||
|
||||
|
||||
// all: __security_check_cookie
|
||||
// strong: __security_check_cookie
|
||||
// basic: __security_check_cookie
|
||||
@ -275,7 +270,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
|
||||
// missing-NOT: __security_check_cookie
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
// A call to an external `alloca` function is *not* recognized as an
|
||||
// `alloca(3)` operation. This function is a compiler built-in, as the
|
||||
@ -328,7 +322,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
|
||||
// missing-NOT: __security_check_cookie
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: alloca_dynamic_arg
|
||||
#[no_mangle]
|
||||
pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
|
||||
@ -348,7 +341,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
|
||||
// this is support for the "unsized locals" unstable feature:
|
||||
// https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html.
|
||||
|
||||
|
||||
// CHECK-LABEL: unsized_fn_param
|
||||
#[no_mangle]
|
||||
pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
|
||||
@ -362,7 +354,6 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
|
||||
// alloca, and is therefore not protected by the `strong` or `basic`
|
||||
// heuristics.
|
||||
|
||||
|
||||
// We should have a __security_check_cookie call in `all` and `strong` modes but
|
||||
// LLVM does not support generating stack protectors in functions with funclet
|
||||
// based EH personalities.
|
||||
|
@ -143,7 +143,6 @@ pub fn local_var_addr_used_indirectly(f: fn(bool)) {
|
||||
// missing-NOT: __stack_chk_fail
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: local_string_addr_taken
|
||||
#[no_mangle]
|
||||
pub fn local_string_addr_taken(f: fn(&String)) {
|
||||
@ -194,7 +193,7 @@ pub struct Gigastruct {
|
||||
not: u64,
|
||||
have: u64,
|
||||
array: u64,
|
||||
members: u64
|
||||
members: u64,
|
||||
}
|
||||
|
||||
// CHECK-LABEL: local_large_var_moved
|
||||
@ -255,7 +254,6 @@ pub fn local_large_var_cloned(f: fn(Gigastruct)) {
|
||||
// missing-NOT: __stack_chk_fail
|
||||
}
|
||||
|
||||
|
||||
extern "C" {
|
||||
// A call to an external `alloca` function is *not* recognized as an
|
||||
// `alloca(3)` operation. This function is a compiler built-in, as the
|
||||
@ -308,7 +306,6 @@ pub fn alloca_large_compile_time_constant_arg(f: fn(*mut ())) {
|
||||
// missing-NOT: __stack_chk_fail
|
||||
}
|
||||
|
||||
|
||||
// CHECK-LABEL: alloca_dynamic_arg
|
||||
#[no_mangle]
|
||||
pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
|
||||
@ -328,7 +325,6 @@ pub fn alloca_dynamic_arg(f: fn(*mut ()), n: usize) {
|
||||
// this is support for the "unsized locals" unstable feature:
|
||||
// https://doc.rust-lang.org/unstable-book/language-features/unsized-locals.html.
|
||||
|
||||
|
||||
// CHECK-LABEL: unsized_fn_param
|
||||
#[no_mangle]
|
||||
pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
|
||||
@ -342,7 +338,6 @@ pub fn unsized_fn_param(s: [u8], l: bool, f: fn([u8])) {
|
||||
// alloca, and is therefore not protected by the `strong` or `basic`
|
||||
// heuristics.
|
||||
|
||||
|
||||
// all: __stack_chk_fail
|
||||
// strong-NOT: __stack_chk_fail
|
||||
// basic-NOT: __stack_chk_fail
|
||||
|
@ -42,9 +42,7 @@ impl Sync for u8 {}
|
||||
// A64-NEXT: ldrb {{[a-z0-9]+}}, {{\[}}[[REG]], :lo12:chaenomeles]
|
||||
#[no_mangle]
|
||||
pub fn banana() -> u8 {
|
||||
unsafe {
|
||||
*(chaenomeles as *mut u8)
|
||||
}
|
||||
unsafe { *(chaenomeles as *mut u8) }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: peach:
|
||||
@ -53,9 +51,7 @@ pub fn banana() -> u8 {
|
||||
// A64-NEXT: ldrb {{[a-z0-9]+}}, {{\[}}[[REG2]], :lo12:banana]
|
||||
#[no_mangle]
|
||||
pub fn peach() -> u8 {
|
||||
unsafe {
|
||||
*(banana as *mut u8)
|
||||
}
|
||||
unsafe { *(banana as *mut u8) }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: mango:
|
||||
@ -65,9 +61,7 @@ pub fn peach() -> u8 {
|
||||
// A64-NEXT: ldr {{[a-z0-9]+}}, {{\[}}[[REG2]], :lo12:EXOCHORDA]
|
||||
#[no_mangle]
|
||||
pub fn mango() -> u8 {
|
||||
unsafe {
|
||||
*EXOCHORDA
|
||||
}
|
||||
unsafe { *EXOCHORDA }
|
||||
}
|
||||
|
||||
// CHECK-LABEL: orange:
|
||||
|
@ -4,5 +4,4 @@
|
||||
|
||||
// CHECK: main
|
||||
|
||||
pub fn main() {
|
||||
}
|
||||
pub fn main() {}
|
||||
|
@ -8,7 +8,7 @@
|
||||
#![feature(core_intrinsics)]
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
extern {
|
||||
extern "C" {
|
||||
fn may_panic();
|
||||
|
||||
#[rustc_nounwind]
|
||||
@ -19,7 +19,9 @@
|
||||
|
||||
impl Drop for LogOnDrop {
|
||||
fn drop(&mut self) {
|
||||
unsafe { log_number(0); }
|
||||
unsafe {
|
||||
log_number(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +29,9 @@ fn drop(&mut self) {
|
||||
#[no_mangle]
|
||||
pub fn test_cleanup() {
|
||||
let _log_on_drop = LogOnDrop;
|
||||
unsafe { may_panic(); }
|
||||
unsafe {
|
||||
may_panic();
|
||||
}
|
||||
|
||||
// CHECK-NOT: call
|
||||
// CHECK: try
|
||||
@ -41,12 +45,16 @@ pub fn test_cleanup() {
|
||||
#[no_mangle]
|
||||
pub fn test_rtry() {
|
||||
unsafe {
|
||||
core::intrinsics::catch_unwind(|_| {
|
||||
core::intrinsics::catch_unwind(
|
||||
|_| {
|
||||
may_panic();
|
||||
}, core::ptr::null_mut(), |data, exception| {
|
||||
},
|
||||
core::ptr::null_mut(),
|
||||
|data, exception| {
|
||||
log_number(data as usize);
|
||||
log_number(exception as usize);
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
// CHECK-NOT: call
|
||||
|
@ -5,7 +5,7 @@
|
||||
//@ only-x86_64-fortanix-unknown-sgx
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn plus_one(r: &mut u64) {
|
||||
pub extern "C" fn plus_one(r: &mut u64) {
|
||||
*r = *r + 1;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
//@ only-x86_64-fortanix-unknown-sgx
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn myret() {}
|
||||
pub extern "C" fn myret() {}
|
||||
// CHECK: myret:
|
||||
// CHECK: popq [[REGISTER:%[a-z]+]]
|
||||
// CHECK-NEXT: lfence
|
||||
|
Loading…
Reference in New Issue
Block a user