From: Dan Gohman Date: Mon, 25 Jan 2016 15:19:39 +0000 (+0000) Subject: [WebAssembly] Add tests for negative offsets with global variable addresses. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=619db96d5e0c5607ca6e1a3f0454bdaa032ec0d5;p=platform%2Fupstream%2Fllvm.git [WebAssembly] Add tests for negative offsets with global variable addresses. llvm-svn: 258693 --- diff --git a/llvm/test/CodeGen/WebAssembly/offset-folding.ll b/llvm/test/CodeGen/WebAssembly/offset-folding.ll index 59c0557..863549f 100644 --- a/llvm/test/CodeGen/WebAssembly/offset-folding.ll +++ b/llvm/test/CodeGen/WebAssembly/offset-folding.ll @@ -43,3 +43,21 @@ define i32* @test2() { define i32* @test3() { ret i32* getelementptr ([50 x i32], [50 x i32]* @y, i32 0, i32 0) } + +; Test negative offsets. + +; CHECK-LABEL: test4: +; CHECK-NEXT: .result i32{{$}} +; CHECK-NEXT: i32.const $push0=, x-188{{$}} +; CHECK=NEXT: return $pop0{{$}} +define i32* @test4() { + ret i32* getelementptr ([0 x i32], [0 x i32]* @x, i32 0, i32 -47) +} + +; CHECK-LABEL: test5: +; CHECK-NEXT: .result i32{{$}} +; CHECK-NEXT: i32.const $push0=, y-188{{$}} +; CHECK=NEXT: return $pop0{{$}} +define i32* @test5() { + ret i32* getelementptr ([50 x i32], [50 x i32]* @y, i32 0, i32 -47) +}