@@ -1260,6 +1260,36 @@ fn generic_simd_intrinsic<'a, 'tcx>(
1260
1260
return simd_simple_float_intrinsic ( "fma" , in_elem, in_ty, in_len, bx, span, args) ;
1261
1261
}
1262
1262
1263
+ // FIXME: use:
1264
+ // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Function.h#L182
1265
+ // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81
1266
+ fn llvm_vector_str ( elem_ty : ty:: Ty , vec_len : usize , no_pointers : usize ) -> String {
1267
+ let p0s: String = "p0" . repeat ( no_pointers) ;
1268
+ match elem_ty. sty {
1269
+ ty:: TyInt ( v) => format ! ( "v{}{}i{}" , vec_len, p0s, v. bit_width( ) . unwrap( ) ) ,
1270
+ ty:: TyUint ( v) => format ! ( "v{}{}i{}" , vec_len, p0s, v. bit_width( ) . unwrap( ) ) ,
1271
+ ty:: TyFloat ( v) => format ! ( "v{}{}f{}" , vec_len, p0s, v. bit_width( ) ) ,
1272
+ _ => unreachable ! ( ) ,
1273
+ }
1274
+ }
1275
+
1276
+ fn llvm_vector_ty ( cx : & CodegenCx , elem_ty : ty:: Ty , vec_len : usize ,
1277
+ mut no_pointers : usize ) -> Type {
1278
+ // FIXME: use cx.layout_of(ty).llvm_type() ?
1279
+ let mut elem_ty = match elem_ty. sty {
1280
+ ty:: TyInt ( v) => Type :: int_from_ty ( cx, v) ,
1281
+ ty:: TyUint ( v) => Type :: uint_from_ty ( cx, v) ,
1282
+ ty:: TyFloat ( v) => Type :: float_from_ty ( cx, v) ,
1283
+ _ => unreachable ! ( ) ,
1284
+ } ;
1285
+ while no_pointers > 0 {
1286
+ elem_ty = elem_ty. ptr_to ( ) ;
1287
+ no_pointers -= 1 ;
1288
+ }
1289
+ Type :: vector ( & elem_ty, vec_len as u64 )
1290
+ }
1291
+
1292
+
1263
1293
if name == "simd_gather" {
1264
1294
// simd_gather(values: <N x T>, pointers: <N x *_ T>,
1265
1295
// mask: <N x i{M}>) -> <N x T>
@@ -1343,36 +1373,6 @@ fn generic_simd_intrinsic<'a, 'tcx>(
1343
1373
( bx. trunc ( args[ 2 ] . immediate ( ) , i1xn) , i1xn)
1344
1374
} ;
1345
1375
1346
- // FIXME: use:
1347
- // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Function.h#L182
1348
- // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81
1349
- fn llvm_vector_str ( elem_ty : ty:: Ty , vec_len : usize , no_pointers : usize ) -> String {
1350
- let p0s: String = "p0" . repeat ( no_pointers) ;
1351
- match elem_ty. sty {
1352
- ty:: TyInt ( v) => format ! ( "v{}{}i{}" , vec_len, p0s, v. bit_width( ) . unwrap( ) ) ,
1353
- ty:: TyUint ( v) => format ! ( "v{}{}i{}" , vec_len, p0s, v. bit_width( ) . unwrap( ) ) ,
1354
- ty:: TyFloat ( v) => format ! ( "v{}{}f{}" , vec_len, p0s, v. bit_width( ) ) ,
1355
- _ => unreachable ! ( ) ,
1356
- }
1357
- }
1358
-
1359
- fn llvm_vector_ty ( cx : & CodegenCx , elem_ty : ty:: Ty , vec_len : usize ,
1360
- mut no_pointers : usize ) -> Type {
1361
- // FIXME: use cx.layout_of(ty).llvm_type() ?
1362
- let mut elem_ty = match elem_ty. sty {
1363
- ty:: TyInt ( v) => Type :: int_from_ty ( cx, v) ,
1364
- ty:: TyUint ( v) => Type :: uint_from_ty ( cx, v) ,
1365
- ty:: TyFloat ( v) => Type :: float_from_ty ( cx, v) ,
1366
- _ => unreachable ! ( ) ,
1367
- } ;
1368
- while no_pointers > 0 {
1369
- elem_ty = elem_ty. ptr_to ( ) ;
1370
- no_pointers -= 1 ;
1371
- }
1372
- Type :: vector ( & elem_ty, vec_len as u64 )
1373
- }
1374
-
1375
-
1376
1376
// Type of the vector of pointers:
1377
1377
let llvm_pointer_vec_ty = llvm_vector_ty ( bx. cx , underlying_ty, in_len, pointer_count) ;
1378
1378
let llvm_pointer_vec_str = llvm_vector_str ( underlying_ty, in_len, pointer_count) ;
@@ -1472,36 +1472,6 @@ fn generic_simd_intrinsic<'a, 'tcx>(
1472
1472
1473
1473
let ret_t = Type :: void ( bx. cx ) ;
1474
1474
1475
- // FIXME: use:
1476
- // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Function.h#L182
1477
- // https://github.com/llvm-mirror/llvm/blob/master/include/llvm/IR/Intrinsics.h#L81
1478
- fn llvm_vector_str ( elem_ty : ty:: Ty , vec_len : usize , no_pointers : usize ) -> String {
1479
- let p0s: String = "p0" . repeat ( no_pointers) ;
1480
- match elem_ty. sty {
1481
- ty:: TyInt ( v) => format ! ( "v{}{}i{}" , vec_len, p0s, v. bit_width( ) . unwrap( ) ) ,
1482
- ty:: TyUint ( v) => format ! ( "v{}{}i{}" , vec_len, p0s, v. bit_width( ) . unwrap( ) ) ,
1483
- ty:: TyFloat ( v) => format ! ( "v{}{}f{}" , vec_len, p0s, v. bit_width( ) ) ,
1484
- _ => unreachable ! ( ) ,
1485
- }
1486
- }
1487
-
1488
- fn llvm_vector_ty ( cx : & CodegenCx , elem_ty : ty:: Ty , vec_len : usize ,
1489
- mut no_pointers : usize ) -> Type {
1490
- // FIXME: use cx.layout_of(ty).llvm_type() ?
1491
- let mut elem_ty = match elem_ty. sty {
1492
- ty:: TyInt ( v) => Type :: int_from_ty ( cx, v) ,
1493
- ty:: TyUint ( v) => Type :: uint_from_ty ( cx, v) ,
1494
- ty:: TyFloat ( v) => Type :: float_from_ty ( cx, v) ,
1495
- _ => unreachable ! ( ) ,
1496
- } ;
1497
- while no_pointers > 0 {
1498
- elem_ty = elem_ty. ptr_to ( ) ;
1499
- no_pointers -= 1 ;
1500
- }
1501
- Type :: vector ( & elem_ty, vec_len as u64 )
1502
- }
1503
-
1504
-
1505
1475
// Type of the vector of pointers:
1506
1476
let llvm_pointer_vec_ty = llvm_vector_ty ( bx. cx , underlying_ty, in_len, pointer_count) ;
1507
1477
let llvm_pointer_vec_str = llvm_vector_str ( underlying_ty, in_len, pointer_count) ;
0 commit comments