github.com/tetratelabs/wazero@v1.7.3-0.20240513003603-48f702e154b5/internal/integration_test/spectest/v2/testdata/simd_load_zero.wast (about) 1 ;; Load and Zero extend test cases 2 3 (module 4 (memory 1) 5 (data (i32.const 0) "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\80\81\82\83\84\85\86\87\88\89") 6 (data (i32.const 65520) "\0A\0B\0C\0D\0E\0F\80\81\82\83\84\85\86\87\88\89") 7 8 (func (export "v128.load32_zero") (param $0 i32) (result v128) 9 (v128.load32_zero (local.get $0)) 10 ) 11 (func (export "v128.load64_zero") (param $0 i32) (result v128) 12 (v128.load64_zero (local.get $0)) 13 ) 14 15 ;; load by a constant amount 16 (func (export "v128.load32_zero_const0") (result v128) 17 (v128.load32_zero (i32.const 0)) 18 ) 19 (func (export "v128.load64_zero_const8") (result v128) 20 (v128.load64_zero (i32.const 8)) 21 ) 22 23 ;; load data with different offset/align arguments 24 ;; i16x8 25 (func (export "v128.load32_zero_offset0") (param $0 i32) (result v128) 26 (v128.load32_zero offset=0 (local.get $0)) 27 ) 28 (func (export "v128.load32_zero_align1") (param $0 i32) (result v128) 29 (v128.load32_zero align=1 (local.get $0)) 30 ) 31 (func (export "v128.load32_zero_offset0_align1") (param $0 i32) (result v128) 32 (v128.load32_zero offset=0 align=1 (local.get $0)) 33 ) 34 (func (export "v128.load32_zero_offset1_align1") (param $0 i32) (result v128) 35 (v128.load32_zero offset=1 align=1 (local.get $0)) 36 ) 37 (func (export "v128.load32_zero_offset10_align4") (param $0 i32) (result v128) 38 (v128.load32_zero offset=10 align=4 (local.get $0)) 39 ) 40 (func (export "v128.load64_zero_offset0") (param $0 i32) (result v128) 41 (v128.load64_zero offset=0 (local.get $0)) 42 ) 43 (func (export "v128.load64_zero_align1") (param $0 i32) (result v128) 44 (v128.load64_zero align=1 (local.get $0)) 45 ) 46 (func (export "v128.load64_zero_offset0_align1") (param $0 i32) (result v128) 47 (v128.load64_zero offset=0 align=1 (local.get $0)) 48 ) 49 (func (export "v128.load64_zero_offset1_align1") (param $0 i32) (result v128) 50 (v128.load64_zero offset=1 align=1 (local.get $0)) 51 ) 52 (func (export "v128.load64_zero_offset10_align4") (param $0 i32) (result v128) 53 (v128.load64_zero offset=10 align=4 (local.get $0)) 54 ) 55 (func (export "v128.load64_zero_offset20_align8") (param $0 i32) (result v128) 56 (v128.load64_zero offset=20 align=8 (local.get $0)) 57 ) 58 ) 59 60 61 ;; normal 62 (assert_return (invoke "v128.load32_zero" (i32.const 0)) (v128.const i32x4 0x03020100 0x00000000 0x00000000 0x00000000)) 63 (assert_return (invoke "v128.load64_zero" (i32.const 0)) (v128.const i64x2 0x0706050403020100 0x0000000000000000)) 64 (assert_return (invoke "v128.load32_zero" (i32.const 10)) (v128.const i32x4 0x0D0C0B0A 0x00000000 0x00000000 0x00000000)) 65 (assert_return (invoke "v128.load64_zero" (i32.const 10)) (v128.const i64x2 0x81800F0E0D0C0B0A 0x0000000000000000)) 66 (assert_return (invoke "v128.load32_zero" (i32.const 20)) (v128.const i32x4 0x87868584 0x00000000 0x00000000 0x00000000)) 67 (assert_return (invoke "v128.load64_zero" (i32.const 20)) (v128.const i64x2 0x0000898887868584 0x0000000000000000)) 68 69 ;; load by a constant amount 70 (assert_return (invoke "v128.load32_zero_const0") (v128.const i32x4 0x03020100 0x00000000 0x00000000 0x00000000)) 71 (assert_return (invoke "v128.load64_zero_const8") (v128.const i64x2 0x0F0E0D0C0B0A0908 0x0000000000000000)) 72 73 ;; load data with different offset/align arguments 74 ;; load32_zero 75 (assert_return (invoke "v128.load32_zero_offset0" (i32.const 0)) (v128.const i32x4 0x03020100 0x00000000 0x00000000 0x00000000)) 76 (assert_return (invoke "v128.load32_zero_align1" (i32.const 1)) (v128.const i32x4 0x04030201 0x00000000 0x00000000 0x00000000)) 77 (assert_return (invoke "v128.load32_zero_offset0_align1" (i32.const 2)) (v128.const i32x4 0x05040302 0x00000000 0x00000000 0x00000000)) 78 (assert_return (invoke "v128.load32_zero_offset10_align4" (i32.const 3)) (v128.const i32x4 0x800F0E0D 0x00000000 0x00000000 0x00000000)) 79 80 ;; load64_zero 81 (assert_return (invoke "v128.load64_zero_offset0" (i32.const 0)) (v128.const i64x2 0x0706050403020100 0x0000000000000000)) 82 (assert_return (invoke "v128.load64_zero_align1" (i32.const 1)) (v128.const i64x2 0x0807060504030201 0x0000000000000000)) 83 (assert_return (invoke "v128.load64_zero_offset0_align1" (i32.const 2)) (v128.const i64x2 0x0908070605040302 0x0000000000000000)) 84 (assert_return (invoke "v128.load64_zero_offset10_align4" (i32.const 3)) (v128.const i64x2 0x84838281800F0E0D 0x0000000000000000)) 85 (assert_return (invoke "v128.load64_zero_offset20_align8" (i32.const 4)) (v128.const i64x2 0x0000000000008988 0x0000000000000000)) 86 87 ;; out of bounds memory access 88 (assert_trap (invoke "v128.load32_zero" (i32.const -1)) "out of bounds memory access") 89 (assert_trap (invoke "v128.load64_zero" (i32.const -1)) "out of bounds memory access") 90 91 (assert_trap (invoke "v128.load32_zero_offset1_align1" (i32.const -1)) "out of bounds memory access") 92 (assert_trap (invoke "v128.load64_zero_offset1_align1" (i32.const -1)) "out of bounds memory access") 93 94 ;; type check 95 (assert_invalid (module (memory 0) (func (result v128) (v128.load32_zero (f32.const 0)))) "type mismatch") 96 (assert_invalid (module (memory 0) (func (result v128) (v128.load64_zero (f32.const 0)))) "type mismatch") 97 98 ;; Test operation with empty argument 99 100 (assert_invalid 101 (module (memory 0) 102 (func $v128.load32_zero-arg-empty (result v128) 103 (v128.load32_zero) 104 ) 105 ) 106 "type mismatch" 107 ) 108 (assert_invalid 109 (module (memory 0) 110 (func $v128.load64_zero-arg-empty (result v128) 111 (v128.load64_zero) 112 ) 113 ) 114 "type mismatch" 115 ) 116 117 ;; Unknown operator 118 119 (assert_malformed (module quote "(memory 1) (func (drop (i16x8.load16x4_s (i32.const 0))))") "unknown operator") 120 (assert_malformed (module quote "(memory 1) (func (drop (i16x8.load16x4_u (i32.const 0))))") "unknown operator") 121 (assert_malformed (module quote "(memory 1) (func (drop (i32x4.load32x2_s (i32.const 0))))") "unknown operator") 122 (assert_malformed (module quote "(memory 1) (func (drop (i32x4.load32x2_u (i32.const 0))))") "unknown operator") 123 (assert_malformed (module quote "(memory 1) (func (drop (i64x2.load64x1_s (i32.const 0))))") "unknown operator") 124 (assert_malformed (module quote "(memory 1) (func (drop (i64x2.load64x1_u (i32.const 0))))") "unknown operator") 125 126 ;; combination 127 (module 128 (memory 1) 129 (data (i32.const 0) "\00\01\02\03\04\05\06\07\08\09\0A\0B\0C\0D\0E\0F\80\81\82\83\84\85\86\87\88\89") 130 (func (export "v128.load32_zero-in-block") (result v128) 131 (block (result v128) (block (result v128) (v128.load32_zero (i32.const 0)))) 132 ) 133 (func (export "v128.load64_zero-in-block") (result v128) 134 (block (result v128) (block (result v128) (v128.load64_zero (i32.const 1)))) 135 ) 136 (func (export "v128.load32_zero-as-br-value") (result v128) 137 (block (result v128) (br 0 (v128.load32_zero (i32.const 6)))) 138 ) 139 (func (export "v128.load64_zero-as-br-value") (result v128) 140 (block (result v128) (br 0 (v128.load64_zero (i32.const 7)))) 141 ) 142 (func (export "v128.load32_zero-extract_lane_s-operand") (result i32) 143 (i32x4.extract_lane 0 (v128.load32_zero (i32.const 12))) 144 ) 145 (func (export "v128.load64_zero-extract_lane_s-operand") (result i64) 146 (i64x2.extract_lane 0 (v128.load64_zero (i32.const 13))) 147 ) 148 ) 149 (assert_return (invoke "v128.load32_zero-in-block") (v128.const i32x4 0x03020100 0x00000000 0x00000000 0x00000000)) 150 (assert_return (invoke "v128.load64_zero-in-block") (v128.const i64x2 0x0807060504030201 0x0000000000000000)) 151 (assert_return (invoke "v128.load32_zero-as-br-value") (v128.const i32x4 0x09080706 0x00000000 0x00000000 0x00000000)) 152 (assert_return (invoke "v128.load64_zero-as-br-value") (v128.const i64x2 0x0E0D0C0B0A090807 0x0000000000000000)) 153 (assert_return (invoke "v128.load32_zero-extract_lane_s-operand") (i32.const 0x0F0E0D0C)) 154 (assert_return (invoke "v128.load64_zero-extract_lane_s-operand") (i64.const 0x84838281800F0E0D))