1 ; RUN: llc -o - %s -asm-verbose=false -wasm-keep-registers -disable-wasm-fallthrough-return-opt -mattr=+simd128 | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
5 ; Test that stackified IMPLICIT_DEF instructions are converted into
6 ; CONST_XXX instructions to provide an explicit push.
8 ; CHECK-LABEL: implicit_def_i32:
9 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
10 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
11 ; CHECK: i32.const $push[[R:[0-9]+]]=, 0{{$}}
12 ; CHECK-NEXT: return $pop[[R]]{{$}}
13 define i32 @implicit_def_i32() {
14 br i1 undef, label %A, label %X
18 br i1 %d, label %C, label %B
24 %h = phi i32 [ undef, %A ], [ 0, %B ]
28 %i = phi i32 [ 1, %0 ], [ %h, %C ]
32 ; CHECK-LABEL: implicit_def_i64:
33 ; CHECK: i64.const $push[[R:[0-9]+]]=, 0{{$}}
34 ; CHECK-NEXT: return $pop[[R]]{{$}}
35 define i64 @implicit_def_i64() {
36 br i1 undef, label %A, label %X
40 br i1 %d, label %C, label %B
46 %h = phi i64 [ undef, %A ], [ 0, %B ]
50 %i = phi i64 [ 1, %0 ], [ %h, %C ]
54 ; CHECK-LABEL: implicit_def_f32:
55 ; CHECK: f32.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
56 ; CHECK-NEXT: return $pop[[R]]{{$}}
57 define float @implicit_def_f32() {
58 br i1 undef, label %A, label %X
62 br i1 %d, label %C, label %B
68 %h = phi float [ undef, %A ], [ 0.0, %B ]
72 %i = phi float [ 1.0, %0 ], [ %h, %C ]
76 ; CHECK-LABEL: implicit_def_f64:
77 ; CHECK: f64.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
78 ; CHECK-NEXT: return $pop[[R]]{{$}}
79 define double @implicit_def_f64() {
80 br i1 undef, label %A, label %X
84 br i1 %d, label %C, label %B
90 %h = phi double [ undef, %A ], [ 0.0, %B ]
94 %i = phi double [ 1.0, %0 ], [ %h, %C ]
98 ; CHECK-LABEL: implicit_def_v4i32:
99 ; CHECK: v128.const $push[[R:[0-9]+]]=, 0, 0{{$}}
100 ; CHECK-NEXT: return $pop[[R]]{{$}}
101 define <4 x i32> @implicit_def_v4i32() {
102 br i1 undef, label %A, label %X
105 %d = icmp slt i1 0, 0
106 br i1 %d, label %C, label %B
112 %h = phi <4 x i32> [ undef, %A ], [ <i32 0, i32 0, i32 0, i32 0>, %B ]
116 %i = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %0 ], [ %h, %C ]