From 30a97274bde7a1988d80861ab9b381148f3d19a7 Mon Sep 17 00:00:00 2001 From: Wojciech Kosior Date: Tue, 29 Dec 2020 19:50:56 +0100 Subject: fix align values --- examples/example1a_blink_led_wasm/instructions.wat | 10 +++++----- examples/example2a_measure_time_wasm/instructions.wat | 6 +++--- examples/example2b_measure_time_wasm/instructions.wat | 6 +++--- tests/wasm_compile_arithm/instructions.wat | 8 ++++---- tests/wasm_compile_block/instructions.wat | 8 ++++---- tests/wasm_compile_br/instructions.wat | 4 ++-- tests/wasm_compile_br_if/instructions.wat | 6 +++--- tests/wasm_compile_function_call/instructions.wat | 2 +- tests/wasm_compile_if_else/instructions.wat | 4 ++-- tests/wasm_compile_loop/instructions.wat | 2 +- tests/wasm_compile_simple_module/instructions.wat | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/examples/example1a_blink_led_wasm/instructions.wat b/examples/example1a_blink_led_wasm/instructions.wat index f231c13..4f56daf 100644 --- a/examples/example1a_blink_led_wasm/instructions.wat +++ b/examples/example1a_blink_led_wasm/instructions.wat @@ -7,29 +7,29 @@ ;; loop until timer exceeds 1500 (loop $again (br_if $again (i32.lt_u - (i32.load16_u offset=0x0 align=1 + (i32.load16_u offset=0x0 align=2 (i32.const 0x1BFC08)) (i32.const 1500)))) ;; now, light led2 - (i32.store16 offset=0x0 align=1 + (i32.store16 offset=0x0 align=2 (i32.const 0x1BFC06) (i32.const 0x1)) ;; loop until timer exceeds 3000 (loop $again (br_if $again (i32.lt_u - (i32.load16_u offset=0x0 align=1 + (i32.load16_u offset=0x0 align=2 (i32.const 0x1BFC08)) (i32.const 3000)))) ;; now, switch led2 off - (i32.store16 offset=0x0 align=1 + (i32.store16 offset=0x0 align=2 (i32.const 0x1BFC06) (i32.const 0x0)) ;; loop until timer exceeds 4500 (loop $again (br_if $again (i32.lt_u - (i32.load16_u offset=0x0 align=1 + (i32.load16_u offset=0x0 align=2 (i32.const 0x1BFC08)) (i32.const 4500))))) (export "main" (func $main))) diff --git a/examples/example2a_measure_time_wasm/instructions.wat b/examples/example2a_measure_time_wasm/instructions.wat index 3a6be34..01e081a 100644 --- a/examples/example2a_measure_time_wasm/instructions.wat +++ b/examples/example2a_measure_time_wasm/instructions.wat @@ -66,7 +66,7 @@ (local $adr i32) ;; reset the timer (although it should already be resetted, anyway...) - (i32.store16 offset=0x1BFC08 align=1 + (i32.store16 offset=0x1BFC08 align=2 (i32.const 0x0) (i32.const 0x0)) ;; initialize counter @@ -85,13 +85,13 @@ ;; we now leave sum on the stack for later ;; light led2 - (i32.store16 offset=0x1BFC06 align=1 + (i32.store16 offset=0x1BFC06 align=2 (i32.const 0x0) (i32.const 0x1)) ;; print timer value (set_local $adr (call $print ;; read timer value - (i32.load16_u offset=0x1BFC08 align=1 + (i32.load16_u offset=0x1BFC08 align=2 (i32.const 0x0)) (i32.const 0xFFC00))) diff --git a/examples/example2b_measure_time_wasm/instructions.wat b/examples/example2b_measure_time_wasm/instructions.wat index 6107b30..7c9bdbb 100644 --- a/examples/example2b_measure_time_wasm/instructions.wat +++ b/examples/example2b_measure_time_wasm/instructions.wat @@ -68,7 +68,7 @@ (local $adr i32) ;; reset the timer (although it should already be resetted, anyway...) - (i32.store16 offset=0x1BFC08 align=1 + (i32.store16 offset=0x1BFC08 align=2 (i32.const 0x0) (i32.const 0x0)) ;; initialize counter @@ -87,13 +87,13 @@ ;; we now leave sum on the stack for later ;; light led2 - (i32.store16 offset=0x1BFC06 align=1 + (i32.store16 offset=0x1BFC06 align=2 (i32.const 0x0) (i32.const 0x1)) ;; print timer value (set_local $adr (call $print ;; read timer value - (i32.load16_u offset=0x1BFC08 align=1 + (i32.load16_u offset=0x1BFC08 align=2 (i32.const 0x0)) (i32.const 0xFFC00))) diff --git a/tests/wasm_compile_arithm/instructions.wat b/tests/wasm_compile_arithm/instructions.wat index a43a348..e20e6c0 100644 --- a/tests/wasm_compile_arithm/instructions.wat +++ b/tests/wasm_compile_arithm/instructions.wat @@ -2,15 +2,15 @@ (memory 0 2) (func $main ;; write 0xFFEFE021 at MEMORY_BOTTOM_ADDR + 0x0 - (i32.store offset=0x0 align=2 (i32.const 0x0) + (i32.store offset=0x0 align=4 (i32.const 0x0) (i32.sub (i32.const 0x42143) (i32.const 0x144122))) ;; write 0x16D3B7 at MEMORY_BOTTOM_ADDR + 0x4 - (i32.store offset=0x0 align=2 (i32.const 0x4) + (i32.store offset=0x0 align=4 (i32.const 0x4) (i32.add (i32.const 0x7109D) (i32.const 0xFC31A))) ;; write 0xED8 at MEMORY_BOTTOM_ADDR + 0x8 - (i32.store offset=0x0 align=2 (i32.const 0x8) + (i32.store offset=0x0 align=4 (i32.const 0x8) (i32.div_u (i32.const 0x193E324F) (i32.const 0x1B342))) ;; write 0x3C773E7C at MEMORY_BOTTOM_ADDR + 0xC - (i32.store offset=0x0 align=2 (i32.const 0xC) + (i32.store offset=0x0 align=4 (i32.const 0xC) (i32.mul (i32.const 0x38F2C) (i32.const 0x10FD)))) (export "main" (func $main))) diff --git a/tests/wasm_compile_block/instructions.wat b/tests/wasm_compile_block/instructions.wat index 11b179d..3d682db 100644 --- a/tests/wasm_compile_block/instructions.wat +++ b/tests/wasm_compile_block/instructions.wat @@ -109,13 +109,13 @@ i32.add end) (func $main - (i32.store offset=0x0 align=2 (i32.const 0x0) + (i32.store offset=0x0 align=4 (i32.const 0x0) (call $blockfun (i32.const 4) (i32.const 2))) - (i32.store offset=0x0 align=2 (i32.const 0x4) + (i32.store offset=0x0 align=4 (i32.const 0x4) (call $blockfun (i32.const 3) (i32.const 2))) - (i32.store offset=0x0 align=2 (i32.const 0x8) + (i32.store offset=0x0 align=4 (i32.const 0x8) (call $blockfun (i32.const 2) (i32.const 0))) - (i32.store offset=0x0 align=2 (i32.const 0xC) + (i32.store offset=0x0 align=4 (i32.const 0xC) (call $blockfun (i32.const 4) (i32.const 4))) ) (export "main" (func $main))) diff --git a/tests/wasm_compile_br/instructions.wat b/tests/wasm_compile_br/instructions.wat index cc7b370..35c8413 100644 --- a/tests/wasm_compile_br/instructions.wat +++ b/tests/wasm_compile_br/instructions.wat @@ -15,9 +15,9 @@ (i32.const -1)))) (func $main ;; write 0x00000000 at MEMORY_BOTTOM_ADDR - (i32.store offset=0x0 align=2 (i32.const 0x0) + (i32.store offset=0x0 align=4 (i32.const 0x0) (call $eq10 (i32.const 12))) ;; write 0xFFFFFFFF at MEMORY_BOTTOM_ADDR + 0x4 - (i32.store offset=0x0 align=2 (i32.const 0x4) + (i32.store offset=0x0 align=4 (i32.const 0x4) (call $eq10 (i32.const 10)))) (export "main" (func $main))) diff --git a/tests/wasm_compile_br_if/instructions.wat b/tests/wasm_compile_br_if/instructions.wat index 506a462..cac1fa0 100644 --- a/tests/wasm_compile_br_if/instructions.wat +++ b/tests/wasm_compile_br_if/instructions.wat @@ -16,12 +16,12 @@ (i32.const -1)))) (func $main ;; write 0x00000000 at MEMORY_BOTTOM_ADDR - (i32.store offset=0x0 align=2 (i32.const 0x0) + (i32.store offset=0x0 align=4 (i32.const 0x0) (call $eq10or11 (i32.const 12))) ;; write 0xFFFFFFFF at MEMORY_BOTTOM_ADDR + 0x4 - (i32.store offset=0x0 align=2 (i32.const 0x4) + (i32.store offset=0x0 align=4 (i32.const 0x4) (call $eq10or11 (i32.const 10))) ;; write 0xFFFFFFFF at MEMORY_BOTTOM_ADDR + 0x8 - (i32.store offset=0x0 align=2 (i32.const 0x8) + (i32.store offset=0x0 align=4 (i32.const 0x8) (call $eq10or11 (i32.const 11)))) (export "main" (func $main))) diff --git a/tests/wasm_compile_function_call/instructions.wat b/tests/wasm_compile_function_call/instructions.wat index ad37037..2184573 100644 --- a/tests/wasm_compile_function_call/instructions.wat +++ b/tests/wasm_compile_function_call/instructions.wat @@ -5,7 +5,7 @@ i32.const 0x32 ;; value to substract from i32.const 0x14 ;; value to substract call $sub - i32.store offset=0x25 align=2) ;; we store the difference at 0x23C + i32.store offset=0x25 align=4) ;; we store the difference at 0x23C (func $sub (param $lhs i32) (param $rhs i32) (result i32) local.get $lhs local.get $rhs diff --git a/tests/wasm_compile_if_else/instructions.wat b/tests/wasm_compile_if_else/instructions.wat index 14faa6f..f1f44cd 100644 --- a/tests/wasm_compile_if_else/instructions.wat +++ b/tests/wasm_compile_if_else/instructions.wat @@ -11,9 +11,9 @@ (i32.const -1)))) (func $main ;; write 0x00000000 at MEMORY_BOTTOM_ADDR - (i32.store offset=0x0 align=2 (i32.const 0x0) + (i32.store offset=0x0 align=4 (i32.const 0x0) (call $eq10 (i32.const 12))) ;; write 0xFFFFFFFF at MEMORY_BOTTOM_ADDR + 0x4 - (i32.store offset=0x0 align=2 (i32.const 0x4) + (i32.store offset=0x0 align=4 (i32.const 0x4) (call $eq10 (i32.const 10)))) (export "main" (func $main))) diff --git a/tests/wasm_compile_loop/instructions.wat b/tests/wasm_compile_loop/instructions.wat index 02a75e0..03b1d26 100644 --- a/tests/wasm_compile_loop/instructions.wat +++ b/tests/wasm_compile_loop/instructions.wat @@ -21,5 +21,5 @@ (i32.const 10)))) ;; write computed sum (55 in dec, 37 in hex) at MEMORY_BOTTOM_ADDR - (i32.store offset=0x0 align=2)) + (i32.store offset=0x0 align=4)) (export "main" (func $main))) diff --git a/tests/wasm_compile_simple_module/instructions.wat b/tests/wasm_compile_simple_module/instructions.wat index bdf8a16..e677c93 100644 --- a/tests/wasm_compile_simple_module/instructions.wat +++ b/tests/wasm_compile_simple_module/instructions.wat @@ -3,5 +3,5 @@ (func $main i32.const 0x1D ;; dynamic offset for memory store instruction i32.const 0x1E ;; value to store - i32.store offset=0x1F align=2) ;; we store the difference at 0x23C + i32.store offset=0x1F align=4) ;; we store the difference at 0x23C (export "main" (func $main))) -- cgit v1.2.3