@@ -3,7 +3,6 @@ use crate::common::Funclet;
3
3
use crate :: context:: CodegenCx ;
4
4
use crate :: llvm:: { self , BasicBlock , False } ;
5
5
use crate :: llvm:: { AtomicOrdering , AtomicRmwBinOp , SynchronizationScope } ;
6
- use crate :: llvm_util;
7
6
use crate :: type_:: Type ;
8
7
use crate :: type_of:: LayoutLlvmExt ;
9
8
use crate :: value:: Value ;
@@ -1038,25 +1037,11 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
1038
1037
dst : & ' ll Value ,
1039
1038
cmp : & ' ll Value ,
1040
1039
src : & ' ll Value ,
1041
- mut order : rustc_codegen_ssa:: common:: AtomicOrdering ,
1040
+ order : rustc_codegen_ssa:: common:: AtomicOrdering ,
1042
1041
failure_order : rustc_codegen_ssa:: common:: AtomicOrdering ,
1043
1042
weak : bool ,
1044
1043
) -> & ' ll Value {
1045
1044
let weak = if weak { llvm:: True } else { llvm:: False } ;
1046
- if llvm_util:: get_version ( ) < ( 13 , 0 , 0 ) {
1047
- use rustc_codegen_ssa:: common:: AtomicOrdering :: * ;
1048
- // Older llvm has the pre-C++17 restriction on
1049
- // success and failure memory ordering,
1050
- // requiring the former to be at least as strong as the latter.
1051
- // So, for llvm 12, we upgrade the success ordering to a stronger
1052
- // one if necessary.
1053
- match ( order, failure_order) {
1054
- ( Relaxed , Acquire ) => order = Acquire ,
1055
- ( Release , Acquire ) => order = AcquireRelease ,
1056
- ( _, SequentiallyConsistent ) => order = SequentiallyConsistent ,
1057
- _ => { }
1058
- }
1059
- }
1060
1045
unsafe {
1061
1046
llvm:: LLVMRustBuildAtomicCmpXchg (
1062
1047
self . llbuilder ,
@@ -1444,51 +1429,37 @@ impl<'a, 'll, 'tcx> Builder<'a, 'll, 'tcx> {
1444
1429
}
1445
1430
}
1446
1431
1447
- fn fptoint_sat_broken_in_llvm ( & self ) -> bool {
1448
- match self . tcx . sess . target . arch . as_ref ( ) {
1449
- // FIXME - https://bugs.llvm.org/show_bug.cgi?id=50083
1450
- "riscv64" => llvm_util:: get_version ( ) < ( 13 , 0 , 0 ) ,
1451
- _ => false ,
1452
- }
1453
- }
1454
-
1455
1432
fn fptoint_sat (
1456
1433
& mut self ,
1457
1434
signed : bool ,
1458
1435
val : & ' ll Value ,
1459
1436
dest_ty : & ' ll Type ,
1460
1437
) -> Option < & ' ll Value > {
1461
- if !self . fptoint_sat_broken_in_llvm ( ) {
1462
- let src_ty = self . cx . val_ty ( val) ;
1463
- let ( float_ty, int_ty, vector_length) = if self . cx . type_kind ( src_ty) == TypeKind :: Vector
1464
- {
1465
- assert_eq ! ( self . cx. vector_length( src_ty) , self . cx. vector_length( dest_ty) ) ;
1466
- (
1467
- self . cx . element_type ( src_ty) ,
1468
- self . cx . element_type ( dest_ty) ,
1469
- Some ( self . cx . vector_length ( src_ty) ) ,
1470
- )
1471
- } else {
1472
- ( src_ty, dest_ty, None )
1473
- } ;
1474
- let float_width = self . cx . float_width ( float_ty) ;
1475
- let int_width = self . cx . int_width ( int_ty) ;
1476
-
1477
- let instr = if signed { "fptosi" } else { "fptoui" } ;
1478
- let name = if let Some ( vector_length) = vector_length {
1479
- format ! (
1480
- "llvm.{}.sat.v{}i{}.v{}f{}" ,
1481
- instr, vector_length, int_width, vector_length, float_width
1482
- )
1483
- } else {
1484
- format ! ( "llvm.{}.sat.i{}.f{}" , instr, int_width, float_width)
1485
- } ;
1486
- let f =
1487
- self . declare_cfn ( & name, llvm:: UnnamedAddr :: No , self . type_func ( & [ src_ty] , dest_ty) ) ;
1488
- Some ( self . call ( self . type_func ( & [ src_ty] , dest_ty) , f, & [ val] , None ) )
1438
+ let src_ty = self . cx . val_ty ( val) ;
1439
+ let ( float_ty, int_ty, vector_length) = if self . cx . type_kind ( src_ty) == TypeKind :: Vector {
1440
+ assert_eq ! ( self . cx. vector_length( src_ty) , self . cx. vector_length( dest_ty) ) ;
1441
+ (
1442
+ self . cx . element_type ( src_ty) ,
1443
+ self . cx . element_type ( dest_ty) ,
1444
+ Some ( self . cx . vector_length ( src_ty) ) ,
1445
+ )
1489
1446
} else {
1490
- None
1491
- }
1447
+ ( src_ty, dest_ty, None )
1448
+ } ;
1449
+ let float_width = self . cx . float_width ( float_ty) ;
1450
+ let int_width = self . cx . int_width ( int_ty) ;
1451
+
1452
+ let instr = if signed { "fptosi" } else { "fptoui" } ;
1453
+ let name = if let Some ( vector_length) = vector_length {
1454
+ format ! (
1455
+ "llvm.{}.sat.v{}i{}.v{}f{}" ,
1456
+ instr, vector_length, int_width, vector_length, float_width
1457
+ )
1458
+ } else {
1459
+ format ! ( "llvm.{}.sat.i{}.f{}" , instr, int_width, float_width)
1460
+ } ;
1461
+ let f = self . declare_cfn ( & name, llvm:: UnnamedAddr :: No , self . type_func ( & [ src_ty] , dest_ty) ) ;
1462
+ Some ( self . call ( self . type_func ( & [ src_ty] , dest_ty) , f, & [ val] , None ) )
1492
1463
}
1493
1464
1494
1465
pub ( crate ) fn landing_pad (
0 commit comments