xref: /llvm-project/llvm/test/CodeGen/Mips/Fast-ISel/stackloadstore.ll (revision ae26f50aea4ef1a6c7058019f0db11a91bbcdade)
1; RUN: llc < %s -mtriple=mipsel -mcpu=mips32 -fast-isel -frame-pointer=all -relocation-model=pic < %s
2
3; Test that negative array access don't crash constant synthesis when fast isel
4; generates negative offsets.
5
6define i16 @test() {
7  %a = alloca [4 x i16], align 4
8  %arrayidx = getelementptr inbounds [4 x i16], ptr %a, i32 0, i32 -2
9  %b = load i16, ptr %arrayidx, align 2
10  ret i16 %b
11}
12
13define void @test2() {
14  %a = alloca [4 x i16], align 4
15  %arrayidx = getelementptr inbounds [4 x i16], ptr %a, i32 0, i32 -2
16  store i16 2, ptr %arrayidx, align 2
17  ret void
18}
19