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 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210
|
; RUN: llc %s -o - -mtriple x86_64-sie-ps5 -emit-jump-table-sizes-section -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=PS5-CHECK %s
; RUN: llc %s -o - -mtriple x86_64-sie-ps5 -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=NOFLAG %s
; RUN: llc %s -o - -mtriple x86_64-sie-ps5 -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=NOTABLE %s
; RUN: llc %s -o - -mtriple x86_64-unknown-linux-gnu -emit-jump-table-sizes-section -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=ELF-CHECK %s
; RUN: llc %s -o - -mtriple x86_64-unknown-linux-gnu -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=NOFLAG %s
; RUN: llc %s -o - -mtriple x86_64-unknown-linux-gnu -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=NOTABLE %s
; RUN: llc %s -o - -mtriple x86_64-pc-windows-msvc -emit-jump-table-sizes-section -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=COFF-CHECK %s
; RUN: llc %s -o - -mtriple x86_64-pc-windows-msvc -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=NOFLAG %s
; RUN: llc %s -o - -mtriple x86_64-pc-windows-msvc -verify-machineinstrs --relocation-model=pic | FileCheck --check-prefix=NOTABLE %s
; This test verifies the jump table size section. Currently only enabled by default on the PS5 target.
$foo1 = comdat any
; Ensure proper comdat handling.
define void @foo1(i32 %x, ptr %to) comdat {
; PS5-CHECK-LABEL: foo1
; PS5-CHECK: .section .llvm_jump_table_sizes,"G",@llvm_jt_sizes,foo1,comdat
; PS5-CHECK-NEXT: .quad .LJTI0_0
; PS5-CHECK-NEXT: .quad 6
; ELF-CHECK-LABEL: foo1
; ELF-CHECK: .section .llvm_jump_table_sizes,"G",@llvm_jt_sizes,foo1,comdat
; ELF-CHECK-NEXT: .quad .LJTI0_0
; ELF-CHECK-NEXT: .quad 6
; COFF-CHECK-LABEL: foo1
; COFF-CHECK: .section .llvm_jump_table_sizes,"drD",associative,foo1
; COFF-CHECK-NEXT: .quad .LJTI0_0
; COFF-CHECK-NEXT: .quad 6
; NOFLAG-LABEL: foo1
; NOFLAG-NOT: .section .llvm_jump_table_sizes
entry:
switch i32 %x, label %default [
i32 0, label %bb0
i32 1, label %bb1
i32 2, label %bb2
i32 3, label %bb3
i32 4, label %bb4
i32 5, label %bb4
]
bb0:
store i32 0, ptr %to
br label %exit
bb1:
store i32 1, ptr %to
br label %exit
bb2:
store i32 2, ptr %to
br label %exit
bb3:
store i32 3, ptr %to
br label %exit
bb4:
store i32 4, ptr %to
br label %exit
exit:
ret void
default:
unreachable
}
define void @foo2(i32 %x, ptr %to) {
; PS5-CHECK-LABEL: foo2
; PS5-CHECK: .section .llvm_jump_table_sizes,"",@llvm_jt_sizes
; PS5-CHECK-NEXT: .quad .LJTI1_0
; PS5-CHECK-NEXT: .quad 5
; ELF-CHECK-LABEL: foo2
; ELF-CHECK: .section .llvm_jump_table_sizes,"",@llvm_jt_sizes
; ELF-CHECK-NEXT: .quad .LJTI1_0
; ELF-CHECK-NEXT: .quad 5
; COFF-CHECK-LABEL: foo2
; COFF-CHECK: .section .llvm_jump_table_sizes,"drD"
; COFF-CHECK-NEXT: .quad .LJTI1_0
; COFF-CHECK-NEXT: .quad 5
; NOFLAG-LABEL: foo1
; NOFLAG-NOT: .section .llvm_jump_table_sizes
entry:
switch i32 %x, label %default [
i32 0, label %bb0
i32 1, label %bb1
i32 2, label %bb2
i32 3, label %bb3
i32 4, label %bb4
]
bb0:
store i32 0, ptr %to
br label %exit
bb1:
store i32 1, ptr %to
br label %exit
bb2:
store i32 2, ptr %to
br label %exit
bb3:
store i32 3, ptr %to
br label %exit
bb4:
store i32 4, ptr %to
br label %exit
exit:
ret void
default:
unreachable
}
; Ensure that the section isn't produced if there is no jump table.
define void @foo3(i32 %x, ptr %to) {
; NOTABLE-LABEL: foo3
; NOTABLE-NOT: .section .llvm_jump_table_sizes
exit:
ret void
}
; Ensure we can deal with nested jump tables.
define void @nested(i32 %x, i32 %y, ptr %to) {
; PS5-CHECK-LABEL: nested
; PS5-CHECK: .section .llvm_jump_table_sizes,"",@llvm_jt_sizes
; PS5-CHECK-NEXT: .quad .LJTI3_0
; PS5-CHECK-NEXT: .quad 5
; PS5-CHECK-NEXT: .quad .LJTI3_1
; PS5-CHECK-NEXT: .quad 6
; ELF-CHECK-LABEL: nested
; ELF-CHECK: .section .llvm_jump_table_sizes,"",@llvm_jt_sizes
; ELF-CHECK-NEXT: .quad .LJTI3_0
; ELF-CHECK-NEXT: .quad 5
; ELF-CHECK-NEXT: .quad .LJTI3_1
; ELF-CHECK-NEXT: .quad 6
; COFF-CHECK-LABEL: nested
; COFF-CHECK: .section .llvm_jump_table_sizes,"drD"
; COFF-CHECK-NEXT: .quad .LJTI3_0
; COFF-CHECK-NEXT: .quad 5
; COFF-CHECK-NEXT: .quad .LJTI3_1
; COFF-CHECK-NEXT: .quad 6
; NOFLAG-LABEL: nested
; NOFLAG-NOT: .section .llvm_jump_table_sizes
entry:
switch i32 %x, label %default [
i32 0, label %bb0
i32 1, label %bb1
i32 2, label %bb2
i32 3, label %bb3
i32 4, label %bb4
]
bb0:
store i32 0, ptr %to
br label %exit
bb1:
store i32 1, ptr %to
br label %exit
bb2:
store i32 2, ptr %to
br label %exit
bb3:
store i32 3, ptr %to
br label %exit
bb4:
switch i32 %y, label %default [
i32 1, label %bb5
i32 2, label %bb6
i32 3, label %bb7
i32 4, label %bb8
i32 5, label %bb9
i32 6, label %bb10
]
br label %exit2
bb5:
store i32 4, ptr %to
br label %exit
bb6:
store i32 4, ptr %to
br label %exit
bb7:
store i32 4, ptr %to
br label %exit
bb8:
store i32 4, ptr %to
br label %exit
bb9:
store i32 4, ptr %to
br label %exit
bb10:
store i32 4, ptr %to
br label %exit
exit:
ret void
exit2:
ret void
default:
unreachable
}
|