Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cranelift: x64 backend crashes compiling a standalone iadd_pairwise #3273

Closed
afonso360 opened this issue Sep 1, 2021 · 2 comments
Closed
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator

Comments

@afonso360
Copy link
Contributor

Hey, In #3272 @dheaton-arm implemented tests for a standalone iadd_pairwise instruction without a swiden_low/swiden_high/uwiden_low/uwiden_high instruction as an input. It looks like this case is not implemented in the x64 backend, instead we always perform an optimization and merge those previous instructions.

.clif Test Case

test run
target x86_64 machinst

function %iaddp_i8x16(i8x16, i8x16) -> i8x16 {
block0(v0: i8x16, v1: i8x16):
    v2 = iadd_pairwise v0, v1
    return v2
}
; run: %iaddp_i8x16([1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16], [17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32]) == [3 7 11 15 19 23 27 31 35 39 43 47 51 55 59 63]

function %iaddp_i16x8(i16x8, i16x8) -> i16x8 {
block0(v0: i16x8, v1: i16x8):
    v2 = iadd_pairwise v0, v1
    return v2
}
; run: %iaddp_i16x8([1 2 3 4 5 6 7 8], [100 99 98 97 96 95 94 93]) == [3 7 11 15 199 195 191 187]

function %iaddp_i32x4(i32x4, i32x4) -> i32x4 {
block0(v0: i32x4, v1: i32x4):
    v2 = iadd_pairwise v0, v1
    return v2
}
; run: %iaddp_i32x4([1 2 3 4], [5 6 7 8]) == [3 7 11 15]
; run: %iaddp_i32x4([4294967290 5 4294967290 5], [100 100 100 100]) == [4294967295 4294967295 200 200]

Steps to Reproduce

Run clif-util the-above.clif

Expected Results

Tests to pass

Actual Results

Cranelift crashes with:

thread 'worker #0' panicked at 'not implemented: Operands not supported for IaddPairwise', cranelift\codegen\src\isa\x64\lower.rs:5095:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
FAIL .\filetests\filetests\runtests\test.clif: panicked in worker #0: not implemented: Operands not supported for IaddPairwise

Versions and Environment

Cranelift version or commit: main
Operating system: Windows
Architecture: x64

Extra Info

The test file above should be in-tree at cranelift/filetests/filetests/runtests/simd-iaddpairwise.clif, once #3272 is merged.

@afonso360 afonso360 added bug Incorrect behavior in the current implementation that needs fixing cranelift Issues related to the Cranelift code generator labels Sep 1, 2021
@cfallin
Copy link
Member

cfallin commented Sep 1, 2021

cc @jlb6740 -- we discussed at the time (in #3209) that it was fine to merge without this more general case in order to make forward progress, but that we should eventually fill out the general case. Thanks for creating the issue to track this!

@abrown abrown added the cranelift:area:x64 Issues related to x64 codegen label Sep 3, 2021
@alexcrichton
Copy link
Member

This was implemented in #6561 for the x64 backend, with tests enabled there, so I'm going to close this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing cranelift:area:x64 Issues related to x64 codegen cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

No branches or pull requests

4 participants