forked from bytecodealliance/wasm-micro-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix compilation of shift opcodes on x86_64 and i386 architectures (by…
…tecodealliance#2619) This change fixes the case where the right parameter of shift operator is negative, specifically, when both parameters of shift opcode are constants.
- Loading branch information
Showing
7 changed files
with
159 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.aot | ||
*.wasm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# WAMR test benchmarks | ||
|
||
This folder contains tests for WAMR AOT compiler and its generated code. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
;; Copyright (C) 2023 Amazon Inc. All rights reserved. | ||
;; SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
;; | ||
;; Those tests verify if passing constant negative value | ||
;; as a right parameter of the shift operator (along | ||
;; with a constant value of the left operator) causes | ||
;; any problems. See: https://github.com/bytecodealliance/wasm-micro-runtime/pull/2619 | ||
(module | ||
(memory (export "memory") 1 1) | ||
(func $assert_eq (param i32 i32) | ||
(i32.ne (local.get 0) (local.get 1)) | ||
if | ||
unreachable | ||
end | ||
) | ||
|
||
(func $i32_shr_u | ||
(call $assert_eq | ||
(i32.shr_u (i32.const -1) (i32.const -5)) | ||
(i32.const 31) | ||
) | ||
) | ||
|
||
(func $i32_shr_s | ||
(call $assert_eq | ||
(i32.shr_u (i32.const 32) (i32.const -30)) | ||
(i32.const 8) | ||
) | ||
) | ||
|
||
(func $i32_shl | ||
(call $assert_eq | ||
(i32.shl (i32.const -1) (i32.const -30)) | ||
(i32.const -4) | ||
) | ||
) | ||
|
||
(func (export "_start") | ||
call $i32_shr_u | ||
call $i32_shr_s | ||
call $i32_shl | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
tests/wamr-test-suites/wamr-compiler-test-script/run_wamr_compiler_tests.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (C) 2023 Amazon Inc. All rights reserved. | ||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
|
||
set -e | ||
|
||
WAT2WASM_CMD=$1 | ||
WAMRC_CMD=$2 | ||
IWASM_CMD=$3 | ||
|
||
for wat_file in ../../wamr-compiler/*.wat; do | ||
wasm_file="${wat_file%.wat}.wasm" | ||
aot_file="${wat_file%.wat}.aot" | ||
|
||
echo "Compiling $wat_file to $wasm_file" | ||
$WAT2WASM_CMD "$wat_file" -o "$wasm_file" | ||
echo "Compiling $wasm_file to $aot_file" | ||
$WAMRC_CMD -o $aot_file $wasm_file | ||
echo "Testing $aot_file" | ||
$IWASM_CMD "$aot_file" | ||
done |