@@ -76,6 +76,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
76
76
a >> b
77
77
}
78
78
}
79
+ else if a_type. is_vector ( ) && a_type. is_vector ( ) {
80
+ a >> b
81
+ }
79
82
else if a_native && !b_native {
80
83
self . gcc_lshr ( a, self . gcc_int_cast ( b, a_type) )
81
84
}
@@ -144,7 +147,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
144
147
fn additive_operation ( & self , operation : BinaryOp , a : RValue < ' gcc > , mut b : RValue < ' gcc > ) -> RValue < ' gcc > {
145
148
let a_type = a. get_type ( ) ;
146
149
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 ( ) ) {
148
151
if a_type != b_type {
149
152
if a_type. is_vector ( ) {
150
153
// Vector types need to be bitcast.
@@ -158,6 +161,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
158
161
self . context . new_binary_op ( None , operation, a_type, a, b)
159
162
}
160
163
else {
164
+ debug_assert ! ( a_type. dyncast_array( ) . is_some( ) ) ;
165
+ debug_assert ! ( b_type. dyncast_array( ) . is_some( ) ) ;
161
166
let signed = a_type. is_compatible_with ( self . i128_type ) ;
162
167
let func_name =
163
168
match ( operation, signed) {
@@ -189,10 +194,12 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
189
194
fn multiplicative_operation ( & self , operation : BinaryOp , operation_name : & str , signed : bool , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
190
195
let a_type = a. get_type ( ) ;
191
196
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 ( ) ) {
193
198
self . context . new_binary_op ( None , operation, a_type, a, b)
194
199
}
195
200
else {
201
+ debug_assert ! ( a_type. dyncast_array( ) . is_some( ) ) ;
202
+ debug_assert ! ( b_type. dyncast_array( ) . is_some( ) ) ;
196
203
let sign =
197
204
if signed {
198
205
""
@@ -337,6 +344,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
337
344
pub fn operation_with_overflow ( & self , func_name : & str , lhs : RValue < ' gcc > , rhs : RValue < ' gcc > ) -> ( RValue < ' gcc > , RValue < ' gcc > ) {
338
345
let a_type = lhs. get_type ( ) ;
339
346
let b_type = rhs. get_type ( ) ;
347
+ debug_assert ! ( a_type. dyncast_array( ) . is_some( ) ) ;
348
+ debug_assert ! ( b_type. dyncast_array( ) . is_some( ) ) ;
340
349
let param_a = self . context . new_parameter ( None , a_type, "a" ) ;
341
350
let param_b = self . context . new_parameter ( None , b_type, "b" ) ;
342
351
let result_field = self . context . new_field ( None , a_type, "result" ) ;
@@ -496,7 +505,11 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
496
505
pub fn gcc_xor ( & self , a : RValue < ' gcc > , b : RValue < ' gcc > ) -> RValue < ' gcc > {
497
506
let a_type = a. get_type ( ) ;
498
507
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) {
500
513
a ^ b
501
514
}
502
515
else {
@@ -527,6 +540,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
527
540
a << b
528
541
}
529
542
}
543
+ else if a_type. is_vector ( ) && a_type. is_vector ( ) {
544
+ a << b
545
+ }
530
546
else if a_native && !b_native {
531
547
self . gcc_shl ( a, self . gcc_int_cast ( b, a_type) )
532
548
}
@@ -690,6 +706,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
690
706
let a_native = self . is_native_int_type_or_bool ( a_type) ;
691
707
let b_native = self . is_native_int_type_or_bool ( b_type) ;
692
708
if a_type. is_vector ( ) && b_type. is_vector ( ) {
709
+ let b = self . bitcast_if_needed ( b, a_type) ;
693
710
self . context . new_binary_op ( None , operation, a_type, a, b)
694
711
}
695
712
else if a_native && b_native {
@@ -748,6 +765,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
748
765
return self . context . new_cast ( None , value, dest_typ) ;
749
766
}
750
767
768
+ debug_assert ! ( value_type. dyncast_array( ) . is_some( ) ) ;
751
769
let name_suffix =
752
770
match self . type_kind ( dest_typ) {
753
771
TypeKind :: Float => "tisf" ,
@@ -781,6 +799,7 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
781
799
return self . context . new_cast ( None , value, dest_typ) ;
782
800
}
783
801
802
+ debug_assert ! ( value_type. dyncast_array( ) . is_some( ) ) ;
784
803
let name_suffix =
785
804
match self . type_kind ( value_type) {
786
805
TypeKind :: Float => "sfti" ,
0 commit comments