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