blob: 57f2a6dd2108fc8801b1d78c4845a2c6954b1c7e [file] [log] [blame]
Wouter van Oortmerssena7be3752018-08-13 23:12:49 +00001; RUN: llc < %s -asm-verbose=false -wasm-temporary-workarounds=false | FileCheck %s
Dan Gohman3a762bf2017-12-08 21:27:00 +00002
3; Test that function pointer casts casting away varargs are replaced with
4; wrappers.
5
6target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Sam Clegga5908002018-05-10 17:49:11 +00007target triple = "wasm32-unknown-unknown"
Dan Gohman3a762bf2017-12-08 21:27:00 +00008
9define void @callWithArgs() {
10entry:
11 call void bitcast (void (...)* @underspecified to void (i32, i32)*)(i32 0, i32 1)
12 call void(...) bitcast (void (i32, i32)* @specified to void (...)*)(i32 0, i32 1)
13 ret void
14}
15
16declare void @underspecified(...)
17declare void @specified(i32, i32)
18
19; CHECK: callWithArgs:
20; CHECK: i32.const $push1=, 0
21; CHECK-NEXT: i32.const $push0=, 1
Sam Clegg41d70472018-08-02 17:38:06 +000022; CHECK-NEXT: call .Lunderspecified_bitcast@FUNCTION, $pop1, $pop0
23; CHECK: call .Lspecified_bitcast@FUNCTION, $pop{{[0-9]+$}}
Dan Gohman3a762bf2017-12-08 21:27:00 +000024
Sam Clegg41d70472018-08-02 17:38:06 +000025; CHECK: .Lunderspecified_bitcast:
Dan Gohman3a762bf2017-12-08 21:27:00 +000026; CHECK-NEXT: .param i32, i32{{$}}
27; CHECK: call underspecified@FUNCTION, $pop{{[0-9]+$}}
28
Sam Clegg41d70472018-08-02 17:38:06 +000029; CHECK: .Lspecified_bitcast:
Dan Gohman3a762bf2017-12-08 21:27:00 +000030; CHECK-NEXT: .param i32{{$}}
31; CHECK: call specified@FUNCTION, $pop{{[0-9]+}}, $pop{{[0-9]+$}}