diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index 95c187a7be22e..c0e6afc746958 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -122,7 +122,7 @@ pub fn range_rev(hi: T, lo: T, it: &fn(T) -> bool) { /// Computes the bitwise complement #[inline(always)] pub fn compl(i: T) -> T { - -1 as T ^ i + i ^ (-1 as T) } /// Computes the absolute value diff --git a/src/librustc/metadata/tyencode.rs b/src/librustc/metadata/tyencode.rs index c44a8e74130fd..954710c5efd44 100644 --- a/src/librustc/metadata/tyencode.rs +++ b/src/librustc/metadata/tyencode.rs @@ -292,6 +292,9 @@ fn enc_sty(w: @io::Writer, cx: @ctxt, st: ty::sty) { w.write_char('v'); enc_vstore(w, cx, v); } + ty::ty_multi(*) => { + fail!(); + } ty::ty_unboxed_vec(mt) => { w.write_char('U'); enc_mt(w, cx, mt); } ty::ty_closure(ref f) => { w.write_char('f'); diff --git a/src/librustc/middle/trans/build.rs b/src/librustc/middle/trans/build.rs index c3dc4f1e8eb2b..29fd90edce898 100644 --- a/src/librustc/middle/trans/build.rs +++ b/src/librustc/middle/trans/build.rs @@ -963,20 +963,28 @@ pub fn ExtractElement(cx: block, VecVal: ValueRef, Index: ValueRef) -> } pub fn InsertElement(cx: block, VecVal: ValueRef, EltVal: ValueRef, - Index: ValueRef) { + Index: ValueRef) -> ValueRef { unsafe { - if cx.unreachable { return; } + if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); } count_insn(cx, "insertelement"); - llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname()); + llvm::LLVMBuildInsertElement(B(cx), VecVal, EltVal, Index, noname()) } } pub fn ShuffleVector(cx: block, V1: ValueRef, V2: ValueRef, - Mask: ValueRef) { + Mask: ValueRef) -> ValueRef { unsafe { - if cx.unreachable { return; } + if cx.unreachable { return llvm::LLVMGetUndef(T_nil()); } count_insn(cx, "shufflevector"); - llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname()); + llvm::LLVMBuildShuffleVector(B(cx), V1, V2, Mask, noname()) + } +} + +pub fn VectorSplat(cx: block, NumElts: uint, EltVal: ValueRef) -> ValueRef { + unsafe { + let Undef = llvm::LLVMGetUndef(T_vector(val_ty(EltVal), NumElts)); + let VecVal = InsertElement(cx, Undef, EltVal, C_i32(0)); + ShuffleVector(cx, VecVal, Undef, C_null(T_vector(T_i32(), NumElts))) } } diff --git a/src/librustc/middle/trans/common.rs b/src/librustc/middle/trans/common.rs index 442b5d25c8ba2..b004ba9d41f34 100644 --- a/src/librustc/middle/trans/common.rs +++ b/src/librustc/middle/trans/common.rs @@ -984,6 +984,12 @@ pub fn T_array(t: TypeRef, n: uint) -> TypeRef { } } +pub fn T_vector(t: TypeRef, n: uint) -> TypeRef { + unsafe { + return llvm::LLVMVectorType(t, n as c_uint); + } +} + // Interior vector. pub fn T_vec2(targ_cfg: @session::config, t: TypeRef) -> TypeRef { return T_struct(~[T_int(targ_cfg), // fill diff --git a/src/librustc/middle/trans/expr.rs b/src/librustc/middle/trans/expr.rs index 0e8b2e0474661..43352fbec537e 100644 --- a/src/librustc/middle/trans/expr.rs +++ b/src/librustc/middle/trans/expr.rs @@ -1379,7 +1379,7 @@ fn trans_eager_binop(bcx: block, if ty::type_is_bot(lhs_t) { rhs_t } else { lhs_t } }; - let is_float = ty::type_is_fp(intype); + let is_float = ty::type_uses_fp(intype); let rhs = base::cast_shift_expr_rhs(bcx, op, lhs, rhs); @@ -1589,6 +1589,7 @@ pub enum cast_kind { cast_integral, cast_float, cast_enum, + cast_multi, cast_other, } @@ -1601,6 +1602,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind { ty::ty_uint(*) => cast_integral, ty::ty_bool => cast_integral, ty::ty_enum(*) => cast_enum, + ty::ty_multi(*) => cast_multi, _ => cast_other } } @@ -1662,6 +1664,10 @@ fn trans_imm_cast(bcx: block, expr: @ast::expr, _ => ccx.sess.bug(~"translating unsupported cast.") } } + (cast_integral, cast_multi) | + (cast_float, cast_multi) => { + VectorSplat(bcx, ty::multi_size(t_out), llexpr) + } _ => ccx.sess.bug(~"translating unsupported cast.") }; return immediate_rvalue_bcx(bcx, newval, t_out); diff --git a/src/librustc/middle/trans/reflect.rs b/src/librustc/middle/trans/reflect.rs index 9e1f10467e346..cbd905c79f5be 100644 --- a/src/librustc/middle/trans/reflect.rs +++ b/src/librustc/middle/trans/reflect.rs @@ -188,6 +188,9 @@ pub impl Reflector { let extra = extra + self.c_mt(mt); self.visit(~"evec_" + name, extra) } + ty::ty_multi(*) => { + fail!(); + } ty::ty_box(ref mt) => { let extra = self.c_mt(mt); self.visit(~"box", extra) diff --git a/src/librustc/middle/trans/type_of.rs b/src/librustc/middle/trans/type_of.rs index fc27c11c06f24..7f9f1e24cc277 100644 --- a/src/librustc/middle/trans/type_of.rs +++ b/src/librustc/middle/trans/type_of.rs @@ -146,6 +146,9 @@ pub fn sizing_type_of(cx: @CrateContext, t: ty::t) -> TypeRef { ty::ty_evec(mt, ty::vstore_fixed(size)) => { T_array(sizing_type_of(cx, mt.ty), size) } + ty::ty_multi(t, n) => { + T_vector(sizing_type_of(cx, t), n) + } ty::ty_unboxed_vec(mt) => T_vec(cx, sizing_type_of(cx, mt.ty)), @@ -253,6 +256,10 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef { T_array(type_of(cx, mt.ty), n) } + ty::ty_multi(t, n) => { + T_vector(type_of(cx, t), n) + } + ty::ty_bare_fn(_) => T_ptr(type_of_fn_from_ty(cx, t)), ty::ty_closure(_) => T_fn_pair(cx, type_of_fn_from_ty(cx, t)), ty::ty_trait(_, _, store, _) => T_opaque_trait(cx, store), diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index 892635416c2a4..91682d5c72549 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -576,6 +576,7 @@ pub enum sty { ty_box(mt), ty_uniq(mt), ty_evec(mt, vstore), + ty_multi(t, uint), ty_ptr(mt), ty_rptr(Region, mt), ty_bare_fn(BareFnTy), @@ -1009,6 +1010,9 @@ fn mk_t(cx: ctxt, st: sty) -> t { &ty_ptr(ref m) | &ty_unboxed_vec(ref m) => { flags |= get(m.ty).flags; } + &ty_multi(t, _) => { + flags |= get(t).flags; + } &ty_rptr(r, ref m) => { flags |= rflags(r); flags |= get(m.ty).flags; @@ -1188,6 +1192,10 @@ pub fn mk_evec(cx: ctxt, tm: mt, t: vstore) -> t { mk_t(cx, ty_evec(tm, t)) } +pub fn mk_multi(cx: ctxt, ty: t, n: uint) -> t { + mk_t(cx, ty_multi(ty, n)) +} + pub fn mk_unboxed_vec(cx: ctxt, tm: mt) -> t { mk_t(cx, ty_unboxed_vec(tm)) } @@ -1274,6 +1282,9 @@ pub fn maybe_walk_ty(ty: t, f: &fn(t) -> bool) { ty_ptr(ref tm) | ty_rptr(_, ref tm) | ty_uniq(ref tm) => { maybe_walk_ty(tm.ty, f); } + ty_multi(t, _) => { + maybe_walk_ty(t, f); + } ty_enum(_, ref substs) | ty_struct(_, ref substs) | ty_trait(_, ref substs, _, _) => { for (*substs).tps.each |subty| { maybe_walk_ty(*subty, f); } @@ -1337,6 +1348,9 @@ fn fold_sty(sty: &sty, fldop: &fn(t) -> t) -> sty { ty_evec(ref tm, vst) => { ty_evec(mt {ty: fldop(tm.ty), mutbl: tm.mutbl}, vst) } + ty_multi(t, n) => { + ty_multi(fldop(t), n) + } ty_enum(tid, ref substs) => { ty_enum(tid, fold_substs(substs, fldop)) } @@ -1567,6 +1581,13 @@ pub fn type_is_sequence(ty: t) -> bool { } } +pub fn type_is_multi(ty: t) -> bool { + match get(ty).sty { + ty_multi(*) => true, + _ => false + } +} + pub fn type_is_str(ty: t) -> bool { match get(ty).sty { ty_estr(_) => true, @@ -1583,6 +1604,20 @@ pub fn sequence_element_type(cx: ctxt, ty: t) -> t { } } +pub fn multi_type(ty: t) -> t { + match get(ty).sty { + ty_multi(t, _) => t, + _ => fail!(~"multi_type called on invalid type") + } +} + +pub fn multi_size(ty: t) -> uint { + match get(ty).sty { + ty_multi(_, n) => n, + _ => fail!(~"multi_size called on invalid type") + } +} + pub fn get_element_type(ty: t, i: uint) -> t { match get(ty).sty { ty_tup(ref ts) => return ts[i], @@ -1666,8 +1701,8 @@ pub fn type_is_scalar(ty: t) -> bool { } pub fn type_is_immediate(ty: t) -> bool { - return type_is_scalar(ty) || type_is_boxed(ty) || - type_is_unique(ty) || type_is_region_ptr(ty); + return type_is_scalar(ty) || type_is_multi(ty) || + type_is_boxed(ty) || type_is_unique(ty) || type_is_region_ptr(ty); } pub fn type_needs_drop(cx: ctxt, ty: t) -> bool { @@ -2025,6 +2060,10 @@ pub fn type_contents(cx: ctxt, ty: t) -> TypeContents { TC_NONE } + ty_multi(t, _) => { + tc_ty(cx, t, cache) + } + ty_struct(did, ref substs) => { let flds = struct_fields(cx, did, substs); let mut res = flds.foldl( @@ -2236,6 +2275,7 @@ pub fn is_instantiable(cx: ctxt, r_ty: t) -> bool { ty_opaque_box | ty_opaque_closure_ptr(_) | ty_evec(_, _) | + ty_multi(_, _) | ty_unboxed_vec(_) => { false } @@ -2370,6 +2410,14 @@ pub fn type_is_fp(ty: t) -> bool { } } +pub fn type_uses_fp(ty: t) -> bool { + match get(ty).sty { + ty_infer(FloatVar(_)) | ty_float(_) => true, + ty_multi(t, _) => type_uses_fp(t), + _ => false + } +} + pub fn type_is_numeric(ty: t) -> bool { return type_is_integral(ty) || type_is_fp(ty); } @@ -2412,6 +2460,9 @@ pub fn type_is_pod(cx: ctxt, ty: t) -> bool { ty_evec(ref mt, vstore_fixed(_)) | ty_unboxed_vec(ref mt) => { result = type_is_pod(cx, mt.ty); } + ty_multi(t, _) => { + result = type_is_pod(cx, t); + } ty_param(_) => result = false, ty_opaque_closure_ptr(_) => result = true, ty_struct(did, ref substs) => { @@ -2657,6 +2708,9 @@ impl to_bytes::IterBytes for sty { ty_tup(ref ts) => to_bytes::iter_bytes_2(&10u8, ts, lsb0, f), + ty_multi(ref t, ref n) => + to_bytes::iter_bytes_3(&11u8, t, n, lsb0, f), + ty_bare_fn(ref ft) => to_bytes::iter_bytes_2(&12u8, ft, lsb0, f), @@ -3315,6 +3369,7 @@ pub fn ty_sort_str(cx: ctxt, t: t) -> ~str { ty_box(_) => ~"@-ptr", ty_uniq(_) => ~"~-ptr", ty_evec(_, _) => ~"vector", + ty_multi(_, _) => ~"SIMD vector", ty_unboxed_vec(_) => ~"unboxed vector", ty_ptr(_) => ~"*-ptr", ty_rptr(_, _) => ~"&-ptr", @@ -4096,6 +4151,7 @@ pub fn is_binopable(_cx: ctxt, ty: t, op: ast::binop) -> bool { ty_bool => tycat_bool, ty_int(_) | ty_uint(_) | ty_infer(IntVar(_)) => tycat_int, ty_float(_) | ty_infer(FloatVar(_)) => tycat_float, + ty_multi(ty, _) => tycat(ty), ty_tup(_) | ty_enum(_, _) => tycat_struct, ty_bot => tycat_bot, _ => tycat_other diff --git a/src/librustc/middle/typeck/astconv.rs b/src/librustc/middle/typeck/astconv.rs index 7ef77646f5203..7e47befc6ef6d 100644 --- a/src/librustc/middle/typeck/astconv.rs +++ b/src/librustc/middle/typeck/astconv.rs @@ -477,6 +477,9 @@ pub fn ast_ty_to_ty( } } } + ast::ty_multi(t, n) => { + ty::mk_multi(tcx, ast_ty_to_ty(self, rscope, t), n) + } ast::ty_infer => { // ty_infer should only appear as the type of arguments or return // values in a fn_expr, or as the type of local variables. Both of diff --git a/src/librustc/middle/typeck/check/method.rs b/src/librustc/middle/typeck/check/method.rs index 08398f9880a40..7340c4e5b18b3 100644 --- a/src/librustc/middle/typeck/check/method.rs +++ b/src/librustc/middle/typeck/check/method.rs @@ -783,8 +783,8 @@ pub impl<'self> LookupContext<'self> { ty_infer(IntVar(_)) | ty_infer(FloatVar(_)) | ty_self(_) | ty_param(*) | ty_nil | ty_bot | ty_bool | - ty_int(*) | ty_uint(*) | - ty_float(*) | ty_enum(*) | ty_ptr(*) | ty_struct(*) | ty_tup(*) | + ty_int(*) | ty_uint(*) | ty_float(*) | ty_multi(*) | + ty_enum(*) | ty_ptr(*) | ty_struct(*) | ty_tup(*) | ty_estr(*) | ty_evec(*) | ty_trait(*) | ty_closure(*) => { self.search_for_some_kind_of_autorefd_method( AutoPtr, autoderefs, [m_const, m_imm, m_mutbl], diff --git a/src/librustc/middle/typeck/check/mod.rs b/src/librustc/middle/typeck/check/mod.rs index e171765ef6c4e..f45e44c121e44 100644 --- a/src/librustc/middle/typeck/check/mod.rs +++ b/src/librustc/middle/typeck/check/mod.rs @@ -2636,6 +2636,9 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt, if type_is_c_like_enum(fcx,expr.span,t_e) && t_1_is_scalar { /* this case is allowed */ + } else if ty::type_is_multi(t_1) { + demand::suptype(fcx, e.span, + ty::multi_type(t_1), t_e); } else if type_is_region_ptr(fcx, expr.span, t_e) && type_is_unsafe_ptr(fcx, expr.span, t_1) { diff --git a/src/librustc/middle/typeck/coherence.rs b/src/librustc/middle/typeck/coherence.rs index 82ef09a83bee9..d764e75454e6c 100644 --- a/src/librustc/middle/typeck/coherence.rs +++ b/src/librustc/middle/typeck/coherence.rs @@ -27,7 +27,7 @@ use middle::ty::{lookup_item_type, subst}; use middle::ty::{substs, t, ty_bool, ty_bot, ty_box, ty_enum, ty_err}; use middle::ty::{ty_estr, ty_evec, ty_float, ty_infer, ty_int, ty_nil}; use middle::ty::{ty_opaque_box, ty_param, ty_param_bounds_and_ty, ty_ptr}; -use middle::ty::{ty_rptr, ty_self, ty_struct, ty_trait, ty_tup}; +use middle::ty::{ty_rptr, ty_self, ty_struct, ty_trait, ty_tup, ty_multi}; use middle::ty::{ty_type, ty_uint, ty_uniq, ty_bare_fn, ty_closure}; use middle::ty::{ty_opaque_closure_ptr, ty_unboxed_vec}; use middle::ty::{type_is_ty_var}; @@ -90,8 +90,8 @@ pub fn get_base_type(inference_context: @mut InferCtxt, ty_nil | ty_bot | ty_bool | ty_int(*) | ty_uint(*) | ty_float(*) | ty_estr(*) | ty_evec(*) | ty_bare_fn(*) | ty_closure(*) | ty_tup(*) | ty_infer(*) | ty_param(*) | ty_self(*) | ty_type | ty_opaque_box | - ty_opaque_closure_ptr(*) | ty_unboxed_vec(*) | ty_err | ty_box(_) | - ty_uniq(_) | ty_ptr(_) | ty_rptr(_, _) => { + ty_opaque_closure_ptr(*) | ty_unboxed_vec(*) | ty_multi(*) | ty_err | + ty_box(*) | ty_uniq(*) | ty_ptr(*) | ty_rptr(*) => { debug!("(getting base type) no base type; found %?", get(original_type).sty); None diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 59a0a1ba3d611..ef5c645d89821 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -15,7 +15,7 @@ use middle::ty::{br_fresh, ctxt, field, method}; use middle::ty::{mt, t, param_bound, param_ty}; use middle::ty::{re_bound, re_free, re_scope, re_infer, re_static, Region, re_empty}; -use middle::ty::{ty_bool, ty_bot, ty_box, ty_struct, ty_enum}; +use middle::ty::{ty_bool, ty_bot, ty_box, ty_struct, ty_enum, ty_multi}; use middle::ty::{ty_err, ty_estr, ty_evec, ty_float, ty_bare_fn, ty_closure}; use middle::ty::{ty_nil, ty_opaque_box, ty_opaque_closure_ptr, ty_param}; use middle::ty::{ty_ptr, ty_rptr, ty_self, ty_tup, ty_type, ty_uniq}; @@ -457,6 +457,7 @@ pub fn ty_to_str(cx: ctxt, typ: t) -> ~str { vstore_ty_to_str(cx, mt, vs) } ty_estr(vs) => fmt!("%s%s", vstore_to_str(cx, vs), ~"str"), + ty_multi(t, n) => fmt!("%s^%u", ty_to_str(cx, t), n), ty_opaque_box => ~"@?", ty_opaque_closure_ptr(ast::BorrowedSigil) => ~"closure&", ty_opaque_closure_ptr(ast::ManagedSigil) => ~"closure@", diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 2216226ecb3ab..b7e65c5c62109 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -861,6 +861,7 @@ pub enum ty_ { ty_uniq(mt), ty_vec(mt), ty_fixed_length_vec(mt, @expr), + ty_multi(@Ty, uint), ty_ptr(mt), ty_rptr(Option<@Lifetime>, mt), ty_closure(@TyClosure), diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 229a8664d0c35..5b0472dbc55a9 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -611,6 +611,7 @@ pub fn noop_fold_ty(t: &ty_, fld: @ast_fold) -> ty_ { fld.fold_expr(e) ) } + ty_multi(t, n) => ty_multi(fld.fold_ty(t), n), ty_mac(ref mac) => ty_mac(fold_mac(*mac)) } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 810efd3917765..d445f2a9e92fa 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -50,7 +50,7 @@ use ast::{sty_box, sty_region, sty_static, sty_uniq, sty_value}; use ast::{token_tree, trait_method, trait_ref, tt_delim, tt_seq, tt_tok}; use ast::{tt_nonterminal, tuple_variant_kind, Ty, ty_, ty_bot, ty_box}; use ast::{ty_field, ty_fixed_length_vec, ty_closure, ty_bare_fn}; -use ast::{ty_infer, ty_method}; +use ast::{ty_infer, ty_method, ty_multi}; use ast::{ty_nil, TyParam, TyParamBound, ty_path, ty_ptr, ty_rptr}; use ast::{ty_tup, ty_u32, ty_uniq, ty_vec, uniq}; use ast::{unnamed_field, unsafe_blk, unsafe_fn, view_item}; @@ -707,7 +707,22 @@ pub impl Parser { || is_ident_or_path(&*self.token) { // NAMED TYPE let path = self.parse_path_with_tps(false); - ty_path(path, self.get_id()) + let t = ty_path(path, self.get_id()); + let sp = mk_sp(lo, self.last_span.hi); + if self.eat(&token::BINOP(token::CARET)) { + match *self.token { + token::LIT_INT_UNSUFFIXED(i) if i > 0 => { + self.bump(); + let t = @Ty {id: self.get_id(), node: t, span: sp}; + ty_multi(t, i as uint) + } + _ => { + self.fatal(~"expected SIMD vector length") + } + } + } else { + t + } } else { self.fatal(fmt!("expected type, found token %?", *self.token)); diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 6f3d6604d5b98..25669dde42e4a 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -429,6 +429,11 @@ pub fn print_type(s: @ps, ty: @ast::Ty) { print_expr(s, v); word(s.s, ~"]"); } + ast::ty_multi(t, n) => { + print_type(s, t); + word(s.s, ~" ^ "); + word(s.s, n.to_str()); + } ast::ty_mac(_) => { fail!(~"print_type doesn't know how to print a ty_mac"); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 90dd49d684843..cc4c5108deedf 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -255,6 +255,7 @@ pub fn visit_ty(t: @Ty, e: E, v: vt) { (v.visit_ty)(mt.ty, e, v); (v.visit_expr)(ex, e, v); }, + ty_multi(t, _) => (v.visit_ty)(t, e, v), ty_nil | ty_bot | ty_mac(_) | ty_infer => () } } diff --git a/src/test/compile-fail/simd-cast.rs b/src/test/compile-fail/simd-cast.rs new file mode 100644 index 0000000000000..88dca9804b5c7 --- /dev/null +++ b/src/test/compile-fail/simd-cast.rs @@ -0,0 +1,7 @@ +type i32x4 = i32 ^ 4; + +fn test(e: f32) { + e as i32x4; //~ ERROR expected `i32` but found `f32` +} + +fn main() {} diff --git a/src/test/compile-fail/simd-type.rs b/src/test/compile-fail/simd-type.rs new file mode 100644 index 0000000000000..61bab63ccc5f9 --- /dev/null +++ b/src/test/compile-fail/simd-type.rs @@ -0,0 +1,3 @@ +type v = f32 ^ 0; //~ ERROR expected SIMD vector length + +fn main() {} diff --git a/src/test/run-pass/simd-binop.rs b/src/test/run-pass/simd-binop.rs new file mode 100644 index 0000000000000..7e8ec118f18fb --- /dev/null +++ b/src/test/run-pass/simd-binop.rs @@ -0,0 +1,18 @@ +type i32x4 = i32 ^ 4; +type f64x2 = f64 ^ 2; + +fn test_int(e: i32) { + let v = e as i32x4; + v + v; + v - v; + v * v; +} + +fn test_float(e: f64) { + let v = e as f64x2; + v + v; + v - v; + v * v; +} + +fn main() {} diff --git a/src/test/run-pass/simd-cast.rs b/src/test/run-pass/simd-cast.rs new file mode 100644 index 0000000000000..de9d8d582d3a3 --- /dev/null +++ b/src/test/run-pass/simd-cast.rs @@ -0,0 +1,7 @@ +type i32x4 = i32 ^ 4; + +fn test(e: i32) { + e as i32x4; +} + +fn main() {} diff --git a/src/test/run-pass/simd-type.rs b/src/test/run-pass/simd-type.rs new file mode 100644 index 0000000000000..02964a5c8efe4 --- /dev/null +++ b/src/test/run-pass/simd-type.rs @@ -0,0 +1,4 @@ +type i32x4 = i32 ^ 4; +type f64x2 = f64 ^ 2; + +fn main() {}