@@ -13,7 +13,7 @@ use crate::core_arch::simd_llvm::*;
13
13
#[ cfg( test) ]
14
14
use stdarch_test:: assert_instr;
15
15
16
- use crate :: mem;
16
+ use crate :: mem:: transmute ;
17
17
18
18
types ! {
19
19
// pub struct vector_Float16 = f16x8;
@@ -45,13 +45,16 @@ mod sealed {
45
45
#[ target_feature( enable = "vsx" ) ]
46
46
#[ cfg_attr( all( test, target_endian = "little" ) , assert_instr( xxmrgld, dm = 0x0 ) ) ]
47
47
#[ cfg_attr( all( test, target_endian = "big" ) , assert_instr( xxspltd, dm = 0x0 ) ) ]
48
- unsafe fn xxpermdi ( a : i64x2 , b : i64x2 , dm : u8 ) -> i64x2 {
49
- match dm & 0b11 {
48
+ unsafe fn xxpermdi ( a : vector_signed_long , b : vector_signed_long , dm : u8 ) -> vector_signed_long {
49
+ let a: i64x2 = transmute ( a) ;
50
+ let b: i64x2 = transmute ( b) ;
51
+ let r: i64x2 = match dm & 0b11 {
50
52
0 => simd_shuffle ! ( a, b, [ 0b00 , 0b10 ] ) ,
51
53
1 => simd_shuffle ! ( a, b, [ 0b01 , 0b10 ] ) ,
52
54
2 => simd_shuffle ! ( a, b, [ 0b00 , 0b11 ] ) ,
53
55
_ => simd_shuffle ! ( a, b, [ 0b01 , 0b11 ] ) ,
54
- }
56
+ } ;
57
+ transmute ( r)
55
58
}
56
59
57
60
macro_rules! vec_xxpermdi {
@@ -60,7 +63,7 @@ mod sealed {
60
63
#[ inline]
61
64
#[ target_feature( enable = "vsx" ) ]
62
65
unsafe fn vec_xxpermdi( self , b: Self , dm: u8 ) -> Self {
63
- mem :: transmute( xxpermdi( mem :: transmute( self ) , mem :: transmute( b) , dm) )
66
+ transmute( xxpermdi( transmute( self ) , transmute( b) , dm) )
64
67
}
65
68
}
66
69
}
@@ -92,21 +95,21 @@ mod tests {
92
95
#[ cfg( target_arch = "powerpc64" ) ]
93
96
use crate :: core_arch:: arch:: powerpc64:: * ;
94
97
95
- use super :: mem;
96
98
use crate :: core_arch:: simd:: * ;
99
+ use crate :: mem:: transmute;
97
100
use stdarch_test:: simd_test;
98
101
99
102
macro_rules! test_vec_xxpermdi {
100
103
{ $name: ident, $shorttype: ident, $longtype: ident, [ $( $a: expr) ,+] , [ $( $b: expr) ,+] , [ $( $c: expr) ,+] , [ $( $d: expr) ,+] } => {
101
104
#[ simd_test( enable = "vsx" ) ]
102
105
unsafe fn $name( ) {
103
- let a: $longtype = mem :: transmute( $shorttype:: new( $( $a) ,+, $( $b) ,+) ) ;
104
- let b = mem :: transmute( $shorttype:: new( $( $c) ,+, $( $d) ,+) ) ;
106
+ let a: $longtype = transmute( $shorttype:: new( $( $a) ,+, $( $b) ,+) ) ;
107
+ let b = transmute( $shorttype:: new( $( $c) ,+, $( $d) ,+) ) ;
105
108
106
- assert_eq!( $shorttype:: new( $( $a) ,+, $( $c) ,+) , mem :: transmute( vec_xxpermdi:: <_, 0 >( a, b) ) ) ;
107
- assert_eq!( $shorttype:: new( $( $b) ,+, $( $c) ,+) , mem :: transmute( vec_xxpermdi:: <_, 1 >( a, b) ) ) ;
108
- assert_eq!( $shorttype:: new( $( $a) ,+, $( $d) ,+) , mem :: transmute( vec_xxpermdi:: <_, 2 >( a, b) ) ) ;
109
- assert_eq!( $shorttype:: new( $( $b) ,+, $( $d) ,+) , mem :: transmute( vec_xxpermdi:: <_, 3 >( a, b) ) ) ;
109
+ assert_eq!( $shorttype:: new( $( $a) ,+, $( $c) ,+) , transmute( vec_xxpermdi:: <_, 0 >( a, b) ) ) ;
110
+ assert_eq!( $shorttype:: new( $( $b) ,+, $( $c) ,+) , transmute( vec_xxpermdi:: <_, 1 >( a, b) ) ) ;
111
+ assert_eq!( $shorttype:: new( $( $a) ,+, $( $d) ,+) , transmute( vec_xxpermdi:: <_, 2 >( a, b) ) ) ;
112
+ assert_eq!( $shorttype:: new( $( $b) ,+, $( $d) ,+) , transmute( vec_xxpermdi:: <_, 3 >( a, b) ) ) ;
110
113
}
111
114
}
112
115
}
0 commit comments