2018-08-27 23:45:51 +08:00
|
|
|
; RUN: llc < %s -asm-verbose=false -disable-wasm-fallthrough-return-opt -wasm-keep-registers -verify-machineinstrs | FileCheck %s
|
|
|
|
; RUN: llc < %s -asm-verbose=false -wasm-keep-registers -fast-isel -verify-machineinstrs | FileCheck %s
|
2016-08-05 02:01:52 +08:00
|
|
|
|
|
|
|
; Test that FastISel does not generate instructions with NoReg
|
|
|
|
|
|
|
|
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-08-05 02:01:52 +08:00
|
|
|
|
|
|
|
; CHECK: i32.const $push0=, 0
|
|
|
|
define hidden i32 @a() #0 {
|
|
|
|
entry:
|
|
|
|
ret i32 zext (i1 icmp eq (void (...)* inttoptr (i32 10 to void (...)*), void (...)* null) to i32)
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: i32.const $push0=, 1
|
|
|
|
; CHECK: br_if 0, $pop0
|
|
|
|
define hidden i32 @b() #0 {
|
|
|
|
entry:
|
|
|
|
br i1 icmp eq (void (...)* inttoptr (i32 10 to void (...)*), void (...)* null), label %a, label %b
|
|
|
|
a:
|
|
|
|
unreachable
|
|
|
|
b:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
|
|
|
; CHECK: i32.const $push1=, 0
|
|
|
|
; CHECK: i32.const $push2=, 0
|
2016-10-07 06:08:28 +08:00
|
|
|
; CHECK: i32.store 0($pop1), $pop2
|
2016-08-05 02:01:52 +08:00
|
|
|
define hidden i32 @c() #0 {
|
|
|
|
entry:
|
|
|
|
store i32 zext (i1 icmp eq (void (...)* inttoptr (i32 10 to void (...)*), void (...)* null) to i32), i32* inttoptr (i32 0 to i32 *)
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2019-02-23 08:07:39 +08:00
|
|
|
; CHECK: i32.const {{.*}}, addr
|
2017-11-28 13:36:42 +08:00
|
|
|
; CHECK: i32.const {{.*}}, 24
|
|
|
|
; CHECK: i32.shl
|
|
|
|
; CHECK: i32.const {{.*}}, 24
|
|
|
|
; CHECK: i32.shr_s
|
|
|
|
; CHECK: i32.const {{.*}}, 64
|
2019-01-15 06:03:43 +08:00
|
|
|
; CHECK: i32.lt_s
|
|
|
|
; CHECK: i32.const {{.*}}, 1
|
|
|
|
; CHECK: i32.and
|
|
|
|
; CHECK: i32.eqz
|
|
|
|
; CHECK: br_if 0, $pop{{[0-9]+}}
|
2017-11-28 13:36:42 +08:00
|
|
|
define hidden i32 @d() #0 {
|
|
|
|
entry:
|
|
|
|
%t = icmp slt i8 ptrtoint (void ()* @addr to i8), 64
|
|
|
|
br i1 %t, label %a, label %b
|
|
|
|
a:
|
|
|
|
unreachable
|
|
|
|
b:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2019-02-23 08:07:39 +08:00
|
|
|
; CHECK: i32.const {{.*}}, addr
|
2017-11-28 13:36:42 +08:00
|
|
|
; CHECK: i32.const {{.*}}, 255
|
|
|
|
; CHECK: i32.and
|
|
|
|
; CHECK: i32.const {{.*}}, 64
|
2019-01-15 06:03:43 +08:00
|
|
|
; CHECK: i32.lt_u
|
|
|
|
; CHECK: i32.const {{.*}}, 1
|
|
|
|
; CHECK: i32.and
|
|
|
|
; CHECK: i32.eqz
|
|
|
|
; CHECK: br_if 0, $pop{{[0-9]+}}
|
2017-11-28 13:36:42 +08:00
|
|
|
define hidden i32 @e() #0 {
|
|
|
|
entry:
|
|
|
|
%t = icmp ult i8 ptrtoint (void ()* @addr to i8), 64
|
|
|
|
br i1 %t, label %a, label %b
|
|
|
|
a:
|
|
|
|
unreachable
|
|
|
|
b:
|
|
|
|
ret i32 0
|
|
|
|
}
|
|
|
|
|
2019-02-23 08:07:39 +08:00
|
|
|
; CHECK: i32.const {{.*}}, addr
|
2017-11-28 13:36:42 +08:00
|
|
|
; CHECK: i32.const {{.*}}, 24
|
|
|
|
; CHECK: i32.shl
|
|
|
|
; CHECK: i32.const {{.*}}, 24
|
|
|
|
; CHECK: i32.shr_s
|
|
|
|
define hidden i32 @f() #0 {
|
|
|
|
entry:
|
|
|
|
%t = sext i8 ptrtoint (void ()* @addr to i8) to i32
|
|
|
|
ret i32 %t
|
|
|
|
}
|
|
|
|
|
2019-02-23 08:07:39 +08:00
|
|
|
; CHECK: i32.const {{.*}}, addr
|
2017-11-28 13:36:42 +08:00
|
|
|
; CHECK: i32.const {{.*}}, 255
|
|
|
|
; CHECK: i32.and
|
|
|
|
define hidden i32 @g() #0 {
|
|
|
|
entry:
|
|
|
|
%t = zext i8 ptrtoint (void ()* @addr to i8) to i32
|
|
|
|
ret i32 %t
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @addr()
|
|
|
|
|
2016-08-05 02:01:52 +08:00
|
|
|
attributes #0 = { noinline optnone }
|