Skip to content

Commit c8da627

Browse files
committed
---
yaml --- r: 232462 b: refs/heads/try c: 8d8b489 h: refs/heads/master v: v3
1 parent 1492584 commit c8da627

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: ecb3df5a91b71e31e242737d9203b2798bd489de
4+
refs/heads/try: 8d8b489bc93b2f8754a0de386bd4e960b05a5b47
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/librustc_trans/trans/intrinsic.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,5 +1496,35 @@ fn generic_simd_intrinsic<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
14961496
}
14971497
require!(false, "SIMD cast intrinsic monomorphised with incompatible cast");
14981498
}
1499+
macro_rules! arith {
1500+
($($name: ident: $($($p: ident),* => $call: expr),*;)*) => {
1501+
$(
1502+
if name == stringify!($name) {
1503+
let in_ = arg_tys[0].simd_type(tcx);
1504+
match in_.sty {
1505+
$(
1506+
$(ty::$p(_))|* => {
1507+
return $call(bcx, llargs[0], llargs[1], call_debug_location)
1508+
}
1509+
)*
1510+
_ => {},
1511+
}
1512+
require!(false,
1513+
"{} intrinsic monomorphised with invalid type",
1514+
name)
1515+
})*
1516+
}
1517+
}
1518+
arith! {
1519+
simd_add: TyUint, TyInt => Add, TyFloat => FAdd;
1520+
simd_sub: TyUint, TyInt => Sub, TyFloat => FSub;
1521+
simd_mul: TyUint, TyInt => Mul, TyFloat => FMul;
1522+
simd_div: TyFloat => FDiv;
1523+
simd_shl: TyUint, TyInt => Shl;
1524+
simd_shr: TyUint => LShr, TyInt => AShr;
1525+
simd_and: TyUint, TyInt => And;
1526+
simd_or: TyUint, TyInt => Or;
1527+
simd_xor: TyUint, TyInt => Xor;
1528+
}
14991529
bcx.sess().span_bug(call_info.span, "unknown SIMD intrinsic");
15001530
}

branches/try/src/librustc_typeck/check/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5344,6 +5344,11 @@ pub fn check_intrinsic_type(ccx: &CrateCtxt, it: &ast::ForeignItem) {
53445344
"simd_eq" | "simd_ne" | "simd_lt" | "simd_le" | "simd_gt" | "simd_ge" => {
53455345
(2, vec![param(ccx, 0), param(ccx, 0)], param(ccx, 1))
53465346
}
5347+
"simd_add" | "simd_sub" | "simd_mul" |
5348+
"simd_div" | "simd_shl" | "simd_shr" |
5349+
"simd_and" | "simd_or" | "simd_xor" => {
5350+
(1, vec![param(ccx, 0), param(ccx, 0)], param(ccx, 0))
5351+
}
53475352
"simd_insert" => (2, vec![param(ccx, 0), tcx.types.u32, param(ccx, 1)], param(ccx, 0)),
53485353
"simd_extract" => (2, vec![param(ccx, 0), tcx.types.u32], param(ccx, 1)),
53495354
"simd_cast" => (2, vec![param(ccx, 0)], param(ccx, 1)),

0 commit comments

Comments
 (0)