File: jump-table-tbh.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 (56 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download | duplicates (13)
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
; RUN: llc -mtriple=thumbv7m-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s --check-prefix=T2
; RUN: llc -mtriple=thumbv6m-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s --check-prefix=T1

declare void @foo(double)
declare i32 @llvm.arm.space(i32, i32)

define i32 @test_tbh(i1 %tst, i32 %sw, i32 %l) {
  br label %complex

; T2-LABEL: test_tbh:
; T2: [[ANCHOR:.LCPI[0-9_]+]]:
; T2: tbh [pc, r{{[0-9]+}}, lsl #1]
; T2-NEXT: @ %bb.{{[0-9]+}}
; T2-NEXT: LJTI
; T2-NEXT: .short	(.LBB0_[[x:[0-9]+]]-([[ANCHOR]]+4))/2
; T2-NEXT: .short	(.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
; T2-NEXT: .short	(.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
; T2-NEXT: .short	(.LBB0_[[x]]-([[ANCHOR]]+4))/2

; T1-LABEL: test_tbh:
; T1: lsls [[x:r[0-9]+]], r4, #1
; T1: add [[x]], pc
; T1: ldrh [[x]], [[[x]], #4]
; T1: lsls [[x]], [[x]], #1
; T1: [[ANCHOR:.LCPI[0-9_]+]]:
; T1: add pc, [[x]]
; T1-NEXT: @ %bb.2
; T1-NEXT: .p2align 2
; T1-NEXT: LJTI
; T1-NEXT: .short	(.LBB0_[[x:[0-9]+]]-([[ANCHOR]]+4))/2
; T1-NEXT: .short	(.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
; T1-NEXT: .short	(.LBB0_{{[0-9]+}}-([[ANCHOR]]+4))/2
; T1-NEXT: .short	(.LBB0_[[x]]-([[ANCHOR]]+4))/2

complex:
  call void @foo(double 12345.0)
  switch i32 %sw, label %second [ i32 0, label %other
                                  i32 1, label %third
                                  i32 2, label %end
                                  i32 3, label %other ]

second:
  ret i32 43
third:
  call i32 @llvm.arm.space(i32 970, i32 undef)
  ret i32 0

other:
  call void @bar()
  unreachable

end:
  ret i32 42
}

declare void @bar()