blob: b0ca27674a1acce053c15f502fafa53be514c251 [file] [log] [blame]
Wouter van Oortmerssen8a9cb242018-08-27 15:45:51 +00001; RUN: llc < %s -O0 -wasm-keep-registers
Dan Gohman4576dc02018-04-17 20:46:42 +00002; PR36564
Dan Gohmanb8184822018-05-22 04:58:36 +00003; PR37546
Dan Gohman4576dc02018-04-17 20:46:42 +00004
5; Test that fast-isel properly copes with i24 arguments and return types.
6
7target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
Sam Clegga5908002018-05-10 17:49:11 +00008target triple = "wasm32-unknown-unknown"
Dan Gohman4576dc02018-04-17 20:46:42 +00009
Dan Gohmanb8184822018-05-22 04:58:36 +000010; CHECK-LABEL: add:
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000011; CHECK-NEXT: .functype add (i32, i32) -> (i32){{$}}
Dan Gohmanb8184822018-05-22 04:58:36 +000012; CHECK-NEXT: get_local $push2=, 0{{$}}
13; CHECK-NEXT: get_local $push1=, 1{{$}}
14; CHECK-NEXT: i32.add $push0=, $pop2, $pop1{{$}}
15; CHECK-NEXT: end_function
Dan Gohman4576dc02018-04-17 20:46:42 +000016define i24 @add(i24 %x, i24 %y) {
17 %z = add i24 %x, %y
18 ret i24 %z
19}
20
Dan Gohmanb8184822018-05-22 04:58:36 +000021; CHECK-LABEL: return_zero:
Wouter van Oortmerssen49482f82018-11-19 17:10:36 +000022; CHECK-NEXT: .functype return_zero () -> (i32){{$}}
Dan Gohmanb8184822018-05-22 04:58:36 +000023; CHECK-NEXT: i32.const $push0=, 0{{$}}
24; CHECK-NEXT: end_function
Dan Gohman4576dc02018-04-17 20:46:42 +000025define i24 @return_zero() {
26 ret i24 0
27}