;; Tests from wabt: https://github.com/WebAssembly/wabt/tree/master/test/interp ;; Distributed under the terms of the wabt license: https://github.com/WebAssembly/wabt/blob/master/LICENSE ;; Modified for compatibility with WAVM's interpretation of the proposed spec. (module ;; i8x16 eq (func (export "i8x16_eq_0") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 i8x16.eq) (func (export "i8x16_eq_1") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x77000004 v128.const i32x4 0x05000001 0x0e002002 0x44000003 0x00000004 i8x16.eq) ;; i16x8 eq (func (export "i16x8_eq_0") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 i16x8.eq) (func (export "i16x8_eq_1") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x77000004 v128.const i32x4 0x05000001 0x0e002002 0x44000003 0x00000004 i16x8.eq) ;; i32x4 eq (func (export "i32x4_eq_0") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 i32x4.eq) (func (export "i32x4_eq_1") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x77000004 v128.const i32x4 0x05000001 0x0e002002 0x44000003 0x00000004 i32x4.eq) ;; f32x4 eq ;; For Floating num: ;; +0.0 = 0x00000000, -0.0 = 0x80000000, 0xffc00000 is a NaN ;; 1.5 = 0x449a5000, 1.0 = 0x3f800000 (func (export "f32x4_eq_0") (result v128) v128.const i32x4 0x00000000 0xffc00000 0x449a5000 0x449a5000 v128.const i32x4 0x80000000 0xffc00000 0x449a5000 0x3f800000 f32x4.eq) ;; f64x2 eq ;; For Double num: ;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000 ;; fff8000000000000 is a NaN ;; 1.5 = 3ff8000000000000, 1.0 = 0x3ff0000000000000 (func (export "f64x2_eq_0") (result v128) v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000 v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000 f64x2.eq) (func (export "f64x2_eq_1") (result v128) v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff80000 v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff00000 f64x2.eq) ;; i8x16 ne (func (export "i8x16_ne_0") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 i8x16.ne) (func (export "i8x16_ne_1") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x77000004 v128.const i32x4 0x05000001 0x0e002002 0x44000003 0x00000004 i8x16.ne) ;; i16x8 ne (func (export "i16x8_ne_0") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 i16x8.ne) (func (export "i16x8_ne_1") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x77000004 v128.const i32x4 0x05000001 0x0e002002 0x44000003 0x00000004 i16x8.ne) ;; i32x4 ne (func (export "i32x4_ne_0") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x00000004 i32x4.ne) (func (export "i32x4_ne_1") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00000003 0x77000004 v128.const i32x4 0x05000001 0x0e002002 0x44000003 0x00000004 i32x4.ne) ;; f32x4 ne ;; For Floating num: ;; +0.0 = 0x00000000, -0.0 = 0x80000000, 0xffc00000 is a NaN ;; 1.5 = 0x449a5000, 1.0 = 0x3f800000 (func (export "f32x4_ne_0") (result v128) v128.const i32x4 0x00000000 0xffc00000 0x449a5000 0x449a5000 v128.const i32x4 0x80000000 0xffc00000 0x449a5000 0x3f800000 f32x4.ne) ;; f64x2 ne ;; For Double num: ;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000 ;; fff8000000000000 is a NaN ;; 1.5 = 3ff8000000000000, 1.0 = 0x3ff0000000000000 (func (export "f64x2_ne_0") (result v128) v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000 v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000 f64x2.ne) (func (export "f64x2_ne_1") (result v128) v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff80000 v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff00000 f64x2.ne) ;; i8x16 lt (sign and unsigned) (func (export "i8x16_lt_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.lt_s) (func (export "i8x16_lt_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.lt_u) ;; i16x8 lt (sign and unsigned) (func (export "i16x8_lt_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.lt_s) (func (export "i16x8_lt_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.lt_u) ;; i32x4 lt (sign and unsigned) (func (export "i32x4_lt_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.lt_s) (func (export "i32x4_lt_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.lt_u) ;; f32x4 lt ;; For Floating num: ;; +0.0 = 0x00000000, -0.0 = 0x80000000, 0xffc00000 is a NaN ;; 1.5 = 0x449a5000, 1.0 = 0x3f800000 (func (export "f32x4_lt_0") (result v128) v128.const i32x4 0x00000000 0xffc00000 0x449a5000 0x449a5000 v128.const i32x4 0x80000000 0xffc00000 0xffc00000 0x3f800000 f32x4.lt) ;; f64x2 lt ;; For Double num: ;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000 ;; fff8000000000000 is a NaN ;; 1.5 = 3ff8000000000000, 1.0 = 0x3ff0000000000000 (func (export "f64x2_lt_0") (result v128) v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000 v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000 f64x2.lt) (func (export "f64x2_lt_1") (result v128) v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff80000 v128.const i32x4 0x00000000 0xfff80000 0x00000000 0x3ff00000 f64x2.lt) ;; i8x16 le (sign and unsigned) (func (export "i8x16_le_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.le_s) (func (export "i8x16_le_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.le_u) ;; i16x8 le (sign and unsigned) (func (export "i16x8_le_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.le_s) (func (export "i16x8_le_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.le_u) ;; i32x4 le (sign and unsigned) (func (export "i32x4_le_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.le_s) (func (export "i32x4_le_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.le_u) ;; f32x4 le ;; For Floating num: ;; +0.0 = 0x00000000, -0.0 = 0x80000000, 0xffc00000 is a NaN ;; 1.5 = 0x449a5000, 1.0 = 0x3f800000 (func (export "f32x4_le_0") (result v128) v128.const i32x4 0x00000000 0xffc00000 0x449a5000 0x449a5000 v128.const i32x4 0x80000000 0xffc00000 0xffc00000 0x3f800000 f32x4.le) ;; f64x2 le ;; For Double num: ;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000 ;; fff8000000000000 is a NaN ;; 1.5 = 3ff8000000000000, 1.0 = 0x3ff0000000000000 (func (export "f64x2_le_0") (result v128) v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000 v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000 f64x2.le) (func (export "f64x2_le_1") (result v128) v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff80000 v128.const i32x4 0x00000000 0xfff80000 0x00000000 0x3ff00000 f64x2.le) ;; i8x16 gt (sign and unsigned) (func (export "i8x16_gt_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.gt_s) (func (export "i8x16_gt_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.gt_u) ;; i16x8 gt (sign and unsigned) (func (export "i16x8_gt_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.gt_s) (func (export "i16x8_gt_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.gt_u) ;; i32x4 gt (sign and unsigned) (func (export "i32x4_gt_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.gt_s) (func (export "i32x4_gt_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.gt_u) ;; f32x4 gt ;; For Floating num: ;; +0.0 = 0x00000000, -0.0 = 0x80000000, 0xffc00000 is a NaN ;; 1.5 = 0x449a5000, 1.0 = 0x3f800000 (func (export "f32x4_gt_0") (result v128) v128.const i32x4 0x00000000 0xffc00000 0x449a5000 0x449a5000 v128.const i32x4 0x80000000 0xffc00000 0xffc00000 0x3f800000 f32x4.gt) ;; f64x2 gt ;; For Double num: ;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000 ;; fff8000000000000 is a NaN ;; 1.5 = 3ff8000000000000, 1.0 = 0x3ff0000000000000 (func (export "f64x2_gt_0") (result v128) v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000 v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000 f64x2.gt) (func (export "f64x2_gt_1") (result v128) v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff80000 v128.const i32x4 0x00000000 0xfff80000 0x00000000 0x3ff00000 f64x2.gt) ;; i8x16 ge (sign and unsigned) (func (export "i8x16_ge_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.ge_s) (func (export "i8x16_ge_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i8x16.ge_u) ;; i16x8 ge (sign and unsigned) (func (export "i16x8_ge_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.ge_s) (func (export "i16x8_ge_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i16x8.ge_u) ;; i32x4 ge (sign and unsigned) (func (export "i32x4_ge_s") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.ge_s) (func (export "i32x4_ge_u") (result v128) v128.const i32x4 0xff000001 0xe0000002 0x00008003 0x00000004 v128.const i32x4 0x02000001 0xe000ff02 0x00000003 0x00008104 i32x4.ge_u) ;; f32x4 ge ;; For Floating num: ;; +0.0 = 0x00000000, -0.0 = 0x80000000, 0xffc00000 is a NaN ;; 1.5 = 0x449a5000, 1.0 = 0x3f800000 (func (export "f32x4_ge_0") (result v128) v128.const i32x4 0x00000000 0xffc00000 0x449a5000 0x449a5000 v128.const i32x4 0x80000000 0xffc00000 0xffc00000 0x3f800000 f32x4.ge) ;; f64x2 ge ;; For Double num: ;; +0.0 = 0x0000000000000000, -0.0 = 0x8000000000000000 ;; fff8000000000000 is a NaN ;; 1.5 = 3ff8000000000000, 1.0 = 0x3ff0000000000000 (func (export "f64x2_ge_0") (result v128) v128.const i32x4 0x00000000 0x00000000 0x00000000 0xfff80000 v128.const i32x4 0x00000000 0x80000000 0x00000000 0xfff80000 f64x2.ge) (func (export "f64x2_ge_1") (result v128) v128.const i32x4 0x00000000 0x3ff80000 0x00000000 0x3ff80000 v128.const i32x4 0x00000000 0xfff80000 0x00000000 0x3ff00000 f64x2.ge) ) (assert_return (invoke "i8x16_eq_0") (v128.const i8x16 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1)) (assert_return (invoke "i8x16_eq_1") (v128.const i8x16 -1 -1 -1 0 -1 0 -1 0 -1 -1 -1 0 -1 -1 -1 0)) (assert_return (invoke "i16x8_eq_0") (v128.const i16x8 -1 -1 -1 -1 -1 -1 -1 -1)) (assert_return (invoke "i16x8_eq_1") (v128.const i16x8 -1 0 0 0 -1 0 -1 0)) (assert_return (invoke "i32x4_eq_0") (v128.const i32x4 -1 -1 -1 -1)) (assert_return (invoke "i32x4_eq_1") (v128.const i32x4 0 0 0 0)) (assert_return (invoke "f32x4_eq_0") (v128.const i32x4 -1 0 -1 0)) (assert_return (invoke "f64x2_eq_0") (v128.const i64x2 -1 0)) (assert_return (invoke "f64x2_eq_1") (v128.const i64x2 -1 0)) (assert_return (invoke "i8x16_ne_0") (v128.const i8x16 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)) (assert_return (invoke "i8x16_ne_1") (v128.const i8x16 0 0 0 -1 0 -1 0 -1 0 0 0 -1 0 0 0 -1)) (assert_return (invoke "i16x8_ne_0") (v128.const i16x8 0 0 0 0 0 0 0 0)) (assert_return (invoke "i16x8_ne_1") (v128.const i16x8 0 -1 -1 -1 0 -1 0 -1)) (assert_return (invoke "i32x4_ne_0") (v128.const i32x4 0 0 0 0)) (assert_return (invoke "i32x4_ne_1") (v128.const i32x4 -1 -1 -1 -1)) (assert_return (invoke "f32x4_ne_0") (v128.const i32x4 0 -1 0 -1)) (assert_return (invoke "f64x2_ne_0") (v128.const i64x2 0 -1)) (assert_return (invoke "f64x2_ne_1") (v128.const i64x2 0 -1)) (assert_return (invoke "i8x16_lt_s") (v128.const i8x16 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 0)) (assert_return (invoke "i8x16_lt_u") (v128.const i8x16 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0)) (assert_return (invoke "i16x8_lt_s") (v128.const i16x8 0 -1 0 0 -1 0 0 0)) (assert_return (invoke "i16x8_lt_u") (v128.const i16x8 0 0 -1 0 0 0 -1 0)) (assert_return (invoke "i32x4_lt_s") (v128.const i32x4 -1 -1 0 -1)) (assert_return (invoke "i32x4_lt_u") (v128.const i32x4 0 -1 0 -1)) (assert_return (invoke "f32x4_lt_0") (v128.const i32x4 0 0 0 0)) (assert_return (invoke "f64x2_lt_0") (v128.const i64x2 0 0)) (assert_return (invoke "f64x2_lt_1") (v128.const i64x2 0 0)) (assert_return (invoke "i8x16_le_s") (v128.const i8x16 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1)) (assert_return (invoke "i8x16_le_u") (v128.const i8x16 -1 -1 -1 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1)) (assert_return (invoke "i16x8_le_s") (v128.const i16x8 -1 -1 0 -1 -1 -1 0 -1)) (assert_return (invoke "i16x8_le_u") (v128.const i16x8 -1 0 -1 -1 0 -1 -1 -1)) (assert_return (invoke "i32x4_le_s") (v128.const i32x4 -1 -1 0 -1)) (assert_return (invoke "i32x4_le_u") (v128.const i32x4 0 -1 0 -1)) (assert_return (invoke "f32x4_le_0") (v128.const i32x4 -1 0 0 0)) (assert_return (invoke "f64x2_le_0") (v128.const i64x2 -1 0)) (assert_return (invoke "f64x2_le_1") (v128.const i64x2 0 0)) (assert_return (invoke "i8x16_gt_s") (v128.const i8x16 0 0 0 0 0 -1 0 0 0 0 0 0 0 -1 0 0)) (assert_return (invoke "i8x16_gt_u") (v128.const i8x16 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 0)) (assert_return (invoke "i16x8_gt_s") (v128.const i16x8 0 0 -1 0 0 0 -1 0)) (assert_return (invoke "i16x8_gt_u") (v128.const i16x8 0 -1 0 0 -1 0 0 0)) (assert_return (invoke "i32x4_gt_s") (v128.const i32x4 0 0 -1 0)) (assert_return (invoke "i32x4_gt_u") (v128.const i32x4 -1 0 -1 0)) (assert_return (invoke "f32x4_gt_0") (v128.const i32x4 0 0 0 -1)) (assert_return (invoke "f64x2_gt_0") (v128.const i64x2 0 0)) (assert_return (invoke "f64x2_gt_1") (v128.const i64x2 0 -1)) (assert_return (invoke "i8x16_ge_s") (v128.const i8x16 -1 -1 -1 0 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1)) (assert_return (invoke "i8x16_ge_u") (v128.const i8x16 -1 -1 -1 -1 -1 0 -1 -1 -1 -1 -1 -1 -1 0 -1 -1)) (assert_return (invoke "i16x8_ge_s") (v128.const i16x8 -1 0 -1 -1 0 -1 -1 -1)) (assert_return (invoke "i16x8_ge_u") (v128.const i16x8 -1 -1 0 -1 -1 -1 0 -1)) (assert_return (invoke "i32x4_ge_s") (v128.const i32x4 0 0 -1 0)) (assert_return (invoke "i32x4_ge_u") (v128.const i32x4 -1 0 -1 0)) (assert_return (invoke "f32x4_ge_0") (v128.const i32x4 -1 0 0 -1)) (assert_return (invoke "f64x2_ge_0") (v128.const i64x2 -1 0)) (assert_return (invoke "f64x2_ge_1") (v128.const i64x2 0 -1))