Skip to content

Commit 0b3fd11

Browse files
committed
---
yaml --- r: 233461 b: refs/heads/beta c: 8d8b489 h: refs/heads/master i: 233459: cc1ad3e v: v3
1 parent 8f8f41c commit 0b3fd11

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
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: ecb3df5a91b71e31e242737d9203b2798bd489de
26+
refs/heads/beta: 8d8b489bc93b2f8754a0de386bd4e960b05a5b47
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 370fe2786109360f7c35b8ba552b83b773dd71d6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/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/beta/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)