@@ -155,9 +155,15 @@ pub fn sizing_type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
155
155
}
156
156
157
157
ty:: ty_struct( did, _) => {
158
- let repr = adt:: represent_type ( cx, t) ;
159
- let packed = ty:: lookup_packed ( cx. tcx , did) ;
160
- T_struct ( adt:: sizing_fields_of ( cx, repr) , packed)
158
+ if ty:: type_is_simd ( cx. tcx , t) {
159
+ let et = ty:: simd_type ( cx. tcx , t) ;
160
+ let n = ty:: simd_size ( cx. tcx , t) ;
161
+ T_vector ( type_of ( cx, et) , n)
162
+ } else {
163
+ let repr = adt:: represent_type ( cx, t) ;
164
+ let packed = ty:: lookup_packed ( cx. tcx , did) ;
165
+ T_struct ( adt:: sizing_fields_of ( cx, repr) , packed)
166
+ }
161
167
}
162
168
163
169
ty:: ty_self( _) | ty:: ty_infer( * ) | ty:: ty_param( * ) | ty:: ty_err( * ) => {
@@ -263,14 +269,19 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
263
269
}
264
270
ty:: ty_opaque_closure_ptr( _) => T_opaque_box_ptr ( cx) ,
265
271
ty:: ty_struct( did, ref substs) => {
266
- // Only create the named struct, but don't fill it in. We fill it
267
- // in *after* placing it into the type cache. This prevents
268
- // infinite recursion with recursive struct types.
269
-
270
- common:: T_named_struct ( llvm_type_name ( cx,
271
- a_struct,
272
- did,
273
- /*bad*/ copy substs. tps ) )
272
+ if ty:: type_is_simd ( cx. tcx , t) {
273
+ let et = ty:: simd_type ( cx. tcx , t) ;
274
+ let n = ty:: simd_size ( cx. tcx , t) ;
275
+ T_vector ( type_of ( cx, et) , n)
276
+ } else {
277
+ // Only create the named struct, but don't fill it in. We fill it
278
+ // in *after* placing it into the type cache. This prevents
279
+ // infinite recursion with recursive struct types.
280
+ T_named_struct ( llvm_type_name ( cx,
281
+ a_struct,
282
+ did,
283
+ /*bad*/ copy substs. tps ) )
284
+ }
274
285
}
275
286
ty:: ty_self( * ) => cx. tcx . sess . unimpl ( ~"type_of: ty_self") ,
276
287
ty:: ty_infer( * ) => cx. tcx . sess . bug ( ~"type_of with ty_infer") ,
@@ -289,10 +300,12 @@ pub fn type_of(cx: @CrateContext, t: ty::t) -> TypeRef {
289
300
}
290
301
291
302
ty:: ty_struct( did, _) => {
292
- let repr = adt:: represent_type ( cx, t) ;
293
- let packed = ty:: lookup_packed ( cx. tcx , did) ;
294
- common:: set_struct_body ( llty, adt:: fields_of ( cx, repr) ,
295
- packed) ;
303
+ if !ty:: type_is_simd ( cx. tcx , t) {
304
+ let repr = adt:: represent_type ( cx, t) ;
305
+ let packed = ty:: lookup_packed ( cx. tcx , did) ;
306
+ common:: set_struct_body ( llty, adt:: fields_of ( cx, repr) ,
307
+ packed) ;
308
+ }
296
309
}
297
310
_ => ( )
298
311
}
0 commit comments