File: fast-isel-noreg.ll

package info (click to toggle)
llvm-toolchain-9 1%3A9.0.1-16
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 882,436 kB
  • sloc: cpp: 4,167,636; ansic: 714,256; asm: 457,610; python: 155,927; objc: 65,094; sh: 42,856; lisp: 26,908; perl: 7,786; pascal: 7,722; makefile: 6,881; ml: 5,581; awk: 3,648; cs: 2,027; xml: 888; javascript: 381; ruby: 156
file content (97 lines) | stat: -rw-r--r-- 2,353 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
; 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

; Test that FastISel does not generate instructions with NoReg

target datalayout = "e-m:e-p:32:32-i64:64-n32:64-S128"
target triple = "wasm32-unknown-unknown"

; 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
; CHECK: i32.store 0($pop1), $pop2
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
}

; 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 (void ()* @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 (void ()* @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 (void ()* @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 (void ()* @addr to i8) to i32
  ret i32 %t
}

declare void @addr()

attributes #0 = { noinline optnone }