Files
clang-p2996/llvm/test/CodeGen/WebAssembly/fast-isel-noreg.ll
Nikita Popov e4a4122eb6 [IR] Remove zext and sext constant expressions (#71040)
Remove support for zext and sext constant expressions. All places
creating them have been removed beforehand, so this just removes the
APIs and uses of these constant expressions in tests.

There is some additional cleanup that can be done on top of this, e.g.
we can remove the ZExtInst vs ZExtOperator footgun.

This is part of
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179.
2023-11-03 10:46:07 +01:00

99 lines
2.2 KiB
LLVM

; RUN: llc < %s -asm-verbose=false -mcpu=mvp -disable-wasm-fallthrough-return-opt -wasm-keep-registers -verify-machineinstrs | FileCheck %s
; RUN: llc < %s -asm-verbose=false -mcpu=mvp -wasm-keep-registers -fast-isel -verify-machineinstrs | FileCheck %s
; Test that FastISel does not generate instructions with NoReg
target triple = "wasm32-unknown-unknown"
; CHECK: i32.const $push0=, 0
define hidden i32 @a() #0 {
entry:
%ext = zext i1 icmp eq (ptr inttoptr (i32 10 to ptr), ptr null) to i32
ret i32 %ext
}
; CHECK: i32.const $push0=, 1
; CHECK: br_if 0, $pop0
define hidden i32 @b() #0 {
entry:
br i1 icmp eq (ptr inttoptr (i32 10 to ptr), ptr null), label %a, label %b
a:
unreachable
b:
ret i32 0
}
; CHECK: i32.const $push1=, 0
; CHECK: i32.const $push2=, 0
; CHECK: i32.store 0($pop1), $pop2
define hidden i32 @c() #0 {
entry:
%ext = zext i1 icmp eq (ptr inttoptr (i32 10 to ptr), ptr null) to i32
store i32 %ext, ptr inttoptr (i32 0 to ptr)
ret i32 0
}
; CHECK: i32.const {{.*}}, addr
; CHECK: i32.const {{.*}}, 24
; CHECK: i32.shl
; CHECK: i32.const {{.*}}, 24
; CHECK: i32.shr_s
; CHECK: i32.const {{.*}}, 64
; CHECK: i32.lt_s
; CHECK: i32.const {{.*}}, 1
; CHECK: i32.and
; CHECK: i32.eqz
; CHECK: br_if 0, $pop{{[0-9]+}}
define hidden i32 @d() #0 {
entry:
%t = icmp slt i8 ptrtoint (ptr @addr to i8), 64
br i1 %t, label %a, label %b
a:
unreachable
b:
ret i32 0
}
; CHECK: i32.const {{.*}}, addr
; CHECK: i32.const {{.*}}, 255
; CHECK: i32.and
; CHECK: i32.const {{.*}}, 64
; CHECK: i32.lt_u
; CHECK: i32.const {{.*}}, 1
; CHECK: i32.and
; CHECK: i32.eqz
; CHECK: br_if 0, $pop{{[0-9]+}}
define hidden i32 @e() #0 {
entry:
%t = icmp ult i8 ptrtoint (ptr @addr to i8), 64
br i1 %t, label %a, label %b
a:
unreachable
b:
ret i32 0
}
; CHECK: i32.const {{.*}}, addr
; 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 (ptr @addr to i8) to i32
ret i32 %t
}
; CHECK: i32.const {{.*}}, addr
; CHECK: i32.const {{.*}}, 255
; CHECK: i32.and
define hidden i32 @g() #0 {
entry:
%t = zext i8 ptrtoint (ptr @addr to i8) to i32
ret i32 %t
}
declare void @addr()
attributes #0 = { noinline optnone }