Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1b3fe75
Allow simd_shuffle to accept vectors of any length
calebzulawski Sep 11, 2021
37196e3
Suggest replacing an inexisting field for an unmentioned field
hkmatsumoto Aug 12, 2021
ffdabc8
Check for shadowing issues involving block labels
tmiasko Sep 15, 2021
bd4c967
Fix linting when trailing macro expands to a trailing semi
Aaron1011 Sep 16, 2021
4a4ca94
Fix shuffle index constant not being monomorphized.
calebzulawski Sep 16, 2021
2b512cc
fix potential race in AtomicU64 time monotonizer
the8472 Sep 16, 2021
f84000d
Add a separate error for `dyn Trait` in `const fn`
WaffleLapkin Sep 16, 2021
57465d9
use AtomicU64::fetch_update instead of handrolled RMW-loop
the8472 Sep 17, 2021
ec34aa6
modify std::os docs to be more consistent
schctl Sep 17, 2021
05b01cd
refactor: VecDeques IntoIter fields to private
DeveloperC286 Sep 17, 2021
68147eb
Suggest better place to add call parentheses for method expressions w…
Kobzol Sep 17, 2021
3f75ab3
Fix typo
Sep 18, 2021
ebd31f5
Rollup merge of #87960 - hkmatsumoto:suggest-inexisting-field-for-unm…
JohnTitor Sep 19, 2021
e675073
Rollup merge of #88855 - calebzulawski:feature/simd_shuffle, r=nagisa
JohnTitor Sep 19, 2021
ba1a90a
Rollup merge of #88966 - tmiasko:block-label-shadowing, r=petrochenkov
JohnTitor Sep 19, 2021
1c3fce0
Rollup merge of #88996 - Aaron1011:trailing-macro-semi, r=petrochenkov
JohnTitor Sep 19, 2021
91c5e7c
Rollup merge of #89017 - the8472:fix-u64-time-monotonizer, r=kennytm
JohnTitor Sep 19, 2021
61bfe36
Rollup merge of #89021 - WaffleLapkin:separate_error_for_dyn_trait_in…
JohnTitor Sep 19, 2021
4366059
Rollup merge of #89051 - schctl:master, r=jyn514
JohnTitor Sep 19, 2021
e4dbe27
Rollup merge of #89053 - DeveloperC286:into_iter_fields_to_private, r…
JohnTitor Sep 19, 2021
441046a
Rollup merge of #89055 - Kobzol:wrapped-method-expr-call-parens, r=we…
JohnTitor Sep 19, 2021
4877ad3
Rollup merge of #89081 - ondra05:patch-1, r=dtolnay
JohnTitor Sep 19, 2021
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
Fix shuffle index constant not being monomorphized.
  • Loading branch information
calebzulawski committed Sep 16, 2021
commit 4a4ca941515399694227d720ece032e299470c91
8 changes: 6 additions & 2 deletions compiler/rustc_codegen_ssa/src/mir/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
if i == 2 && intrinsic.as_str().starts_with("simd_shuffle") {
if let mir::Operand::Constant(constant) = arg {
let c = self.eval_mir_constant(constant);
let (llval, ty) =
self.simd_shuffle_indices(&bx, constant.span, constant.ty(), c);
let (llval, ty) = self.simd_shuffle_indices(
&bx,
constant.span,
self.monomorphize(constant.ty()),
c,
);
return OperandRef {
val: Immediate(llval),
layout: bx.layout_of(ty),
Expand Down
40 changes: 40 additions & 0 deletions src/test/ui/simd/monomorphize-shuffle-index.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//run-pass
#![feature(repr_simd, platform_intrinsics)]

extern "platform-intrinsic" {
fn simd_shuffle<T, I, U>(a: T, b: T, i: I) -> U;
}

#[derive(Copy, Clone)]
#[repr(simd)]
struct Simd<T, const N: usize>([T; N]);

trait Shuffle<const N: usize> {
const I: [u32; N];

unsafe fn shuffle<T, const M: usize>(&self, a: Simd<T, M>, b: Simd<T, M>) -> Simd<T, N> {
simd_shuffle(a, b, Self::I)
}
}

fn main() {
struct I1;
impl Shuffle<4> for I1 {
const I: [u32; 4] = [0, 2, 4, 6];
}

struct I2;
impl Shuffle<2> for I2 {
const I: [u32; 2] = [1, 5];
}

let a = Simd::<u8, 4>([0, 1, 2, 3]);
let b = Simd::<u8, 4>([4, 5, 6, 7]);
unsafe {
let x: Simd<u8, 4> = I1.shuffle(a, b);
assert_eq!(x.0, [0, 2, 4, 6]);

let y: Simd<u8, 2> = I2.shuffle(a, b);
assert_eq!(y.0, [1, 5]);
}
}