14684f824SDan Gohman; RUN: llc < %s -asm-verbose=false -wasm-keep-registers | FileCheck %s
23a762bf9SDan Gohman
33a762bf9SDan Gohman; Test that function pointer casts casting away varargs are replaced with
43a762bf9SDan Gohman; wrappers.
53a762bf9SDan Gohman
6a5908009SSam Cleggtarget triple = "wasm32-unknown-unknown"
73a762bf9SDan Gohman
83a762bf9SDan Gohmandefine void @callWithArgs() {
93a762bf9SDan Gohmanentry:
103a762bf9SDan Gohman  call void bitcast (void (...)* @underspecified to void (i32, i32)*)(i32 0, i32 1)
113a762bf9SDan Gohman  call void(...) bitcast (void (i32, i32)* @specified to void (...)*)(i32 0, i32 1)
123a762bf9SDan Gohman  ret void
133a762bf9SDan Gohman}
143a762bf9SDan Gohman
153a762bf9SDan Gohmandeclare void @underspecified(...)
163a762bf9SDan Gohmandeclare void @specified(i32, i32)
173a762bf9SDan Gohman
183a762bf9SDan Gohman; CHECK: callWithArgs:
193a762bf9SDan Gohman; CHECK: i32.const	$push1=, 0
203a762bf9SDan Gohman; CHECK-NEXT: i32.const	$push0=, 1
21*275d15ecSSam Clegg; CHECK-NEXT: call    	.Lunderspecified_bitcast, $pop1, $pop0
22*275d15ecSSam Clegg; CHECK: call    	.Lspecified_bitcast, $pop{{[0-9]+$}}
233a762bf9SDan Gohman
2441d7047dSSam Clegg; CHECK: .Lunderspecified_bitcast:
2549482f82SWouter van Oortmerssen; CHECK-NEXT: .functype .Lunderspecified_bitcast (i32, i32) -> (){{$}}
26*275d15ecSSam Clegg; CHECK: call    	underspecified, $pop{{[0-9]+$}}
273a762bf9SDan Gohman
2841d7047dSSam Clegg; CHECK: .Lspecified_bitcast:
2949482f82SWouter van Oortmerssen; CHECK-NEXT: .functype .Lspecified_bitcast (i32) -> (){{$}}
30*275d15ecSSam Clegg; CHECK: call    	specified, $pop{{[0-9]+}}, $pop{{[0-9]+$}}
31