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: .LBB{{[0-9]+}}_4:{{$}}
11 ; CHECK-NEXT: end_block{{$}}
12 ; CHECK-NEXT: i32.const $push[[R:[0-9]+]]=, 0{{$}}
13 ; CHECK-NEXT: return $pop[[R]]{{$}}
14 ; CHECK-NEXT: end_function{{$}}
15 define i32 @implicit_def_i32() {
16 br i1 undef, label %A, label %X
20 br i1 %d, label %C, label %B
26 %h = phi i32 [ undef, %A ], [ 0, %B ]
30 %i = phi i32 [ 1, %0 ], [ %h, %C ]
34 ; CHECK-LABEL: implicit_def_i64:
35 ; CHECK: .LBB{{[0-9]+}}_4:{{$}}
36 ; CHECK-NEXT: end_block{{$}}
37 ; CHECK-NEXT: i64.const $push[[R:[0-9]+]]=, 0{{$}}
38 ; CHECK-NEXT: return $pop[[R]]{{$}}
39 ; CHECK-NEXT: end_function{{$}}
40 define i64 @implicit_def_i64() {
41 br i1 undef, label %A, label %X
45 br i1 %d, label %C, label %B
51 %h = phi i64 [ undef, %A ], [ 0, %B ]
55 %i = phi i64 [ 1, %0 ], [ %h, %C ]
59 ; CHECK-LABEL: implicit_def_f32:
60 ; CHECK: .LBB{{[0-9]+}}_4:{{$}}
61 ; CHECK-NEXT: end_block{{$}}
62 ; CHECK-NEXT: f32.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
63 ; CHECK-NEXT: return $pop[[R]]{{$}}
64 ; CHECK-NEXT: end_function{{$}}
65 define float @implicit_def_f32() {
66 br i1 undef, label %A, label %X
70 br i1 %d, label %C, label %B
76 %h = phi float [ undef, %A ], [ 0.0, %B ]
80 %i = phi float [ 1.0, %0 ], [ %h, %C ]
84 ; CHECK-LABEL: implicit_def_f64:
85 ; CHECK: .LBB{{[0-9]+}}_4:{{$}}
86 ; CHECK-NEXT: end_block{{$}}
87 ; CHECK-NEXT: f64.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
88 ; CHECK-NEXT: return $pop[[R]]{{$}}
89 ; CHECK-NEXT: end_function{{$}}
90 define double @implicit_def_f64() {
91 br i1 undef, label %A, label %X
95 br i1 %d, label %C, label %B
101 %h = phi double [ undef, %A ], [ 0.0, %B ]
105 %i = phi double [ 1.0, %0 ], [ %h, %C ]
109 ; CHECK-LABEL: implicit_def_v4i32:
110 ; CHECK: .LBB{{[0-9]+}}_4:{{$}}
111 ; CHECK-NEXT: end_block{{$}}
112 ; CHECK-NEXT: i32.const $push[[L0:[0-9]+]]=, 0{{$}}
113 ; CHECK-NEXT: i32x4.splat $push[[R:[0-9]+]]=, $pop[[L0]]
114 ; CHECK-NEXT: return $pop[[R]]{{$}}
115 ; CHECK-NEXT: end_function{{$}}
116 define <4 x i32> @implicit_def_v4i32() {
117 br i1 undef, label %A, label %X
120 %d = icmp slt i1 0, 0
121 br i1 %d, label %C, label %B
127 %h = phi <4 x i32> [ undef, %A ], [ <i32 0, i32 0, i32 0, i32 0>, %B ]
131 %i = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %0 ], [ %h, %C ]