Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
b380d35
add ui test for issue-62097
csmoe Oct 23, 2019
dcc14c4
suggest to add a constraint except asyn-fn without explicit output
csmoe Oct 23, 2019
9124f7a
update suggestion ui test
csmoe Oct 23, 2019
405866a
re-add miri intrinsic ABI check
RalfJung Nov 16, 2019
44b6811
rename and move read_vector_ty
RalfJung Nov 16, 2019
09180d7
make simd_size return a u64
RalfJung Nov 16, 2019
8952c8a
ICE on invalid MIR
RalfJung Nov 16, 2019
5e115a2
avoid some casts
RalfJung Nov 16, 2019
5b0e702
Create a generic HashStable derive.
cjgillot Nov 9, 2019
c2e1658
Use proc_macro for HashStable derive in libsyntax.
cjgillot Nov 9, 2019
05f5f76
Move impl HashStable for SymbolStr in libsyntax_pos.
cjgillot Nov 9, 2019
1dd5133
Move impl HashStable for Symbol in libsyntax_pos.
cjgillot Nov 9, 2019
efcb695
Further HashStable_Generic derives.
cjgillot Nov 9, 2019
2a67986
HashStable literals in libsyntax.
cjgillot Nov 9, 2019
a265bc2
HashStable_Generic for libsyntax_pos.
cjgillot Nov 9, 2019
2ba84c6
HashStable_Generic for librustc_target.
cjgillot Nov 9, 2019
333c114
Derive HashStable in librustc_target.
cjgillot Nov 9, 2019
375a761
HashStable in libsyntax.
cjgillot Nov 9, 2019
79bde05
Derive HashStable for PanicStrategy.
cjgillot Nov 9, 2019
e8e7ad6
Implement HashStable for RangeInclusive.
cjgillot Nov 16, 2019
5b4dad7
Derive HashStable_Generic for ABI types.
cjgillot Nov 16, 2019
3d97a91
Remove extern crate.
cjgillot Nov 16, 2019
44a595f
Simplify impl for SymbolStr.
cjgillot Nov 16, 2019
eda67ba
Disable gdb pretty printer global section on wasm targets
alexcrichton Nov 18, 2019
c90ad20
ci: add support for GitHub Actions in the CI scripts
pietroalbini Nov 11, 2019
bca64ce
Point at type in `let` assignment on type errors
estebank Nov 19, 2019
b1a5bb0
ci: guess some environment variables based on builder name and os
pietroalbini Nov 18, 2019
360ddc3
Rollup merge of #65730 - csmoe:return-lifetime, r=nikomatsakis
Centril Nov 20, 2019
f16a729
Rollup merge of #66460 - cjgillot:hashstable_generic, r=Zoxc
Centril Nov 20, 2019
676c51a
Rollup merge of #66468 - RalfJung:simd-cleanup, r=oli-obk
Centril Nov 20, 2019
8ca51cb
Rollup merge of #66520 - alexcrichton:disable-gdb-wasm, r=eddyb
Centril Nov 20, 2019
e6e44cf
Rollup merge of #66539 - estebank:let-ty, r=Centril
Centril Nov 20, 2019
7785cc4
Rollup merge of #66569 - pietroalbini:gha-1, r=alexcrichton
Centril Nov 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename and move read_vector_ty
  • Loading branch information
RalfJung committed Nov 16, 2019
commit 44b68116c522ad8870f0a8627550ba1f5c8fc797
18 changes: 14 additions & 4 deletions src/librustc/ty/sty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1814,20 +1814,30 @@ impl<'tcx> TyS<'tcx> {

pub fn simd_type(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
match self.kind {
Adt(def, substs) => {
def.non_enum_variant().fields[0].ty(tcx, substs)
}
Adt(def, substs) => def.non_enum_variant().fields[0].ty(tcx, substs),
_ => bug!("simd_type called on invalid type")
}
}

pub fn simd_size(&self, _cx: TyCtxt<'_>) -> usize {
pub fn simd_size(&self, _tcx: TyCtxt<'tcx>) -> usize {
// Parameter currently unused, but probably needed in the future to
// allow `#[repr(simd)] struct Simd<T, const N: usize>([T; N]);`.
match self.kind {
Adt(def, _) => def.non_enum_variant().fields.len(),
_ => bug!("simd_size called on invalid type")
}
}

pub fn simd_size_and_type(&self, tcx: TyCtxt<'tcx>) -> (usize, Ty<'tcx>) {
match self.kind {
Adt(def, substs) => {
let variant = def.non_enum_variant();
(variant.fields.len(), variant.fields[0].ty(tcx, substs))
}
_ => bug!("simd_size_and_type called on invalid type")
}
}

#[inline]
pub fn is_region_ptr(&self) -> bool {
match self.kind {
Expand Down
21 changes: 11 additions & 10 deletions src/librustc_mir/interpret/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,11 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
self.copy_op_transmute(args[0], dest)?;
}
"simd_insert" => {
let index = self.read_scalar(args[1])?.to_u32()? as u64;
let scalar = args[2];
let index = u64::from(self.read_scalar(args[1])?.to_u32()?);
let elem = args[2];
let input = args[0];
let (len, e_ty) = self.read_vector_ty(input);
let (len, e_ty) = input.layout.ty.simd_size_and_type(self.tcx.tcx);
let len = len as u64;
assert!(
index < len,
"Index `{}` must be in bounds of vector type `{}`: `[0, {})`",
Expand All @@ -317,26 +318,26 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
dest.layout.ty, input.layout.ty
);
assert_eq!(
scalar.layout.ty, e_ty,
"Scalar type `{}` must match vector element type `{}`",
scalar.layout.ty, e_ty
elem.layout.ty, e_ty,
"Scalar element type `{}` must match vector element type `{}`",
elem.layout.ty, e_ty
);

for i in 0..len {
let place = self.place_field(dest, i)?;
let value = if i == index {
scalar
elem
} else {
self.operand_field(input, i)?
};
self.copy_op(value, place)?;
}
}
"simd_extract" => {
let index = self.read_scalar(args[1])?.to_u32()? as _;
let (len, e_ty) = self.read_vector_ty(args[0]);
let index = u64::from(self.read_scalar(args[1])?.to_u32()?);
let (len, e_ty) = args[0].layout.ty.simd_size_and_type(self.tcx.tcx);
assert!(
index < len,
index < len as u64,
"index `{}` is out-of-bounds of vector type `{}` with length `{}`",
index, e_ty, len
);
Expand Down
11 changes: 0 additions & 11 deletions src/librustc_mir/interpret/operand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,17 +315,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
}
}

/// Read vector length and element type
pub fn read_vector_ty(
&self, op: OpTy<'tcx, M::PointerTag>
) -> (u64, &rustc::ty::TyS<'tcx>) {
if let layout::Abi::Vector { .. } = op.layout.abi {
(op.layout.ty.simd_size(*self.tcx) as _, op.layout.ty.simd_type(*self.tcx))
} else {
bug!("Type `{}` is not a SIMD vector type", op.layout.ty)
}
}

/// Read a scalar from a place
pub fn read_scalar(
&self,
Expand Down