Enable more CLIF tests on AArch64

The tests for the SIMD floating-point maximum and minimum operations
require particular care because the handling of the NaN values is
non-deterministic and may vary between platforms. There is no way to
match several NaN values in a test, so the solution is to extract the
non-deterministic test cases into a separate file that is subsequently
replicated for every backend under test, with adjustments made to the
expected results.

Copyright (c) 2021, Arm Limited.
This commit is contained in:
Anton Kirilov
2021-07-06 13:22:11 +01:00
parent fb32e49ed7
commit a1b39276e1
78 changed files with 258 additions and 77 deletions

View File

@@ -1,4 +1,5 @@
test legalizer
target aarch64
target x86_64
function %foo(i64, i64) -> i64 {

View File

@@ -1,4 +1,5 @@
test legalizer
target aarch64
target i686
function %foo() -> i64 {

View File

@@ -1,4 +1,5 @@
test legalizer
target aarch64
target x86_64
function u0:0(i128, i128, i64) -> i128 system_v {

View File

@@ -1,5 +1,6 @@
test compile
set opt_level=speed_and_size
target aarch64
target x86_64
function %br_table_opt() {
@@ -9,7 +10,7 @@ function %br_table_opt() {
v0 = iconst.i32 1
br_table v0, block2, jt0
block1:
block1:
return
block2:

View File

@@ -1,4 +1,5 @@
test licm
target aarch64
target x86_64
function %dont_hoist_jump_table_entry_during_licm() {

View File

@@ -1,5 +1,6 @@
test licm
target aarch64
target x86_64
;; Nontrapping readonly load from address that is not loop-dependent

View File

@@ -1,5 +1,6 @@
test licm
target aarch64
target x86_64
;; Nontrapping possibly-not-readonly load from address that is not

View File

@@ -1,5 +1,6 @@
test licm
target aarch64
target x86_64
;; Maybe-trapping readonly load from address that is not

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
function %icmp_to_brz_fold(i32) -> i32 {

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64 baseline
; Cases where the denominator is created by an iconst

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
;; This file used to trigger assertions where we would keep trying to

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
;; Test that although v5 can be replaced with v1, we don't transplant `load.i32

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
function %wraparound(i64 vmctx) -> f32 system_v {

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
function u0:2(i64 , i64) {

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target i686
;; 32-bits platforms.

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
;; 64-bits platforms.

View File

@@ -1,4 +1,5 @@
test peepmatic
target aarch64
target x86_64
;; The `isub` is a no-op, but we can't replace the whole `isub` instruction with

View File

@@ -1,4 +1,5 @@
test postopt
target aarch64
target i686 legacy
; Test that compare+branch sequences are folded effectively on x86.

View File

@@ -1,4 +1,5 @@
test preopt
target aarch64
target x86_64
function %brz_fold() -> i32 {

View File

@@ -1,4 +1,5 @@
test preopt
target aarch64
target x86_64
function %constant_fold(f64) -> f64 {

View File

@@ -1,4 +1,5 @@
test preopt
target aarch64
target x86_64
function %iadd_fold() -> i32 {
@@ -33,4 +34,4 @@ block0:
; nextln: v1 = iconst.i32 1
; nextln: v2 = iconst.i32 41
; nextln: return v2
; nextln: }
; nextln: }

View File

@@ -1,4 +1,5 @@
test compile
target aarch64
target x86_64 legacy
; This checks that code shrink is allowed while relaxing code, when code shrink

View File

@@ -1,4 +1,5 @@
test run
target aarch64
target x86_64 machinst
function %bint_b8_i128() -> i64, i64 {

View File

@@ -1,4 +1,5 @@
test run
target aarch64
target x86_64 machinst
target x86_64 legacy

View File

@@ -0,0 +1,23 @@
; Test the non-deterministic aspects of the SIMD arithmetic operations.
; If you change this file, you should most likely update
; simd-arithmetic-nondeterministic*.clif as well.
test run
target aarch64
function %fmax_f64x2(f64x2, f64x2) -> f64x2 {
block0(v0: f64x2, v1: f64x2):
v2 = fmax v0, v1
return v2
}
; run: %fmax_f64x2([NaN:0x42 0.0], [0x1.0 0.0]) == [NaN:0x42 0.0]
function %fmin_f64x2(f64x2, f64x2) -> f64x2 {
block0(v0: f64x2, v1: f64x2):
v2 = fmin v0, v1
return v2
}
; run: %fmin_f64x2([-NaN 0x100.0], [0.0 NaN]) == [-NaN NaN]
; run: %fmin_f64x2([NaN 0.0], [0.0 0.0]) == [NaN 0.0]
; run: %fmin_f64x2([NaN:0x42 0.0], [0x1.0 0.0]) == [NaN:0x42 0.0]

View File

@@ -0,0 +1,28 @@
; Test the non-deterministic aspects of the SIMD arithmetic operations.
; If you change this file, you should most likely update
; simd-arithmetic-nondeterministic*.clif as well.
test run
set enable_simd
target x86_64 machinst skylake
function %fmax_f64x2(f64x2, f64x2) -> f64x2 {
block0(v0: f64x2, v1: f64x2):
v2 = fmax v0, v1
return v2
}
; note below how NaNs are quieted but (unlike fmin), retain their sign: this discrepancy is allowed by non-determinism
; in the spec, see https://webassembly.github.io/spec/core/bikeshed/index.html#nan-propagation%E2%91%A0.
; run: %fmax_f64x2([NaN:0x42 0.0], [0x1.0 0.0]) == [NaN 0.0]
function %fmin_f64x2(f64x2, f64x2) -> f64x2 {
block0(v0: f64x2, v1: f64x2):
v2 = fmin v0, v1
return v2
}
; note below how NaNs are quieted and negative: this is due to non-determinism in the spec for NaNs, see
; https://webassembly.github.io/spec/core/bikeshed/index.html#nan-propagation%E2%91%A0.
; run: %fmin_f64x2([-NaN 0x100.0], [0.0 NaN]) == [-NaN -NaN]
; run: %fmin_f64x2([NaN 0.0], [0.0 0.0]) == [-NaN 0.0]
; run: %fmin_f64x2([NaN:0x42 0.0], [0x1.0 0.0]) == [-NaN 0.0]

View File

@@ -1,5 +1,5 @@
test run
; target aarch64 TODO: Not yet implemented on aarch64
target aarch64
; target s390x TODO: Not yet implemented on s390x
set enable_simd
target x86_64 machinst skylake
@@ -125,7 +125,7 @@ block0:
; run
function %sqrt_f64x2(f64x2) -> f64x2 {
block0(v0: f64x2):
block0(v0: f64x2):
v1 = sqrt v0
return v1
}
@@ -136,26 +136,22 @@ block0(v0: f64x2, v1: f64x2):
v2 = fmax v0, v1
return v2
}
; note below how NaNs are quieted but (unlike fmin), retain their sign: this discrepancy is allowed by non-determinism
; in the spec, see https://webassembly.github.io/spec/core/bikeshed/index.html#nan-propagation%E2%91%A0.
; This operation exhibits non-deterministic behaviour for some input NaN values;
; refer to the simd-arithmetic-nondeterministic*.clif files for the respective tests.
; run: %fmax_f64x2([-0x0.0 -0x1.0], [+0x0.0 0x1.0]) == [+0x0.0 0x1.0]
; run: %fmax_f64x2([-NaN NaN], [0x0.0 0x100.0]) == [-NaN NaN]
; run: %fmax_f64x2([NaN 0.0], [0.0 0.0]) == [NaN 0.0]
; run: %fmax_f64x2([-NaN 0.0], [0x1.0 0.0]) == [-NaN 0.0]
; run: %fmax_f64x2([NaN:0x42 0.0], [0x1.0 0.0]) == [NaN 0.0]
function %fmin_f64x2(f64x2, f64x2) -> f64x2 {
block0(v0: f64x2, v1: f64x2):
v2 = fmin v0, v1
return v2
}
; note below how NaNs are quieted and negative: this is due to non-determinism in the spec for NaNs, see
; https://webassembly.github.io/spec/core/bikeshed/index.html#nan-propagation%E2%91%A0.
; This operation exhibits non-deterministic behaviour for some input NaN values;
; refer to the simd-arithmetic-nondeterministic*.clif files for the respective tests.
; run: %fmin_f64x2([-0x0.0 -0x1.0], [+0x0.0 0x1.0]) == [-0x0.0 -0x1.0]
; run: %fmin_f64x2([-NaN 0x100.0], [0.0 NaN]) == [-NaN -NaN]
; run: %fmin_f64x2([NaN 0.0], [0.0 0.0]) == [-NaN 0.0]
; run: %fmin_f64x2([-NaN 0.0], [0x1.0 0.0]) == [-NaN 0.0]
; run: %fmin_f64x2([NaN:0x42 0.0], [0x1.0 0.0]) == [-NaN 0.0]
function %fneg_f64x2(f64x2) -> f64x2 {
block0(v0: f64x2):

View File

@@ -1,5 +1,6 @@
test run
set enable_simd
target aarch64
target x86_64 legacy skylake
; TODO: once available, replace all lane extraction with `icmp + all_ones`

View File

@@ -1,5 +1,5 @@
test run
; target aarch64 TODO: Not yet implemented on aarch64
target aarch64
; target s390x TODO: Not yet implemented on s390x
set enable_simd
target x86_64 machinst

View File

@@ -1,5 +1,5 @@
test run
; target aarch64 TODO: Not yet implemented on aarch64
target aarch64
; target s390x TODO: Not yet implemented on s390x
set enable_simd
target x86_64 machinst

View File

@@ -1,6 +1,6 @@
test run
; target s390x TODO: Not yet implemented on s390x
; target aarch64 TODO: Not yet implemented on aarch64
target aarch64
set enable_simd
target x86_64 machinst
set enable_simd

View File

@@ -1,5 +1,6 @@
test simple-gvn
target aarch64
target x86_64
function %eliminate_redundant_global_loads(i32, i64 vmctx) {

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
;; Test replacement of bitselect with vselect for special masks

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
function %icmp_to_brz_fold(i32) -> i32 {

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64 baseline
; Cases where the denominator is created by an iconst

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
;; Test that although v5 can be replaced with v1, we don't transplant `load.i32

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
function %wraparound(i64 vmctx) -> f32 system_v {

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target i686 baseline
; -------- U32 --------

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
function u0:2(i64 , i64) {

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
;; Tests for sign-extending immediates.

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target i686
;; 32-bits platforms.

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
;; 64-bits platforms.

View File

@@ -1,4 +1,5 @@
test simple_preopt
target aarch64
target x86_64
;; The `isub` is a no-op, but we can't replace the whole `isub` instruction with

View File

@@ -1,4 +1,5 @@
test verifier
target aarch64
target i686
; Simple, correct use of CPU flags.

View File

@@ -1,5 +1,6 @@
test verifier
set enable_simd=true
target aarch64
target x86_64
function %scalar_to_vector() {

View File

@@ -1,5 +1,6 @@
test verifier
set enable_simd
target aarch64
target x86_64
function %insertlane_i32x4() {

View File

@@ -1,8 +1,8 @@
; Test basic code generation for control flow WebAssembly instructions.
test compile
target aarch64
target i686 haswell
target x86_64 haswell
function %br_if(i32) -> i32 {

View File

@@ -1,6 +1,7 @@
; Test code generation for WebAssembly type conversion operators.
test compile
target aarch64
target x86_64 haswell
function %i32_wrap_i64(i64) -> i32 {

View File

@@ -1,6 +1,7 @@
; Test basic code generation for f32 arithmetic WebAssembly instructions.
test compile
target aarch64
target i686 haswell
target i686 baseline
target x86_64 haswell

View File

@@ -1,8 +1,8 @@
; Test code generation for WebAssembly f32 comparison operators.
test compile
target aarch64
target i686 haswell
target x86_64 haswell
function %f32_eq(f32, f32) -> i32 {

View File

@@ -3,6 +3,7 @@ test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target aarch64
target x86_64 haswell
function %f32_load(i32, i64 vmctx) -> f32 {

View File

@@ -1,6 +1,7 @@
; Test basic code generation for f64 arithmetic WebAssembly instructions.
test compile
target aarch64
target x86_64 haswell
target x86_64 baseline

View File

@@ -1,8 +1,8 @@
; Test code generation for WebAssembly f64 comparison operators.
test compile
target aarch64
target i686 haswell
target x86_64 haswell
function %f64_eq(f64, f64) -> i32 {

View File

@@ -3,6 +3,7 @@ test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target aarch64
target x86_64 haswell
function %f64_load(i32, i64 vmctx) -> f64 {

View File

@@ -1,6 +1,7 @@
; Test basic code generation for i32 arithmetic WebAssembly instructions.
test compile
target aarch64
target i686 haswell
target i686 baseline
target x86_64 haswell

View File

@@ -1,8 +1,8 @@
; Test code generation for WebAssembly i32 comparison operators.
test compile
target aarch64
target i686 haswell
target x86_64 haswell
function %i32_eqz(i32) -> i32 {

View File

@@ -3,6 +3,7 @@ test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target aarch64
target x86_64 haswell
function %i32_load(i32, i64 vmctx) -> i32 {

View File

@@ -1,6 +1,7 @@
; Test basic code generation for i64 arithmetic WebAssembly instructions.
test compile
target aarch64
target x86_64 haswell
target x86_64 baseline

View File

@@ -1,6 +1,7 @@
; Test code generation for WebAssembly i64 comparison operators.
test compile
target aarch64
target x86_64 haswell
function %i64_eqz(i64) -> i32 {

View File

@@ -3,6 +3,7 @@ test compile
; We only test on 64-bit since the heap_addr instructions and vmctx parameters
; explicitly mention the pointer width.
target aarch64
target x86_64 haswell
function %i64_load(i32, i64 vmctx) -> i64 {

View File

@@ -1,4 +1,5 @@
test compile
target aarch64
target x86_64 haswell
;; Returning many mixed values.

View File

@@ -1,4 +1,5 @@
test compile
target aarch64
target x86_64 haswell
function %returner(i32, i64, f32, f64) -> i32, i64, f32, f64 {

View File

@@ -4,6 +4,7 @@
test compile
set enable_safepoints=true
target aarch64
target i686 haswell
function %select_ref(i32, r32, r32) -> r32 {

View File

@@ -4,6 +4,7 @@
test compile
set enable_safepoints=true
target aarch64
target x86_64 haswell
function %select_ref(i32, r64, r64) -> r64 {

View File

@@ -1,8 +1,8 @@
; Test basic code generation for the select WebAssembly instruction.
test compile
target aarch64
target i686 haswell
target x86_64 haswell
function %select_i32(i32, i32, i32) -> i32 {

View File

@@ -26,6 +26,10 @@ impl SubTest for TestLICM {
"licm"
}
fn needs_isa(&self) -> bool {
true
}
fn is_mutating(&self) -> bool {
true
}

View File

@@ -23,6 +23,10 @@ impl SubTest for TestPostopt {
"postopt"
}
fn needs_isa(&self) -> bool {
true
}
fn is_mutating(&self) -> bool {
true
}

View File

@@ -23,6 +23,10 @@ impl SubTest for TestSimplePreopt {
"simple_preopt"
}
fn needs_isa(&self) -> bool {
true
}
fn is_mutating(&self) -> bool {
true
}