1; RUN: llc < %s -asm-verbose=false | FileCheck %s
2
3target triple = "wasm32-unknown-emscripten"
4
5; This tests the implementation of __builtin_return_address on emscripten
6
7; CHECK-LABEL: test_returnaddress:
8; CHECK-NEXT: .functype test_returnaddress () -> (i32){{$}}
9; CHECK-NEXT: {{^}} i32.const 0{{$}}
10; CHECK-NEXT: {{^}} call emscripten_return_address{{$}}
11; CHECK-NEXT: {{^}} end_function{{$}}
12define i8* @test_returnaddress() {
13  %r = call i8* @llvm.returnaddress(i32 0)
14  ret i8* %r
15}
16
17; LLVM represents __builtin_return_address as call to this function in IR.
18declare i8* @llvm.returnaddress(i32 immarg)
19