@@ -862,6 +862,31 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
862862 result
863863 }
864864
865+ fn fadd_algebraic ( & mut self , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> RValue < ' gcc > {
866+ // NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
867+ lhs + rhs
868+ }
869+
870+ fn fsub_algebraic ( & mut self , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> RValue < ' gcc > {
871+ // NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
872+ lhs - rhs
873+ }
874+
875+ fn fmul_algebraic ( & mut self , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> RValue < ' gcc > {
876+ // NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
877+ lhs * rhs
878+ }
879+
880+ fn fdiv_algebraic ( & mut self , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> RValue < ' gcc > {
881+ // NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
882+ lhs / rhs
883+ }
884+
885+ fn frem_algebraic ( & mut self , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> RValue < ' gcc > {
886+ // NOTE: it seems like we cannot enable fast-mode for a single operation in GCC.
887+ self . frem ( lhs, rhs)
888+ }
889+
865890 fn checked_binop (
866891 & mut self ,
867892 oop : OverflowOp ,
@@ -983,10 +1008,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
9831008 OperandValue :: Immediate ( self . to_immediate ( load, place. layout ) )
9841009 } else if let abi:: Abi :: ScalarPair ( ref a, ref b) = place. layout . abi {
9851010 let b_offset = a. size ( self ) . align_to ( b. align ( self ) . abi ) ;
986- let pair_type = place. layout . gcc_type ( self ) ;
9871011
9881012 let mut load = |i, scalar : & abi:: Scalar , align| {
989- let llptr = self . struct_gep ( pair_type, place. llval , i as u64 ) ;
1013+ let llptr = if i == 0 {
1014+ place. llval
1015+ } else {
1016+ self . inbounds_ptradd ( place. llval , self . const_usize ( b_offset. bytes ( ) ) )
1017+ } ;
9901018 let llty = place. layout . scalar_pair_element_gcc_type ( self , i) ;
9911019 let load = self . load ( llty, llptr, align) ;
9921020 scalar_load_metadata ( self , load, scalar) ;
@@ -1157,35 +1185,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
11571185 result. get_address ( self . location )
11581186 }
11591187
1160- fn struct_gep ( & mut self , value_type : Type < ' gcc > , ptr : RValue < ' gcc > , idx : u64 ) -> RValue < ' gcc > {
1161- // FIXME(antoyo): it would be better if the API only called this on struct, not on arrays.
1162- assert_eq ! ( idx as usize as u64 , idx) ;
1163- let value = ptr. dereference ( self . location ) . to_rvalue ( ) ;
1164-
1165- if value_type. dyncast_array ( ) . is_some ( ) {
1166- let index = self
1167- . context
1168- . new_rvalue_from_long ( self . u64_type , i64:: try_from ( idx) . expect ( "i64::try_from" ) ) ;
1169- let element = self . context . new_array_access ( self . location , value, index) ;
1170- element. get_address ( self . location )
1171- } else if let Some ( vector_type) = value_type. dyncast_vector ( ) {
1172- let array_type = vector_type. get_element_type ( ) . make_pointer ( ) ;
1173- let array = self . bitcast ( ptr, array_type) ;
1174- let index = self
1175- . context
1176- . new_rvalue_from_long ( self . u64_type , i64:: try_from ( idx) . expect ( "i64::try_from" ) ) ;
1177- let element = self . context . new_array_access ( self . location , array, index) ;
1178- element. get_address ( self . location )
1179- } else if let Some ( struct_type) = value_type. is_struct ( ) {
1180- // NOTE: due to opaque pointers now being used, we need to bitcast here.
1181- let ptr = self . bitcast_if_needed ( ptr, value_type. make_pointer ( ) ) ;
1182- ptr. dereference_field ( self . location , struct_type. get_field ( idx as i32 ) )
1183- . get_address ( self . location )
1184- } else {
1185- panic ! ( "Unexpected type {:?}" , value_type) ;
1186- }
1187- }
1188-
11891188 /* Casts */
11901189 fn trunc ( & mut self , value : RValue < ' gcc > , dest_ty : Type < ' gcc > ) -> RValue < ' gcc > {
11911190 // TODO(antoyo): check that it indeed truncate the value.
@@ -2078,7 +2077,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
20782077 self . vector_reduce ( src, |a, b, context| context. new_binary_op ( loc, op, a. get_type ( ) , a, b) )
20792078 }
20802079
2081- pub fn vector_reduce_fadd_fast (
2080+ pub fn vector_reduce_fadd_reassoc (
20822081 & mut self ,
20832082 _acc : RValue < ' gcc > ,
20842083 _src : RValue < ' gcc > ,
@@ -2109,7 +2108,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
21092108 unimplemented ! ( ) ;
21102109 }
21112110
2112- pub fn vector_reduce_fmul_fast (
2111+ pub fn vector_reduce_fmul_reassoc (
21132112 & mut self ,
21142113 _acc : RValue < ' gcc > ,
21152114 _src : RValue < ' gcc > ,
0 commit comments