simd: impl extract_element for vector types
This fixes some tests that needed vector element extraction. Signed-off-by: Andy Sadler <andrewsadler122@gmail.com>
This commit is contained in:
parent
2ecd620acb
commit
d7d820fc47
@ -30,12 +30,10 @@ src/test/ui/sepcomp/sepcomp-extern.rs
|
||||
src/test/ui/sepcomp/sepcomp-fns-backwards.rs
|
||||
src/test/ui/sepcomp/sepcomp-fns.rs
|
||||
src/test/ui/sepcomp/sepcomp-statics.rs
|
||||
src/test/ui/simd/generics.rs
|
||||
src/test/ui/simd/intrinsic/float-math-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-arithmetic-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-as.rs
|
||||
src/test/ui/simd/intrinsic/generic-bitmask-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-comparison-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-gather-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-select-pass.rs
|
||||
src/test/ui/simd/issue-17170.rs
|
||||
|
@ -12,6 +12,7 @@ src/test/ui/simd/intrinsic/float-minmax-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-arithmetic-saturating-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-cast-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-cast-pointer-width.rs
|
||||
src/test/ui/simd/intrinsic/generic-comparison-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-elements-pass.rs
|
||||
src/test/ui/simd/intrinsic/generic-reduction-pass.rs
|
||||
src/test/ui/simd/intrinsic/inlining-issue67557-ice.rs
|
||||
|
@ -1059,8 +1059,19 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
fn extract_element(&mut self, _vec: RValue<'gcc>, _idx: RValue<'gcc>) -> RValue<'gcc> {
|
||||
unimplemented!();
|
||||
#[cfg(feature="master")]
|
||||
fn extract_element(&mut self, vec: RValue<'gcc>, idx: RValue<'gcc>) -> RValue<'gcc> {
|
||||
self.context.new_vector_access(None, vec, idx).to_rvalue()
|
||||
}
|
||||
|
||||
#[cfg(not(feature="master"))]
|
||||
fn extract_element(&mut self, vec: RValue<'gcc>, idx: RValue<'gcc>) -> RValue<'gcc> {
|
||||
let vector_type = vec.get_type().unqualified().dyncast_vector().expect("Called extract_element on a non-vector type");
|
||||
let element_type = vector_type.get_element_type();
|
||||
let vec_num_units = vector_type.get_num_units();
|
||||
let array_type = self.context.new_array_type(None, element_type, vec_num_units as i32);
|
||||
let array = self.context.new_bitcast(None, vec, array_type).to_rvalue();
|
||||
self.context.new_array_access(None, array, idx).to_rvalue()
|
||||
}
|
||||
|
||||
fn vector_splat(&mut self, _num_elts: usize, _elt: RValue<'gcc>) -> RValue<'gcc> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user