blob: 01f0cb9039b621c991f6bf475e49967862b77600 [file] [log] [blame]
Dan Gohman4684f822019-01-29 10:53:42 +00001; RUN: llc < %s -asm-verbose=false -wasm-keep-registers | 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 Clegg275d15e2019-02-23 00:07:39 +000022; CHECK-NEXT: call .Lunderspecified_bitcast, $pop1, $pop0
23; CHECK: call .Lspecified_bitcast, $pop{{[0-9]+$}}
Dan Gohman3a762bf2017-12-08 21:27:00 +000024
Sam Clegg41d70472018-08-02 17:38:06 +000025; CHECK: .Lunderspecified_bitcast:
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000026; CHECK-NEXT: .functype .Lunderspecified_bitcast (i32, i32) -> (){{$}}
Sam Clegg275d15e2019-02-23 00:07:39 +000027; CHECK: call underspecified, $pop{{[0-9]+$}}
Dan Gohman3a762bf2017-12-08 21:27:00 +000028
Sam Clegg41d70472018-08-02 17:38:06 +000029; CHECK: .Lspecified_bitcast:
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000030; CHECK-NEXT: .functype .Lspecified_bitcast (i32) -> (){{$}}
Sam Clegg275d15e2019-02-23 00:07:39 +000031; CHECK: call specified, $pop{{[0-9]+}}, $pop{{[0-9]+$}}