@@ -337,96 +337,6 @@ impl_neg! { f32x4 : 0f32 }
337337mod sealed {
338338 use super :: * ;
339339
340- macro_rules! test_impl {
341- ( $fun: ident ( $( $v: ident : $ty: ty) ,* ) -> $r: ty [ $call: ident, $instr: ident] ) => {
342- #[ inline]
343- #[ target_feature( enable = "altivec" ) ]
344- #[ cfg_attr( test, assert_instr( $instr) ) ]
345- pub unsafe fn $fun ( $( $v : $ty) ,* ) -> $r {
346- $call ( $( $v) ,* )
347- }
348- } ;
349- ( $fun: ident ( $( $v: ident : $ty: ty) ,* ) -> $r: ty [ $call: ident, $instr_altivec: ident / $instr_vsx: ident] ) => {
350- #[ inline]
351- #[ target_feature( enable = "altivec" ) ]
352- #[ cfg_attr( all( test, not( target_feature="vsx" ) ) , assert_instr( $instr_altivec) ) ]
353- #[ cfg_attr( all( test, target_feature="vsx" ) , assert_instr( $instr_vsx) ) ]
354- pub unsafe fn $fun ( $( $v : $ty) ,* ) -> $r {
355- $call ( $( $v) ,* )
356- }
357- }
358-
359- }
360-
361- #[ allow( unknown_lints, unused_macro_rules) ]
362- macro_rules! impl_vec_trait {
363- ( [ $Trait: ident $m: ident] $fun: ident ( $a: ty) ) => {
364- impl $Trait for $a {
365- #[ inline]
366- #[ target_feature( enable = "altivec" ) ]
367- unsafe fn $m( self ) -> Self {
368- $fun( transmute( self ) )
369- }
370- }
371- } ;
372- ( [ $Trait: ident $m: ident] $fun: ident ( $a: ty) -> $r: ty) => {
373- impl $Trait for $a {
374- type Result = $r;
375- #[ inline]
376- #[ target_feature( enable = "altivec" ) ]
377- unsafe fn $m( self ) -> Self :: Result {
378- $fun( transmute( self ) )
379- }
380- }
381- } ;
382- ( [ $Trait: ident $m: ident] 1 ( $ub: ident, $sb: ident, $uh: ident, $sh: ident, $uw: ident, $sw: ident, $sf: ident) ) => {
383- impl_vec_trait!{ [ $Trait $m] $ub ( vector_unsigned_char) -> vector_unsigned_char }
384- impl_vec_trait!{ [ $Trait $m] $sb ( vector_signed_char) -> vector_signed_char }
385- impl_vec_trait!{ [ $Trait $m] $uh ( vector_unsigned_short) -> vector_unsigned_short }
386- impl_vec_trait!{ [ $Trait $m] $sh ( vector_signed_short) -> vector_signed_short }
387- impl_vec_trait!{ [ $Trait $m] $uw ( vector_unsigned_int) -> vector_unsigned_int }
388- impl_vec_trait!{ [ $Trait $m] $sw ( vector_signed_int) -> vector_signed_int }
389- impl_vec_trait!{ [ $Trait $m] $sf ( vector_float) -> vector_float }
390- } ;
391- ( [ $Trait: ident $m: ident] $fun: ident ( $a: ty, $b: ty) -> $r: ty) => {
392- impl $Trait<$b> for $a {
393- type Result = $r;
394- #[ inline]
395- #[ target_feature( enable = "altivec" ) ]
396- unsafe fn $m( self , b: $b) -> Self :: Result {
397- $fun( transmute( self ) , transmute( b) )
398- }
399- }
400- } ;
401- ( [ $Trait: ident $m: ident] $fun: ident ( $a: ty, ~$b: ty) -> $r: ty) => {
402- impl_vec_trait!{ [ $Trait $m] $fun ( $a, $a) -> $r }
403- impl_vec_trait!{ [ $Trait $m] $fun ( $a, $b) -> $r }
404- impl_vec_trait!{ [ $Trait $m] $fun ( $b, $a) -> $r }
405- } ;
406- ( [ $Trait: ident $m: ident] ~( $ub: ident, $sb: ident, $uh: ident, $sh: ident, $uw: ident, $sw: ident) ) => {
407- impl_vec_trait!{ [ $Trait $m] $ub ( vector_unsigned_char, ~vector_bool_char) -> vector_unsigned_char }
408- impl_vec_trait!{ [ $Trait $m] $sb ( vector_signed_char, ~vector_bool_char) -> vector_signed_char }
409- impl_vec_trait!{ [ $Trait $m] $uh ( vector_unsigned_short, ~vector_bool_short) -> vector_unsigned_short }
410- impl_vec_trait!{ [ $Trait $m] $sh ( vector_signed_short, ~vector_bool_short) -> vector_signed_short }
411- impl_vec_trait!{ [ $Trait $m] $uw ( vector_unsigned_int, ~vector_bool_int) -> vector_unsigned_int }
412- impl_vec_trait!{ [ $Trait $m] $sw ( vector_signed_int, ~vector_bool_int) -> vector_signed_int }
413- } ;
414- ( [ $Trait: ident $m: ident] ~( $fn: ident) ) => {
415- impl_vec_trait!{ [ $Trait $m] ~( $fn, $fn, $fn, $fn, $fn, $fn) }
416- } ;
417- ( [ $Trait: ident $m: ident] 2 ( $ub: ident, $sb: ident, $uh: ident, $sh: ident, $uw: ident, $sw: ident) ) => {
418- impl_vec_trait!{ [ $Trait $m] $ub ( vector_unsigned_char, vector_unsigned_char) -> vector_unsigned_char }
419- impl_vec_trait!{ [ $Trait $m] $sb ( vector_signed_char, vector_signed_char) -> vector_signed_char }
420- impl_vec_trait!{ [ $Trait $m] $uh ( vector_unsigned_short, vector_unsigned_short) -> vector_unsigned_short }
421- impl_vec_trait!{ [ $Trait $m] $sh ( vector_signed_short, vector_signed_short) -> vector_signed_short }
422- impl_vec_trait!{ [ $Trait $m] $uw ( vector_unsigned_int, vector_unsigned_int) -> vector_unsigned_int }
423- impl_vec_trait!{ [ $Trait $m] $sw ( vector_signed_int, vector_signed_int) -> vector_signed_int }
424- } ;
425- ( [ $Trait: ident $m: ident] 2 ( $fn: ident) ) => {
426- impl_vec_trait!{ [ $Trait $m] ( $fn, $fn, $fn, $fn, $fn, $fn) }
427- }
428- }
429-
430340 macro_rules! impl_vec_cmp {
431341 ( [ $Trait: ident $m: ident] ( $b: ident, $h: ident, $w: ident) ) => {
432342 impl_vec_cmp! { [ $Trait $m] ( $b, $b, $h, $h, $w, $w) }
0 commit comments