1 ; RUN: llc -o - %s -asm-verbose=false -wasm-keep-registers -disable-wasm-fallthrough-return-opt -mattr=+simd128 | FileCheck %s
3 target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
4 target triple = "wasm32-unknown-unknown"
6 ; Test that stackified IMPLICIT_DEF instructions are converted into
7 ; CONST_XXX instructions to provide an explicit push.
9 ; CHECK-LABEL: implicit_def_i32:
10 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
11 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
12 ; CHECK: i32.const $push[[R:[0-9]+]]=, 0{{$}}
13 ; CHECK-NEXT: return $pop[[R]]{{$}}
14 define i32 @implicit_def_i32() {
15 br i1 undef, label %A, label %X
19 br i1 %d, label %C, label %B
25 %h = phi i32 [ undef, %A ], [ 0, %B ]
29 %i = phi i32 [ 1, %0 ], [ %h, %C ]
33 ; CHECK-LABEL: implicit_def_i64:
34 ; CHECK: i64.const $push[[R:[0-9]+]]=, 0{{$}}
35 ; CHECK-NEXT: return $pop[[R]]{{$}}
36 define i64 @implicit_def_i64() {
37 br i1 undef, label %A, label %X
41 br i1 %d, label %C, label %B
47 %h = phi i64 [ undef, %A ], [ 0, %B ]
51 %i = phi i64 [ 1, %0 ], [ %h, %C ]
55 ; CHECK-LABEL: implicit_def_f32:
56 ; CHECK: f32.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
57 ; CHECK-NEXT: return $pop[[R]]{{$}}
58 define float @implicit_def_f32() {
59 br i1 undef, label %A, label %X
63 br i1 %d, label %C, label %B
69 %h = phi float [ undef, %A ], [ 0.0, %B ]
73 %i = phi float [ 1.0, %0 ], [ %h, %C ]
77 ; CHECK-LABEL: implicit_def_f64:
78 ; CHECK: f64.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
79 ; CHECK-NEXT: return $pop[[R]]{{$}}
80 define double @implicit_def_f64() {
81 br i1 undef, label %A, label %X
85 br i1 %d, label %C, label %B
91 %h = phi double [ undef, %A ], [ 0.0, %B ]
95 %i = phi double [ 1.0, %0 ], [ %h, %C ]
99 ; CHECK-LABEL: implicit_def_v4i32:
100 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
101 ; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
102 ; CHECK: i32.const $push[[L0:[0-9]+]]=, 0{{$}}
103 ; CHECK-NEXT: i32x4.splat $push[[R:[0-9]+]]=, $pop[[L0]]
104 ; CHECK-NEXT: return $pop[[R]]{{$}}
105 define <4 x i32> @implicit_def_v4i32() {
106 br i1 undef, label %A, label %X
109 %d = icmp slt i1 0, 0
110 br i1 %d, label %C, label %B
116 %h = phi <4 x i32> [ undef, %A ], [ <i32 0, i32 0, i32 0, i32 0>, %B ]
120 %i = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %0 ], [ %h, %C ]