Sync from rust aed2187d53b8789e3a37f50ae36f894a2a679077
This commit is contained in:
commit
18a109e2da
@ -149,7 +149,7 @@ pub fn array_as_slice(arr: &[u8; 3]) -> &[u8] {
|
||||
arr
|
||||
}
|
||||
|
||||
pub unsafe fn use_ctlz_nonzero(a: u16) -> u16 {
|
||||
pub unsafe fn use_ctlz_nonzero(a: u16) -> u32 {
|
||||
intrinsics::ctlz_nonzero(a)
|
||||
}
|
||||
|
||||
|
@ -627,7 +627,7 @@ pub mod intrinsics {
|
||||
pub fn min_align_of_val<T: ?::Sized>(val: *const T) -> usize;
|
||||
pub fn copy<T>(src: *const T, dst: *mut T, count: usize);
|
||||
pub fn transmute<T, U>(e: T) -> U;
|
||||
pub fn ctlz_nonzero<T>(x: T) -> T;
|
||||
pub fn ctlz_nonzero<T>(x: T) -> u32;
|
||||
#[rustc_safe_intrinsic]
|
||||
pub fn needs_drop<T: ?::Sized>() -> bool;
|
||||
#[rustc_safe_intrinsic]
|
||||
|
@ -1,4 +1,4 @@
|
||||
#![feature(coroutines, coroutine_trait)]
|
||||
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
|
||||
|
||||
use std::ops::Coroutine;
|
||||
use std::pin::Pin;
|
||||
@ -8,7 +8,8 @@ fn main() {
|
||||
}
|
||||
|
||||
fn run_coroutine<T>() {
|
||||
let mut coroutine = || {
|
||||
let mut coroutine = #[coroutine]
|
||||
|| {
|
||||
yield;
|
||||
return;
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
#![feature(
|
||||
core_intrinsics,
|
||||
coroutines,
|
||||
stmt_expr_attributes,
|
||||
coroutine_trait,
|
||||
is_sorted,
|
||||
repr_simd,
|
||||
@ -123,9 +124,12 @@ fn main() {
|
||||
test_simd();
|
||||
}
|
||||
|
||||
Box::pin(move |mut _task_context| {
|
||||
yield ();
|
||||
})
|
||||
Box::pin(
|
||||
#[coroutine]
|
||||
move |mut _task_context| {
|
||||
yield ();
|
||||
},
|
||||
)
|
||||
.as_mut()
|
||||
.resume(0);
|
||||
|
||||
|
@ -7,7 +7,7 @@ use cranelift_codegen::binemit::CodeOffset;
|
||||
use cranelift_codegen::MachSrcLoc;
|
||||
use gimli::write::{AttributeValue, FileId, FileInfo, LineProgram, LineString, LineStringTable};
|
||||
use rustc_span::{
|
||||
FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm,
|
||||
hygiene, FileName, Pos, SourceFile, SourceFileAndLine, SourceFileHash, SourceFileHashAlgorithm,
|
||||
};
|
||||
|
||||
use crate::debuginfo::emit::address_for_func;
|
||||
@ -63,11 +63,8 @@ impl DebugContext {
|
||||
function_span: Span,
|
||||
span: Span,
|
||||
) -> (FileId, u64, u64) {
|
||||
// Based on https://github.com/rust-lang/rust/blob/e369d87b015a84653343032833d65d0545fd3f26/src/librustc_codegen_ssa/mir/mod.rs#L116-L131
|
||||
// In order to have a good line stepping behavior in debugger, we overwrite debug
|
||||
// locations of macro expansions with that of the outermost expansion site (when the macro is
|
||||
// annotated with `#[collapse_debuginfo]` or when `-Zdebug-macros` is provided).
|
||||
let span = tcx.collapsed_debuginfo(span, function_span);
|
||||
// Match behavior of `FunctionCx::adjusted_span_and_dbg_scope`.
|
||||
let span = hygiene::walk_chain_collapsed(span, function_span);
|
||||
match tcx.sess.source_map().lookup_line(span.lo()) {
|
||||
Ok(SourceFileAndLine { sf: file, line }) => {
|
||||
let file_id = self.add_source_file(&file);
|
||||
|
@ -26,6 +26,7 @@ use rustc_span::source_map::Spanned;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
|
||||
pub(crate) use self::llvm::codegen_llvm_intrinsic_call;
|
||||
use crate::cast::clif_intcast;
|
||||
use crate::prelude::*;
|
||||
|
||||
fn bug_on_incorrect_arg_count(intrinsic: impl std::fmt::Display) -> ! {
|
||||
@ -627,7 +628,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
// FIXME trap on `ctlz_nonzero` with zero arg.
|
||||
let res = fx.bcx.ins().clz(val);
|
||||
let res = CValue::by_val(res, arg.layout());
|
||||
let res = clif_intcast(fx, res, types::I32, false);
|
||||
let res = CValue::by_val(res, ret.layout());
|
||||
ret.write_cvalue(fx, res);
|
||||
}
|
||||
sym::cttz | sym::cttz_nonzero => {
|
||||
@ -636,7 +638,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
// FIXME trap on `cttz_nonzero` with zero arg.
|
||||
let res = fx.bcx.ins().ctz(val);
|
||||
let res = CValue::by_val(res, arg.layout());
|
||||
let res = clif_intcast(fx, res, types::I32, false);
|
||||
let res = CValue::by_val(res, ret.layout());
|
||||
ret.write_cvalue(fx, res);
|
||||
}
|
||||
sym::ctpop => {
|
||||
@ -644,7 +647,8 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
let val = arg.load_scalar(fx);
|
||||
|
||||
let res = fx.bcx.ins().popcnt(val);
|
||||
let res = CValue::by_val(res, arg.layout());
|
||||
let res = clif_intcast(fx, res, types::I32, false);
|
||||
let res = CValue::by_val(res, ret.layout());
|
||||
ret.write_cvalue(fx, res);
|
||||
}
|
||||
sym::bitreverse => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user