File: return-int32.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (74 lines) | stat: -rw-r--r-- 2,360 bytes parent folder | download | duplicates (10)
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
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -wasm-keep-registers | FileCheck %s
; RUN: llc < %s -wasm-keep-registers -fast-isel -fast-isel-abort=1 | FileCheck %s --check-prefix=FAST

target triple = "wasm32-unknown-unknown"

define i32 @return_i32(i32 %p) {
; CHECK-LABEL: return_i32:
; CHECK:         .functype return_i32 (i32) -> (i32)
; CHECK-NEXT:  # %bb.0:
; CHECK-NEXT:    local.get $push0=, 0
; CHECK-NEXT:    # fallthrough-return
;
; FAST-LABEL: return_i32:
; FAST:         .functype return_i32 (i32) -> (i32)
; FAST-NEXT:  # %bb.0:
; FAST-NEXT:    local.get $push0=, 0
; FAST-NEXT:    # fallthrough-return
  ret i32 %p
}

define i32 @return_i32_twice(i32 %a) {
; CHECK-LABEL: return_i32_twice:
; CHECK:         .functype return_i32_twice (i32) -> (i32)
; CHECK-NEXT:  # %bb.0:
; CHECK-NEXT:    block
; CHECK-NEXT:    local.get $push6=, 0
; CHECK-NEXT:    i32.eqz $push7=, $pop6
; CHECK-NEXT:    br_if 0, $pop7 # 0: down to label0
; CHECK-NEXT:  # %bb.1: # %true
; CHECK-NEXT:    i32.const $push3=, 0
; CHECK-NEXT:    i32.const $push5=, 0
; CHECK-NEXT:    i32.store 0($pop3), $pop5
; CHECK-NEXT:    i32.const $push4=, 1
; CHECK-NEXT:    return $pop4
; CHECK-NEXT:  .LBB1_2: # %false
; CHECK-NEXT:    end_block # label0:
; CHECK-NEXT:    i32.const $push1=, 0
; CHECK-NEXT:    i32.const $push0=, 2
; CHECK-NEXT:    i32.store 0($pop1), $pop0
; CHECK-NEXT:    i32.const $push2=, 3
; CHECK-NEXT:    # fallthrough-return
;
; FAST-LABEL: return_i32_twice:
; FAST:         .functype return_i32_twice (i32) -> (i32)
; FAST-NEXT:  # %bb.0:
; FAST-NEXT:    block
; FAST-NEXT:    local.get $push6=, 0
; FAST-NEXT:    i32.eqz $push7=, $pop6
; FAST-NEXT:    br_if 0, $pop7 # 0: down to label0
; FAST-NEXT:  # %bb.1: # %true
; FAST-NEXT:    i32.const $push4=, 0
; FAST-NEXT:    i32.const $push5=, 0
; FAST-NEXT:    i32.store 0($pop4), $pop5
; FAST-NEXT:    i32.const $push3=, 1
; FAST-NEXT:    return $pop3
; FAST-NEXT:  .LBB1_2: # %false
; FAST-NEXT:    end_block # label0:
; FAST-NEXT:    i32.const $push1=, 0
; FAST-NEXT:    i32.const $push2=, 2
; FAST-NEXT:    i32.store 0($pop1), $pop2
; FAST-NEXT:    i32.const $push0=, 3
; FAST-NEXT:    # fallthrough-return
  %b = icmp ne i32 %a, 0
  br i1 %b, label %true, label %false

true:
  store i32 0, ptr null
  ret i32 1

false:
  store i32 2, ptr null
  ret i32 3
}