@@ -76,6 +76,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
7676 a >> b
7777 }
7878 }
79+ else if a_type. is_vector ( ) && a_type. is_vector ( ) {
80+ a >> b
81+ }
7982 else if a_native && !b_native {
8083 self . gcc_lshr ( a, self . gcc_int_cast ( b, a_type) )
8184 }
@@ -144,7 +147,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
144147 fn additive_operation ( & self , operation : BinaryOp , a : RValue < ' gcc > , mut b : RValue < ' gcc > ) -> RValue < ' gcc > {
145148 let a_type = a. get_type ( ) ;
146149 let b_type = b. get_type ( ) ;
147- if self . is_native_int_type_or_bool ( a_type) && self . is_native_int_type_or_bool ( b_type) {
150+ if ( self . is_native_int_type_or_bool ( a_type) && self . is_native_int_type_or_bool ( b_type) ) || ( a_type . is_vector ( ) && b_type . is_vector ( ) ) {
148151 if a_type != b_type {
149152 if a_type. is_vector ( ) {
150153 // Vector types need to be bitcast.
@@ -158,6 +161,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
158161 self . context . new_binary_op ( None , operation, a_type, a, b)
159162 }
160163 else {
164+ debug_assert ! ( a_type. dyncast_array( ) . is_some( ) ) ;
165+ debug_assert ! ( b_type. dyncast_array( ) . is_some( ) ) ;
161166 let signed = a_type. is_compatible_with ( self . i128_type ) ;
162167 let func_name =
163168 match ( operation, signed) {
@@ -189,10 +194,12 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
189194 fn multiplicative_operation ( & self , operation : BinaryOp , operation_name : & str , signed : bool , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
190195 let a_type = a. get_type ( ) ;
191196 let b_type = b. get_type ( ) ;
192- if self . is_native_int_type_or_bool ( a_type) && self . is_native_int_type_or_bool ( b_type) {
197+ if ( self . is_native_int_type_or_bool ( a_type) && self . is_native_int_type_or_bool ( b_type) ) || ( a_type . is_vector ( ) && b_type . is_vector ( ) ) {
193198 self . context . new_binary_op ( None , operation, a_type, a, b)
194199 }
195200 else {
201+ debug_assert ! ( a_type. dyncast_array( ) . is_some( ) ) ;
202+ debug_assert ! ( b_type. dyncast_array( ) . is_some( ) ) ;
196203 let sign =
197204 if signed {
198205 ""
@@ -337,6 +344,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
337344 pub fn operation_with_overflow ( & self , func_name : & str , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
338345 let a_type = lhs. get_type ( ) ;
339346 let b_type = rhs. get_type ( ) ;
347+ debug_assert ! ( a_type. dyncast_array( ) . is_some( ) ) ;
348+ debug_assert ! ( b_type. dyncast_array( ) . is_some( ) ) ;
340349 let param_a = self . context . new_parameter ( None , a_type, "a" ) ;
341350 let param_b = self . context . new_parameter ( None , b_type, "b" ) ;
342351 let result_field = self . context . new_field ( None , a_type, "result" ) ;
@@ -496,7 +505,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
496505 pub fn gcc_xor ( & self , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
497506 let a_type = a. get_type ( ) ;
498507 let b_type = b. get_type ( ) ;
499- if self . is_native_int_type_or_bool ( a_type) && self . is_native_int_type_or_bool ( b_type) {
508+ if a_type. is_vector ( ) && b_type. is_vector ( ) {
509+ let b = self . bitcast_if_needed ( b, a_type) ;
510+ a ^ b
511+ }
512+ else if self . is_native_int_type_or_bool ( a_type) && self . is_native_int_type_or_bool ( b_type) {
500513 a ^ b
501514 }
502515 else {
@@ -527,6 +540,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
527540 a << b
528541 }
529542 }
543+ else if a_type. is_vector ( ) && a_type. is_vector ( ) {
544+ a << b
545+ }
530546 else if a_native && !b_native {
531547 self . gcc_shl ( a, self . gcc_int_cast ( b, a_type) )
532548 }
@@ -690,6 +706,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
690706 let a_native = self . is_native_int_type_or_bool ( a_type) ;
691707 let b_native = self . is_native_int_type_or_bool ( b_type) ;
692708 if a_type. is_vector ( ) && b_type. is_vector ( ) {
709+ let b = self . bitcast_if_needed ( b, a_type) ;
693710 self . context . new_binary_op ( None , operation, a_type, a, b)
694711 }
695712 else if a_native && b_native {
@@ -748,6 +765,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
748765 return self . context . new_cast ( None , value, dest_typ) ;
749766 }
750767
768+ debug_assert ! ( value_type. dyncast_array( ) . is_some( ) ) ;
751769 let name_suffix =
752770 match self . type_kind ( dest_typ) {
753771 TypeKind :: Float => "tisf" ,
@@ -781,6 +799,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
781799 return self . context . new_cast ( None , value, dest_typ) ;
782800 }
783801
802+ debug_assert ! ( value_type. dyncast_array( ) . is_some( ) ) ;
784803 let name_suffix =
785804 match self . type_kind ( value_type) {
786805 TypeKind :: Float => "sfti" ,
0 commit comments