@@ -271,6 +271,10 @@ extern "C" {
271
271
#[ link_name = "llvm.wasm.pmax.v2f64" ]
272
272
fn llvm_f64x2_pmax ( x : simd:: f64x2 , y : simd:: f64x2 ) -> simd:: f64x2 ;
273
273
274
+ #[ link_name = "llvm.wasm.trunc.saturate.signed.v4i32.v4f32" ]
275
+ fn llvm_i32x4_trunc_sat_f32x4_s ( x : simd:: f32x4 ) -> simd:: i32x4 ;
276
+ #[ link_name = "llvm.wasm.trunc.saturate.unsigned.v4i32.v4f32" ]
277
+ fn llvm_i32x4_trunc_sat_f32x4_u ( x : simd:: f32x4 ) -> simd:: i32x4 ;
274
278
#[ link_name = "llvm.wasm.convert.low.signed" ]
275
279
fn llvm_f64x2_convert_low_i32x4_s ( x : simd:: i32x4 ) -> simd:: f64x2 ;
276
280
#[ link_name = "llvm.wasm.convert.low.unsigned" ]
@@ -1564,7 +1568,7 @@ pub unsafe fn u32x4_ge(a: v128, b: v128) -> v128 {
1564
1568
/// Returns a new vector where each lane is all ones if the pairwise elements
1565
1569
/// were equal, or all zeros if the elements were not equal.
1566
1570
#[ inline]
1567
- // #[cfg_attr(test, assert_instr(i64x2.eq))] // FIXME llvm
1571
+ #[ cfg_attr( test, assert_instr( i64x2. eq) ) ]
1568
1572
#[ target_feature( enable = "simd128" ) ]
1569
1573
pub unsafe fn i64x2_eq ( a : v128 , b : v128 ) -> v128 {
1570
1574
transmute ( simd_eq :: < _ , simd:: i64x2 > ( a. as_i64x2 ( ) , b. as_i64x2 ( ) ) )
@@ -1576,7 +1580,7 @@ pub unsafe fn i64x2_eq(a: v128, b: v128) -> v128 {
1576
1580
/// Returns a new vector where each lane is all ones if the pairwise elements
1577
1581
/// were not equal, or all zeros if the elements were equal.
1578
1582
#[ inline]
1579
- // #[cfg_attr(test, assert_instr(i64x2.ne))] // FIXME llvm
1583
+ #[ cfg_attr( test, assert_instr( i64x2. ne) ) ]
1580
1584
#[ target_feature( enable = "simd128" ) ]
1581
1585
pub unsafe fn i64x2_ne ( a : v128 , b : v128 ) -> v128 {
1582
1586
transmute ( simd_ne :: < _ , simd:: i64x2 > ( a. as_i64x2 ( ) , b. as_i64x2 ( ) ) )
@@ -1588,7 +1592,7 @@ pub unsafe fn i64x2_ne(a: v128, b: v128) -> v128 {
1588
1592
/// Returns a new vector where each lane is all ones if the pairwise left
1589
1593
/// element is less than the pairwise right element, or all zeros otherwise.
1590
1594
#[ inline]
1591
- // #[cfg_attr(test, assert_instr(i64x2.lt_s))] // FIXME llvm
1595
+ #[ cfg_attr( test, assert_instr( i64x2. lt_s) ) ]
1592
1596
#[ target_feature( enable = "simd128" ) ]
1593
1597
pub unsafe fn i64x2_lt ( a : v128 , b : v128 ) -> v128 {
1594
1598
transmute ( simd_lt :: < _ , simd:: i64x2 > ( a. as_i64x2 ( ) , b. as_i64x2 ( ) ) )
@@ -1600,7 +1604,7 @@ pub unsafe fn i64x2_lt(a: v128, b: v128) -> v128 {
1600
1604
/// Returns a new vector where each lane is all ones if the pairwise left
1601
1605
/// element is greater than the pairwise right element, or all zeros otherwise.
1602
1606
#[ inline]
1603
- // #[cfg_attr(test, assert_instr(i64x2.gt_s))] // FIXME llvm
1607
+ #[ cfg_attr( test, assert_instr( i64x2. gt_s) ) ]
1604
1608
#[ target_feature( enable = "simd128" ) ]
1605
1609
pub unsafe fn i64x2_gt ( a : v128 , b : v128 ) -> v128 {
1606
1610
transmute ( simd_gt :: < _ , simd:: i64x2 > ( a. as_i64x2 ( ) , b. as_i64x2 ( ) ) )
@@ -1612,7 +1616,7 @@ pub unsafe fn i64x2_gt(a: v128, b: v128) -> v128 {
1612
1616
/// Returns a new vector where each lane is all ones if the pairwise left
1613
1617
/// element is less than the pairwise right element, or all zeros otherwise.
1614
1618
#[ inline]
1615
- // #[cfg_attr(test, assert_instr(i64x2.le_s))] // FIXME llvm
1619
+ #[ cfg_attr( test, assert_instr( i64x2. le_s) ) ]
1616
1620
#[ target_feature( enable = "simd128" ) ]
1617
1621
pub unsafe fn i64x2_le ( a : v128 , b : v128 ) -> v128 {
1618
1622
transmute ( simd_le :: < _ , simd:: i64x2 > ( a. as_i64x2 ( ) , b. as_i64x2 ( ) ) )
@@ -1624,7 +1628,7 @@ pub unsafe fn i64x2_le(a: v128, b: v128) -> v128 {
1624
1628
/// Returns a new vector where each lane is all ones if the pairwise left
1625
1629
/// element is greater than the pairwise right element, or all zeros otherwise.
1626
1630
#[ inline]
1627
- // #[cfg_attr(test, assert_instr(i64x2.ge_s))] // FIXME llvm
1631
+ #[ cfg_attr( test, assert_instr( i64x2. ge_s) ) ]
1628
1632
#[ target_feature( enable = "simd128" ) ]
1629
1633
pub unsafe fn i64x2_ge ( a : v128 , b : v128 ) -> v128 {
1630
1634
transmute ( simd_ge :: < _ , simd:: i64x2 > ( a. as_i64x2 ( ) , b. as_i64x2 ( ) ) )
@@ -1862,7 +1866,7 @@ pub unsafe fn i8x16_neg(a: v128) -> v128 {
1862
1866
1863
1867
/// Count the number of bits set to one within each lane.
1864
1868
#[ inline]
1865
- // #[cfg_attr(test, assert_instr(i8x16.popcnt))] // FIXME llvm & wasmtime
1869
+ // #[cfg_attr(test, assert_instr(i8x16.popcnt))] // FIXME wasmtime
1866
1870
#[ target_feature( enable = "simd128" ) ]
1867
1871
pub unsafe fn i8x16_popcnt ( v : v128 ) -> v128 {
1868
1872
transmute ( llvm_popcnt ( v. as_i8x16 ( ) ) )
@@ -3088,7 +3092,7 @@ pub unsafe fn f64x2_pmax(a: v128, b: v128) -> v128 {
3088
3092
#[ cfg_attr( test, assert_instr( i32x4. trunc_sat_f32x4_s) ) ]
3089
3093
#[ target_feature( enable = "simd128" ) ]
3090
3094
pub unsafe fn i32x4_trunc_sat_f32x4 ( a : v128 ) -> v128 {
3091
- transmute ( simd_cast :: < _ , simd :: i32x4 > ( a. as_f32x4 ( ) ) )
3095
+ transmute ( llvm_i32x4_trunc_sat_f32x4_s ( a. as_f32x4 ( ) ) )
3092
3096
}
3093
3097
3094
3098
/// Converts a 128-bit vector interpreted as four 32-bit floating point numbers
@@ -3100,7 +3104,7 @@ pub unsafe fn i32x4_trunc_sat_f32x4(a: v128) -> v128 {
3100
3104
#[ cfg_attr( test, assert_instr( i32x4. trunc_sat_f32x4_u) ) ]
3101
3105
#[ target_feature( enable = "simd128" ) ]
3102
3106
pub unsafe fn u32x4_trunc_sat_f32x4 ( a : v128 ) -> v128 {
3103
- transmute ( simd_cast :: < _ , simd :: u32x4 > ( a. as_f32x4 ( ) ) )
3107
+ transmute ( llvm_i32x4_trunc_sat_f32x4_u ( a. as_f32x4 ( ) ) )
3104
3108
}
3105
3109
3106
3110
/// Converts a 128-bit vector interpreted as four 32-bit signed integers into a
@@ -3153,7 +3157,7 @@ pub unsafe fn u32x4_trunc_sat_f64x2_zero(a: v128) -> v128 {
3153
3157
3154
3158
/// Lane-wise conversion from integer to floating point.
3155
3159
#[ inline]
3156
- // #[cfg_attr(test, assert_instr(f64x2.convert_low_i32x4_s))] // FIXME wasmtime
3160
+ #[ cfg_attr( test, assert_instr( f64x2. convert_low_i32x4_s) ) ]
3157
3161
#[ target_feature( enable = "simd128" ) ]
3158
3162
pub unsafe fn f64x2_convert_low_i32x4 ( a : v128 ) -> v128 {
3159
3163
transmute ( llvm_f64x2_convert_low_i32x4_s ( a. as_i32x4 ( ) ) )
@@ -3193,6 +3197,7 @@ pub mod tests {
3193
3197
use super :: * ;
3194
3198
use core:: ops:: { Add , Div , Mul , Neg , Sub } ;
3195
3199
use std;
3200
+ use std:: fmt:: Debug ;
3196
3201
use std:: mem;
3197
3202
use std:: num:: Wrapping ;
3198
3203
use std:: prelude:: v1:: * ;
@@ -4722,6 +4727,11 @@ pub mod tests {
4722
4727
u32x4_trunc_sat_f32x4 ( f32x4 ( 1. , f32:: NEG_INFINITY , f32:: INFINITY , f32:: NAN ) ) ,
4723
4728
u32x4 ( 1 , 0 , u32:: MAX , 0 ) ,
4724
4729
) ;
4730
+ compare_bytes ( f64x2_convert_low_i32x4 ( i32x4 ( 1 , 2 , 3 , 4 ) ) , f64x2 ( 1. , 2. ) ) ;
4731
+ compare_bytes (
4732
+ f64x2_convert_low_i32x4 ( i32x4 ( i32:: MIN , i32:: MAX , 3 , 4 ) ) ,
4733
+ f64x2 ( f64:: from ( i32:: MIN ) , f64:: from ( i32:: MAX ) ) ,
4734
+ ) ;
4725
4735
}
4726
4736
}
4727
4737
}
0 commit comments