2018-11-01 07:50:53 +08:00
|
|
|
; RUN: llc -o - %s -asm-verbose=false -wasm-keep-registers -disable-wasm-fallthrough-return-opt -mattr=+simd128 | FileCheck %s
|
|
|
|
|
2016-11-09 03:40:38 +08:00
|
|
|
target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
|
2018-05-11 01:49:11 +08:00
|
|
|
target triple = "wasm32-unknown-unknown"
|
2016-11-09 03:40:38 +08:00
|
|
|
|
|
|
|
; Test that stackified IMPLICIT_DEF instructions are converted into
|
2018-11-01 07:50:53 +08:00
|
|
|
; CONST_XXX instructions to provide an explicit push.
|
|
|
|
|
|
|
|
; CHECK-LABEL: implicit_def_i32:
|
2019-03-06 04:35:34 +08:00
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK: i32.const $push[[R:[0-9]+]]=, 0{{$}}
|
2018-11-01 07:50:53 +08:00
|
|
|
; CHECK-NEXT: return $pop[[R]]{{$}}
|
|
|
|
define i32 @implicit_def_i32() {
|
|
|
|
br i1 undef, label %A, label %X
|
|
|
|
|
|
|
|
A: ; preds = %0
|
|
|
|
%d = icmp slt i1 0, 0
|
|
|
|
br i1 %d, label %C, label %B
|
|
|
|
|
|
|
|
B: ; preds = %A
|
|
|
|
br label %C
|
|
|
|
|
|
|
|
C: ; preds = %B, %A
|
|
|
|
%h = phi i32 [ undef, %A ], [ 0, %B ]
|
|
|
|
br label %X
|
|
|
|
|
|
|
|
X: ; preds = %0, C
|
|
|
|
%i = phi i32 [ 1, %0 ], [ %h, %C ]
|
|
|
|
ret i32 %i
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: implicit_def_i64:
|
2019-03-06 04:35:34 +08:00
|
|
|
; CHECK: i64.const $push[[R:[0-9]+]]=, 0{{$}}
|
2018-11-01 07:50:53 +08:00
|
|
|
; CHECK-NEXT: return $pop[[R]]{{$}}
|
|
|
|
define i64 @implicit_def_i64() {
|
|
|
|
br i1 undef, label %A, label %X
|
|
|
|
|
|
|
|
A: ; preds = %0
|
|
|
|
%d = icmp slt i1 0, 0
|
|
|
|
br i1 %d, label %C, label %B
|
|
|
|
|
|
|
|
B: ; preds = %A
|
|
|
|
br label %C
|
|
|
|
|
|
|
|
C: ; preds = %B, %A
|
|
|
|
%h = phi i64 [ undef, %A ], [ 0, %B ]
|
2016-11-09 03:40:38 +08:00
|
|
|
br label %X
|
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
X: ; preds = %0, C
|
|
|
|
%i = phi i64 [ 1, %0 ], [ %h, %C ]
|
|
|
|
ret i64 %i
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: implicit_def_f32:
|
2019-03-06 04:35:34 +08:00
|
|
|
; CHECK: f32.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
|
2018-11-01 07:50:53 +08:00
|
|
|
; CHECK-NEXT: return $pop[[R]]{{$}}
|
|
|
|
define float @implicit_def_f32() {
|
|
|
|
br i1 undef, label %A, label %X
|
2016-11-09 03:40:38 +08:00
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
A: ; preds = %0
|
|
|
|
%d = icmp slt i1 0, 0
|
|
|
|
br i1 %d, label %C, label %B
|
2016-11-09 03:40:38 +08:00
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
B: ; preds = %A
|
|
|
|
br label %C
|
2016-11-09 03:40:38 +08:00
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
C: ; preds = %B, %A
|
|
|
|
%h = phi float [ undef, %A ], [ 0.0, %B ]
|
2016-11-09 03:40:38 +08:00
|
|
|
br label %X
|
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
X: ; preds = %0, C
|
|
|
|
%i = phi float [ 1.0, %0 ], [ %h, %C ]
|
|
|
|
ret float %i
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK-LABEL: implicit_def_f64:
|
2019-03-06 04:35:34 +08:00
|
|
|
; CHECK: f64.const $push[[R:[0-9]+]]=, 0x0p0{{$}}
|
2018-11-01 07:50:53 +08:00
|
|
|
; CHECK-NEXT: return $pop[[R]]{{$}}
|
|
|
|
define double @implicit_def_f64() {
|
|
|
|
br i1 undef, label %A, label %X
|
|
|
|
|
|
|
|
A: ; preds = %0
|
|
|
|
%d = icmp slt i1 0, 0
|
|
|
|
br i1 %d, label %C, label %B
|
|
|
|
|
|
|
|
B: ; preds = %A
|
|
|
|
br label %C
|
2016-11-09 03:40:38 +08:00
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
C: ; preds = %B, %A
|
|
|
|
%h = phi double [ undef, %A ], [ 0.0, %B ]
|
2016-11-09 03:40:38 +08:00
|
|
|
br label %X
|
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
X: ; preds = %0, C
|
|
|
|
%i = phi double [ 1.0, %0 ], [ %h, %C ]
|
|
|
|
ret double %i
|
2016-11-09 03:40:38 +08:00
|
|
|
}
|
|
|
|
|
2018-11-01 07:50:53 +08:00
|
|
|
; CHECK-LABEL: implicit_def_v4i32:
|
2019-03-06 04:35:34 +08:00
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK: i32.const $push{{[0-9]+}}=, 0{{$}}
|
|
|
|
; CHECK: i32.const $push[[L0:[0-9]+]]=, 0{{$}}
|
2018-12-20 12:20:32 +08:00
|
|
|
; CHECK-NEXT: i32x4.splat $push[[R:[0-9]+]]=, $pop[[L0]]
|
2018-11-01 07:50:53 +08:00
|
|
|
; CHECK-NEXT: return $pop[[R]]{{$}}
|
|
|
|
define <4 x i32> @implicit_def_v4i32() {
|
|
|
|
br i1 undef, label %A, label %X
|
|
|
|
|
|
|
|
A: ; preds = %0
|
|
|
|
%d = icmp slt i1 0, 0
|
|
|
|
br i1 %d, label %C, label %B
|
|
|
|
|
|
|
|
B: ; preds = %A
|
|
|
|
br label %C
|
|
|
|
|
|
|
|
C: ; preds = %B, %A
|
|
|
|
%h = phi <4 x i32> [ undef, %A ], [ <i32 0, i32 0, i32 0, i32 0>, %B ]
|
|
|
|
br label %X
|
|
|
|
|
|
|
|
X: ; preds = %0, C
|
|
|
|
%i = phi <4 x i32> [ <i32 1, i32 1, i32 1, i32 1>, %0 ], [ %h, %C ]
|
|
|
|
ret <4 x i32> %i
|
|
|
|
}
|