@@ -1359,21 +1359,24 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1359
1359
1360
1360
if let Some ( cmp_op) = comparison {
1361
1361
assert_eq ! ( arg_tys. len( ) , 2 ) ;
1362
- // we need nominal equality here, not LLVM (structural)
1363
- // equality
1364
- require ! ( arg_tys[ 0 ] == arg_tys[ 1 ] ,
1365
- "SIMD comparison intrinsic monomorphised with different input types" ) ;
1366
1362
require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
1367
- "SIMD comparison intrinsic monomorphised for non-SIMD argument type" ) ;
1363
+ "SIMD comparison intrinsic monomorphized for non-SIMD argument type `{}`" ,
1364
+ arg_tys[ 0 ] ) ;
1368
1365
require ! ( ret_ty. is_simd( tcx) ,
1369
- "SIMD comparison intrinsic monomorphised for non-SIMD return type" ) ;
1366
+ "SIMD comparison intrinsic monomorphized for non-SIMD return type `{}`" ,
1367
+ ret_ty) ;
1370
1368
1371
1369
let in_len = arg_tys[ 0 ] . simd_size ( tcx) ;
1372
1370
let out_len = ret_ty. simd_size ( tcx) ;
1373
1371
require ! ( in_len == out_len,
1374
- "SIMD comparison intrinsic monomorphised for non-SIMD argument type" ) ;
1372
+ "SIMD cast intrinsic monomorphized with input type `{}` and \
1373
+ return type `{}` with different lengths: {} vs. {}",
1374
+ arg_tys[ 0 ] ,
1375
+ ret_ty,
1376
+ in_len,
1377
+ out_len) ;
1375
1378
require ! ( llret_ty. element_type( ) . kind( ) == llvm:: Integer ,
1376
- "SIMD comparison intrinsic monomorphised with non-integer return" ) ;
1379
+ "SIMD comparison intrinsic monomorphized with non-integer return" ) ;
1377
1380
1378
1381
return compare_simd_types ( bcx,
1379
1382
llargs[ 0 ] ,
@@ -1391,18 +1394,20 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1391
1394
"bad `simd_shuffle` instruction only caught in trans?" )
1392
1395
} ;
1393
1396
1394
- require ! ( arg_tys[ 0 ] == arg_tys[ 1 ] ,
1395
- "SIMD shuffle intrinsic monomorphised with different input types" ) ;
1397
+ require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
1398
+ "SIMD shuffle intrinsic monomorphized with non-SIMD input type `{}`" ,
1399
+ arg_tys[ 0 ] ) ;
1396
1400
require ! ( ret_ty. is_simd( tcx) ,
1397
- "SIMD shuffle intrinsic monomorphised for non-SIMD return type" ) ;
1401
+ "SIMD shuffle intrinsic monomorphized for non-SIMD return type `{}`" ,
1402
+ ret_ty) ;
1398
1403
1399
1404
let in_len = arg_tys[ 0 ] . simd_size ( tcx) ;
1400
1405
let out_len = ret_ty. simd_size ( tcx) ;
1401
1406
require ! ( out_len == n,
1402
- "SIMD shuffle intrinsic monomorphised with return type of length {} (expected {})" ,
1407
+ "SIMD shuffle intrinsic monomorphized with return type of length {} (expected {})" ,
1403
1408
out_len, n) ;
1404
1409
require ! ( arg_tys[ 0 ] . simd_type( tcx) == ret_ty. simd_type( tcx) ,
1405
- "SIMD shuffle intrinsic monomorphised with different \
1410
+ "SIMD shuffle intrinsic monomorphized with different \
1406
1411
input and return element types") ;
1407
1412
1408
1413
let total_len = in_len as u64 * 2 ;
@@ -1448,27 +1453,37 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1448
1453
1449
1454
if name == "simd_insert" {
1450
1455
require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
1451
- "SIMD insert intrinsic monomorphised for non-SIMD input type" ) ;
1456
+ "SIMD insert intrinsic monomorphized for non-SIMD input type" ) ;
1452
1457
1453
1458
let elem_ty = arg_tys[ 0 ] . simd_type ( tcx) ;
1454
1459
require ! ( arg_tys[ 2 ] == elem_ty,
1455
- "SIMD insert intrinsic monomorphised with inserted type not SIMD element type" ) ;
1460
+ "SIMD insert intrinsic monomorphized with inserted type not SIMD element type" ) ;
1456
1461
return InsertElement ( bcx, llargs[ 0 ] , llargs[ 2 ] , llargs[ 1 ] )
1457
1462
}
1458
1463
if name == "simd_extract" {
1459
1464
require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
1460
- "SIMD insert intrinsic monomorphised for non-SIMD input type" ) ;
1465
+ "SIMD insert intrinsic monomorphized for non-SIMD input type" ) ;
1461
1466
1462
1467
let elem_ty = arg_tys[ 0 ] . simd_type ( tcx) ;
1463
1468
require ! ( ret_ty == elem_ty,
1464
- "SIMD insert intrinsic monomorphised with returned type not SIMD element type" ) ;
1469
+ "SIMD insert intrinsic monomorphized with returned type not SIMD element type" ) ;
1465
1470
return ExtractElement ( bcx, llargs[ 0 ] , llargs[ 1 ] )
1466
1471
}
1467
1472
1468
1473
if name == "simd_cast" {
1474
+ require ! ( arg_tys[ 0 ] . is_simd( tcx) ,
1475
+ "SIMD cast intrinsic monomorphized with non-SIMD input type `{}`" ,
1476
+ arg_tys[ 0 ] ) ;
1477
+ require ! ( ret_ty. is_simd( tcx) ,
1478
+ "SIMD cast intrinsic monomorphized with non-SIMD return type `{}`" ,
1479
+ ret_ty) ;
1469
1480
require ! ( arg_tys[ 0 ] . simd_size( tcx) == ret_ty. simd_size( tcx) ,
1470
- "SIMD cast intrinsic monomorphised with input and \
1471
- return types of different lengths") ;
1481
+ "SIMD cast intrinsic monomorphized with input type `{}` and \
1482
+ return type `{}` with different lengths: {} vs. {}",
1483
+ arg_tys[ 0 ] ,
1484
+ ret_ty,
1485
+ arg_tys[ 0 ] . simd_size( tcx) ,
1486
+ ret_ty. simd_size( tcx) ) ;
1472
1487
// casting cares about nominal type, not just structural type
1473
1488
let in_ = arg_tys[ 0 ] . simd_type ( tcx) ;
1474
1489
let out = ret_ty. simd_type ( tcx) ;
@@ -1590,12 +1605,19 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1590
1605
}
1591
1606
_ => { }
1592
1607
}
1593
- require ! ( false , "SIMD cast intrinsic monomorphised with incompatible cast" ) ;
1608
+ require ! ( false ,
1609
+ "SIMD cast intrinsic monomorphized with incompatible cast \
1610
+ from `{}` (element `{}`)to `{}` (element `{}`)",
1611
+ arg_tys[ 0 ] , in_,
1612
+ ret_ty, out) ;
1594
1613
}
1595
1614
macro_rules! arith {
1596
1615
( $( $name: ident: $( $( $p: ident) ,* => $call: expr) ,* ; ) * ) => {
1597
1616
$(
1598
1617
if name == stringify!( $name) {
1618
+ require!( arg_tys[ 0 ] . is_simd( tcx) ,
1619
+ "`{}` intrinsic monomorphized with non-SIMD type `{}`" ,
1620
+ name, arg_tys[ 0 ] ) ;
1599
1621
let in_ = arg_tys[ 0 ] . simd_type( tcx) ;
1600
1622
match in_. sty {
1601
1623
$(
@@ -1606,8 +1628,11 @@ fn generic_simd_intrinsic<'blk, 'tcx, 'a>
1606
1628
_ => { } ,
1607
1629
}
1608
1630
require!( false ,
1609
- "{} intrinsic monomorphised with invalid type" ,
1610
- name)
1631
+ "`{}` intrinsic monomorphized with SIMD vector `{}` \
1632
+ with unsupported element type `{}`",
1633
+ name,
1634
+ arg_tys[ 0 ] ,
1635
+ in_)
1611
1636
} ) *
1612
1637
}
1613
1638
}
0 commit comments