-
Notifications
You must be signed in to change notification settings - Fork 13.3k
right shift of i128i by zero fails on s390x (SystemZ) #52015
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
Comments
A few questions and annotations.
|
The LLVM's LangRef documents
That is, the first argument of ashr is the value to be shifted, and the second value is the number of bits to shift. So it appears that the argument order is correct. The LLVM IR Builder for ashr also appears ok (here).
This was produced from minimizing code that uses I've just tried to use |
Does this only affect 1xi128 vectors or does it reproduce with a scalar i128 too? |
I've added the equivalent test using This test passes (it does not panic): #[test]
pub fn scalar_test() {
let z = 0_i128;
let o = 1_i128;
if o >> z != o {
panic!();
}
} |
This test also fails for sparc64-unknown-linux-gnu |
Now that godbolt supports cross-compilation for rust, it is much easier to try to debug this (https://godbolt.org/g/No8zpS): example::scalar_test:
stmg %r14, %r15, 112(%r15)
aghi %r15, -160
j .LBB47_1
.LBB47_1:
lhi %r0, 1
chi %r0, 0
jlh .LBB47_3
j .LBB47_2
.LBB47_2:
larl %r2, .Lbyte_str.6
larl %r4, .Lbyte_str.5
lghi %r3, 14
brasl %r14, std::panicking::begin_panic@PLT
.Ltmp29:
j .Ltmp29+2
.LBB47_3:
lmg %r14, %r15, 272(%r15)
br %r14
.Lbyte_str.4:
.ascii "/tmp/compiler-explorer-compiler118710-63-1i2e6ad.i6ghg/example.rs"
.Lbyte_str.5:
.quad .Lbyte_str.4
.ascii "\000\000\000\000\000\000\000A\000\000\000\007\000\000\000\t"
.Lbyte_str.6:
.ascii "explicit panic" from define void @_ZN7example11scalar_test17h9448becacb3cda6dE() unnamed_addr #0 {
br label %bb1
bb1: ; preds = %start
br i1 false, label %bb2, label %bb3
bb2: ; preds = %bb1
call void @_ZN3std9panicking11begin_panic17h0260f1c8a33dd8a1E([0 x i8]* noalias nonnull readonly bitcast (<{ [14 x i8] }>* @byte_str.6 to [0 x i8]*), i64 14, { [0 x i64], { [0 x i8]*, i64 }, [0 x i32], i32, [0 x i32], i32, [0 x i32] }* noalias readonly dereferenceable(24) bitcast (<{ i8*, [16 x i8] }>* @byte_str.5 to { [0 x i64], { [0 x i8]*, i64 }, [0 x i32], i32, [0 x i32], i32, [0 x i32] }*))
unreachable
bb3: ; preds = %bb1
ret void
} so everything looks correct now, I am restarting the build but travis is having issues. If the build still fails I don't know what's the problem here. |
What happened on Travis? |
I've restarted the build: https://travis-ci.org/gnzlbg/repro_s390x/builds/399684908 It still fails. |
I cannot reproduce it on a s390x machine anymore so I think it is fixed [linux1@rusting repro_s390x]$ cargo +nightly test
Compiling repro_s390x v0.1.0 (/home/linux1/dev/rustbug/repro_s390x)
Finished test [unoptimized + debuginfo] target(s) in 2.09s
Running unittests (target/debug/deps/repro_s390x-8197d3a364efe000)
running 2 tests
test scalar_test ... ok
test vector_test ... ok Tested on a vm provided by Marist College through the community cloud https://linuxone.cloud.marist.edu/ |
I've set up a repository that reproduces this issue on travis (using qemu): https://github.com/gnzlbg/repro_s390x
The following code right shifts a
<1 x i128>
containing1
by0
. The result of the shift should be1
, but on debug builds it is0
, causing the following code to panic (on release the code does not panic):The
test
function generates the following LLVM-IRwhich is lowered to
cc @rkruppe
Who maintains Rust's SystemZ support?
The text was updated successfully, but these errors were encountered: