@@ -862,6 +862,31 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
862
862
result
863
863
}
864
864
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
+
865
890
fn checked_binop (
866
891
& mut self ,
867
892
oop : OverflowOp ,
@@ -983,10 +1008,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
983
1008
OperandValue :: Immediate ( self . to_immediate ( load, place. layout ) )
984
1009
} else if let abi:: Abi :: ScalarPair ( ref a, ref b) = place. layout . abi {
985
1010
let b_offset = a. size ( self ) . align_to ( b. align ( self ) . abi ) ;
986
- let pair_type = place. layout . gcc_type ( self ) ;
987
1011
988
1012
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
+ } ;
990
1018
let llty = place. layout . scalar_pair_element_gcc_type ( self , i) ;
991
1019
let load = self . load ( llty, llptr, align) ;
992
1020
scalar_load_metadata ( self , load, scalar) ;
@@ -1157,35 +1185,6 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
1157
1185
result. get_address ( self . location )
1158
1186
}
1159
1187
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
-
1189
1188
/* Casts */
1190
1189
fn trunc ( & mut self , value : RValue < ' gcc > , dest_ty : Type < ' gcc > ) -> RValue < ' gcc > {
1191
1190
// TODO(antoyo): check that it indeed truncate the value.
@@ -2078,7 +2077,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
2078
2077
self . vector_reduce ( src, |a, b, context| context. new_binary_op ( loc, op, a. get_type ( ) , a, b) )
2079
2078
}
2080
2079
2081
- pub fn vector_reduce_fadd_fast (
2080
+ pub fn vector_reduce_fadd_reassoc (
2082
2081
& mut self ,
2083
2082
_acc : RValue < ' gcc > ,
2084
2083
_src : RValue < ' gcc > ,
@@ -2109,7 +2108,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
2109
2108
unimplemented ! ( ) ;
2110
2109
}
2111
2110
2112
- pub fn vector_reduce_fmul_fast (
2111
+ pub fn vector_reduce_fmul_reassoc (
2113
2112
& mut self ,
2114
2113
_acc : RValue < ' gcc > ,
2115
2114
_src : RValue < ' gcc > ,
0 commit comments