1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=x86-64 -mattr=fsgsbase | FileCheck %s --check-prefix=GENERIC 3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=goldmont | FileCheck %s --check-prefix=GLM 4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=ivybridge | FileCheck %s --check-prefix=IVY 5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=haswell | FileCheck %s --check-prefix=HASWELL 6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=skylake | FileCheck %s --check-prefix=SKYLAKE 7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=skx | FileCheck %s --check-prefix=SKX 8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=knl | FileCheck %s --check-prefix=KNL 9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=bdver3 | FileCheck %s --check-prefix=BDVER --check-prefix=BDVER3 10 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=bdver4 | FileCheck %s --check-prefix=BDVER --check-prefix=BDVER4 11 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -print-schedule -mcpu=znver1 | FileCheck %s --check-prefix=ZNVER1 12 13 define i32 @test_x86_rdfsbase_32() { 14 ; GENERIC-LABEL: test_x86_rdfsbase_32: 15 ; GENERIC: # %bb.0: 16 ; GENERIC-NEXT: rdfsbasel %eax # sched: [100:0.33] 17 ; GENERIC-NEXT: retq # sched: [1:1.00] 18 ; 19 ; GLM-LABEL: test_x86_rdfsbase_32: 20 ; GLM: # %bb.0: 21 ; GLM-NEXT: rdfsbasel %eax # sched: [100:1.00] 22 ; GLM-NEXT: retq # sched: [4:1.00] 23 ; 24 ; IVY-LABEL: test_x86_rdfsbase_32: 25 ; IVY: # %bb.0: 26 ; IVY-NEXT: rdfsbasel %eax # sched: [100:0.33] 27 ; IVY-NEXT: retq # sched: [1:1.00] 28 ; 29 ; HASWELL-LABEL: test_x86_rdfsbase_32: 30 ; HASWELL: # %bb.0: 31 ; HASWELL-NEXT: rdfsbasel %eax # sched: [100:0.25] 32 ; HASWELL-NEXT: retq # sched: [7:1.00] 33 ; 34 ; SKYLAKE-LABEL: test_x86_rdfsbase_32: 35 ; SKYLAKE: # %bb.0: 36 ; SKYLAKE-NEXT: rdfsbasel %eax # sched: [100:0.25] 37 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 38 ; 39 ; SKX-LABEL: test_x86_rdfsbase_32: 40 ; SKX: # %bb.0: 41 ; SKX-NEXT: rdfsbasel %eax # sched: [100:0.25] 42 ; SKX-NEXT: retq # sched: [7:1.00] 43 ; 44 ; KNL-LABEL: test_x86_rdfsbase_32: 45 ; KNL: # %bb.0: 46 ; KNL-NEXT: rdfsbasel %eax # sched: [100:0.25] 47 ; KNL-NEXT: retq # sched: [7:1.00] 48 ; 49 ; BDVER-LABEL: test_x86_rdfsbase_32: 50 ; BDVER: # %bb.0: 51 ; BDVER-NEXT: rdfsbasel %eax 52 ; BDVER-NEXT: retq 53 ; 54 ; ZNVER1-LABEL: test_x86_rdfsbase_32: 55 ; ZNVER1: # %bb.0: 56 ; ZNVER1-NEXT: rdfsbasel %eax # sched: [100:0.25] 57 ; ZNVER1-NEXT: retq # sched: [1:0.50] 58 %res = call i32 @llvm.x86.rdfsbase.32() 59 ret i32 %res 60 } 61 declare i32 @llvm.x86.rdfsbase.32() nounwind readnone 62 63 define i32 @test_x86_rdgsbase_32() { 64 ; GENERIC-LABEL: test_x86_rdgsbase_32: 65 ; GENERIC: # %bb.0: 66 ; GENERIC-NEXT: rdgsbasel %eax # sched: [100:0.33] 67 ; GENERIC-NEXT: retq # sched: [1:1.00] 68 ; 69 ; GLM-LABEL: test_x86_rdgsbase_32: 70 ; GLM: # %bb.0: 71 ; GLM-NEXT: rdgsbasel %eax # sched: [100:1.00] 72 ; GLM-NEXT: retq # sched: [4:1.00] 73 ; 74 ; IVY-LABEL: test_x86_rdgsbase_32: 75 ; IVY: # %bb.0: 76 ; IVY-NEXT: rdgsbasel %eax # sched: [100:0.33] 77 ; IVY-NEXT: retq # sched: [1:1.00] 78 ; 79 ; HASWELL-LABEL: test_x86_rdgsbase_32: 80 ; HASWELL: # %bb.0: 81 ; HASWELL-NEXT: rdgsbasel %eax # sched: [100:0.25] 82 ; HASWELL-NEXT: retq # sched: [7:1.00] 83 ; 84 ; SKYLAKE-LABEL: test_x86_rdgsbase_32: 85 ; SKYLAKE: # %bb.0: 86 ; SKYLAKE-NEXT: rdgsbasel %eax # sched: [100:0.25] 87 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 88 ; 89 ; SKX-LABEL: test_x86_rdgsbase_32: 90 ; SKX: # %bb.0: 91 ; SKX-NEXT: rdgsbasel %eax # sched: [100:0.25] 92 ; SKX-NEXT: retq # sched: [7:1.00] 93 ; 94 ; KNL-LABEL: test_x86_rdgsbase_32: 95 ; KNL: # %bb.0: 96 ; KNL-NEXT: rdgsbasel %eax # sched: [100:0.25] 97 ; KNL-NEXT: retq # sched: [7:1.00] 98 ; 99 ; BDVER-LABEL: test_x86_rdgsbase_32: 100 ; BDVER: # %bb.0: 101 ; BDVER-NEXT: rdgsbasel %eax 102 ; BDVER-NEXT: retq 103 ; 104 ; ZNVER1-LABEL: test_x86_rdgsbase_32: 105 ; ZNVER1: # %bb.0: 106 ; ZNVER1-NEXT: rdgsbasel %eax # sched: [100:0.25] 107 ; ZNVER1-NEXT: retq # sched: [1:0.50] 108 %res = call i32 @llvm.x86.rdgsbase.32() 109 ret i32 %res 110 } 111 declare i32 @llvm.x86.rdgsbase.32() nounwind readnone 112 113 define i64 @test_x86_rdfsbase_64() { 114 ; GENERIC-LABEL: test_x86_rdfsbase_64: 115 ; GENERIC: # %bb.0: 116 ; GENERIC-NEXT: rdfsbaseq %rax # sched: [100:0.33] 117 ; GENERIC-NEXT: retq # sched: [1:1.00] 118 ; 119 ; GLM-LABEL: test_x86_rdfsbase_64: 120 ; GLM: # %bb.0: 121 ; GLM-NEXT: rdfsbaseq %rax # sched: [100:1.00] 122 ; GLM-NEXT: retq # sched: [4:1.00] 123 ; 124 ; IVY-LABEL: test_x86_rdfsbase_64: 125 ; IVY: # %bb.0: 126 ; IVY-NEXT: rdfsbaseq %rax # sched: [100:0.33] 127 ; IVY-NEXT: retq # sched: [1:1.00] 128 ; 129 ; HASWELL-LABEL: test_x86_rdfsbase_64: 130 ; HASWELL: # %bb.0: 131 ; HASWELL-NEXT: rdfsbaseq %rax # sched: [100:0.25] 132 ; HASWELL-NEXT: retq # sched: [7:1.00] 133 ; 134 ; SKYLAKE-LABEL: test_x86_rdfsbase_64: 135 ; SKYLAKE: # %bb.0: 136 ; SKYLAKE-NEXT: rdfsbaseq %rax # sched: [100:0.25] 137 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 138 ; 139 ; SKX-LABEL: test_x86_rdfsbase_64: 140 ; SKX: # %bb.0: 141 ; SKX-NEXT: rdfsbaseq %rax # sched: [100:0.25] 142 ; SKX-NEXT: retq # sched: [7:1.00] 143 ; 144 ; KNL-LABEL: test_x86_rdfsbase_64: 145 ; KNL: # %bb.0: 146 ; KNL-NEXT: rdfsbaseq %rax # sched: [100:0.25] 147 ; KNL-NEXT: retq # sched: [7:1.00] 148 ; 149 ; BDVER-LABEL: test_x86_rdfsbase_64: 150 ; BDVER: # %bb.0: 151 ; BDVER-NEXT: rdfsbaseq %rax 152 ; BDVER-NEXT: retq 153 ; 154 ; ZNVER1-LABEL: test_x86_rdfsbase_64: 155 ; ZNVER1: # %bb.0: 156 ; ZNVER1-NEXT: rdfsbaseq %rax # sched: [100:0.25] 157 ; ZNVER1-NEXT: retq # sched: [1:0.50] 158 %res = call i64 @llvm.x86.rdfsbase.64() 159 ret i64 %res 160 } 161 declare i64 @llvm.x86.rdfsbase.64() nounwind readnone 162 163 define i64 @test_x86_rdgsbase_64() { 164 ; GENERIC-LABEL: test_x86_rdgsbase_64: 165 ; GENERIC: # %bb.0: 166 ; GENERIC-NEXT: rdgsbaseq %rax # sched: [100:0.33] 167 ; GENERIC-NEXT: retq # sched: [1:1.00] 168 ; 169 ; GLM-LABEL: test_x86_rdgsbase_64: 170 ; GLM: # %bb.0: 171 ; GLM-NEXT: rdgsbaseq %rax # sched: [100:1.00] 172 ; GLM-NEXT: retq # sched: [4:1.00] 173 ; 174 ; IVY-LABEL: test_x86_rdgsbase_64: 175 ; IVY: # %bb.0: 176 ; IVY-NEXT: rdgsbaseq %rax # sched: [100:0.33] 177 ; IVY-NEXT: retq # sched: [1:1.00] 178 ; 179 ; HASWELL-LABEL: test_x86_rdgsbase_64: 180 ; HASWELL: # %bb.0: 181 ; HASWELL-NEXT: rdgsbaseq %rax # sched: [100:0.25] 182 ; HASWELL-NEXT: retq # sched: [7:1.00] 183 ; 184 ; SKYLAKE-LABEL: test_x86_rdgsbase_64: 185 ; SKYLAKE: # %bb.0: 186 ; SKYLAKE-NEXT: rdgsbaseq %rax # sched: [100:0.25] 187 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 188 ; 189 ; SKX-LABEL: test_x86_rdgsbase_64: 190 ; SKX: # %bb.0: 191 ; SKX-NEXT: rdgsbaseq %rax # sched: [100:0.25] 192 ; SKX-NEXT: retq # sched: [7:1.00] 193 ; 194 ; KNL-LABEL: test_x86_rdgsbase_64: 195 ; KNL: # %bb.0: 196 ; KNL-NEXT: rdgsbaseq %rax # sched: [100:0.25] 197 ; KNL-NEXT: retq # sched: [7:1.00] 198 ; 199 ; BDVER-LABEL: test_x86_rdgsbase_64: 200 ; BDVER: # %bb.0: 201 ; BDVER-NEXT: rdgsbaseq %rax 202 ; BDVER-NEXT: retq 203 ; 204 ; ZNVER1-LABEL: test_x86_rdgsbase_64: 205 ; ZNVER1: # %bb.0: 206 ; ZNVER1-NEXT: rdgsbaseq %rax # sched: [100:0.25] 207 ; ZNVER1-NEXT: retq # sched: [1:0.50] 208 %res = call i64 @llvm.x86.rdgsbase.64() 209 ret i64 %res 210 } 211 declare i64 @llvm.x86.rdgsbase.64() nounwind readnone 212 213 define void @test_x86_wrfsbase_32(i32 %x) { 214 ; GENERIC-LABEL: test_x86_wrfsbase_32: 215 ; GENERIC: # %bb.0: 216 ; GENERIC-NEXT: wrfsbasel %edi # sched: [100:0.33] 217 ; GENERIC-NEXT: retq # sched: [1:1.00] 218 ; 219 ; GLM-LABEL: test_x86_wrfsbase_32: 220 ; GLM: # %bb.0: 221 ; GLM-NEXT: wrfsbasel %edi # sched: [100:1.00] 222 ; GLM-NEXT: retq # sched: [4:1.00] 223 ; 224 ; IVY-LABEL: test_x86_wrfsbase_32: 225 ; IVY: # %bb.0: 226 ; IVY-NEXT: wrfsbasel %edi # sched: [100:0.33] 227 ; IVY-NEXT: retq # sched: [1:1.00] 228 ; 229 ; HASWELL-LABEL: test_x86_wrfsbase_32: 230 ; HASWELL: # %bb.0: 231 ; HASWELL-NEXT: wrfsbasel %edi # sched: [100:0.25] 232 ; HASWELL-NEXT: retq # sched: [7:1.00] 233 ; 234 ; SKYLAKE-LABEL: test_x86_wrfsbase_32: 235 ; SKYLAKE: # %bb.0: 236 ; SKYLAKE-NEXT: wrfsbasel %edi # sched: [100:0.25] 237 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 238 ; 239 ; SKX-LABEL: test_x86_wrfsbase_32: 240 ; SKX: # %bb.0: 241 ; SKX-NEXT: wrfsbasel %edi # sched: [100:0.25] 242 ; SKX-NEXT: retq # sched: [7:1.00] 243 ; 244 ; KNL-LABEL: test_x86_wrfsbase_32: 245 ; KNL: # %bb.0: 246 ; KNL-NEXT: wrfsbasel %edi # sched: [100:0.25] 247 ; KNL-NEXT: retq # sched: [7:1.00] 248 ; 249 ; BDVER-LABEL: test_x86_wrfsbase_32: 250 ; BDVER: # %bb.0: 251 ; BDVER-NEXT: wrfsbasel %edi 252 ; BDVER-NEXT: retq 253 ; 254 ; ZNVER1-LABEL: test_x86_wrfsbase_32: 255 ; ZNVER1: # %bb.0: 256 ; ZNVER1-NEXT: wrfsbasel %edi # sched: [100:0.25] 257 ; ZNVER1-NEXT: retq # sched: [1:0.50] 258 call void @llvm.x86.wrfsbase.32(i32 %x) 259 ret void 260 } 261 declare void @llvm.x86.wrfsbase.32(i32) nounwind readnone 262 263 define void @test_x86_wrgsbase_32(i32 %x) { 264 ; GENERIC-LABEL: test_x86_wrgsbase_32: 265 ; GENERIC: # %bb.0: 266 ; GENERIC-NEXT: wrgsbasel %edi # sched: [100:0.33] 267 ; GENERIC-NEXT: retq # sched: [1:1.00] 268 ; 269 ; GLM-LABEL: test_x86_wrgsbase_32: 270 ; GLM: # %bb.0: 271 ; GLM-NEXT: wrgsbasel %edi # sched: [100:1.00] 272 ; GLM-NEXT: retq # sched: [4:1.00] 273 ; 274 ; IVY-LABEL: test_x86_wrgsbase_32: 275 ; IVY: # %bb.0: 276 ; IVY-NEXT: wrgsbasel %edi # sched: [100:0.33] 277 ; IVY-NEXT: retq # sched: [1:1.00] 278 ; 279 ; HASWELL-LABEL: test_x86_wrgsbase_32: 280 ; HASWELL: # %bb.0: 281 ; HASWELL-NEXT: wrgsbasel %edi # sched: [100:0.25] 282 ; HASWELL-NEXT: retq # sched: [7:1.00] 283 ; 284 ; SKYLAKE-LABEL: test_x86_wrgsbase_32: 285 ; SKYLAKE: # %bb.0: 286 ; SKYLAKE-NEXT: wrgsbasel %edi # sched: [100:0.25] 287 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 288 ; 289 ; SKX-LABEL: test_x86_wrgsbase_32: 290 ; SKX: # %bb.0: 291 ; SKX-NEXT: wrgsbasel %edi # sched: [100:0.25] 292 ; SKX-NEXT: retq # sched: [7:1.00] 293 ; 294 ; KNL-LABEL: test_x86_wrgsbase_32: 295 ; KNL: # %bb.0: 296 ; KNL-NEXT: wrgsbasel %edi # sched: [100:0.25] 297 ; KNL-NEXT: retq # sched: [7:1.00] 298 ; 299 ; BDVER-LABEL: test_x86_wrgsbase_32: 300 ; BDVER: # %bb.0: 301 ; BDVER-NEXT: wrgsbasel %edi 302 ; BDVER-NEXT: retq 303 ; 304 ; ZNVER1-LABEL: test_x86_wrgsbase_32: 305 ; ZNVER1: # %bb.0: 306 ; ZNVER1-NEXT: wrgsbasel %edi # sched: [100:0.25] 307 ; ZNVER1-NEXT: retq # sched: [1:0.50] 308 call void @llvm.x86.wrgsbase.32(i32 %x) 309 ret void 310 } 311 declare void @llvm.x86.wrgsbase.32(i32) nounwind readnone 312 313 define void @test_x86_wrfsbase_64(i64 %x) { 314 ; GENERIC-LABEL: test_x86_wrfsbase_64: 315 ; GENERIC: # %bb.0: 316 ; GENERIC-NEXT: wrfsbaseq %rdi # sched: [100:0.33] 317 ; GENERIC-NEXT: retq # sched: [1:1.00] 318 ; 319 ; GLM-LABEL: test_x86_wrfsbase_64: 320 ; GLM: # %bb.0: 321 ; GLM-NEXT: wrfsbaseq %rdi # sched: [100:1.00] 322 ; GLM-NEXT: retq # sched: [4:1.00] 323 ; 324 ; IVY-LABEL: test_x86_wrfsbase_64: 325 ; IVY: # %bb.0: 326 ; IVY-NEXT: wrfsbaseq %rdi # sched: [100:0.33] 327 ; IVY-NEXT: retq # sched: [1:1.00] 328 ; 329 ; HASWELL-LABEL: test_x86_wrfsbase_64: 330 ; HASWELL: # %bb.0: 331 ; HASWELL-NEXT: wrfsbaseq %rdi # sched: [100:0.25] 332 ; HASWELL-NEXT: retq # sched: [7:1.00] 333 ; 334 ; SKYLAKE-LABEL: test_x86_wrfsbase_64: 335 ; SKYLAKE: # %bb.0: 336 ; SKYLAKE-NEXT: wrfsbaseq %rdi # sched: [100:0.25] 337 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 338 ; 339 ; SKX-LABEL: test_x86_wrfsbase_64: 340 ; SKX: # %bb.0: 341 ; SKX-NEXT: wrfsbaseq %rdi # sched: [100:0.25] 342 ; SKX-NEXT: retq # sched: [7:1.00] 343 ; 344 ; KNL-LABEL: test_x86_wrfsbase_64: 345 ; KNL: # %bb.0: 346 ; KNL-NEXT: wrfsbaseq %rdi # sched: [100:0.25] 347 ; KNL-NEXT: retq # sched: [7:1.00] 348 ; 349 ; BDVER-LABEL: test_x86_wrfsbase_64: 350 ; BDVER: # %bb.0: 351 ; BDVER-NEXT: wrfsbaseq %rdi 352 ; BDVER-NEXT: retq 353 ; 354 ; ZNVER1-LABEL: test_x86_wrfsbase_64: 355 ; ZNVER1: # %bb.0: 356 ; ZNVER1-NEXT: wrfsbaseq %rdi # sched: [100:0.25] 357 ; ZNVER1-NEXT: retq # sched: [1:0.50] 358 call void @llvm.x86.wrfsbase.64(i64 %x) 359 ret void 360 } 361 declare void @llvm.x86.wrfsbase.64(i64) nounwind readnone 362 363 define void @test_x86_wrgsbase_64(i64 %x) { 364 ; GENERIC-LABEL: test_x86_wrgsbase_64: 365 ; GENERIC: # %bb.0: 366 ; GENERIC-NEXT: wrgsbaseq %rdi # sched: [100:0.33] 367 ; GENERIC-NEXT: retq # sched: [1:1.00] 368 ; 369 ; GLM-LABEL: test_x86_wrgsbase_64: 370 ; GLM: # %bb.0: 371 ; GLM-NEXT: wrgsbaseq %rdi # sched: [100:1.00] 372 ; GLM-NEXT: retq # sched: [4:1.00] 373 ; 374 ; IVY-LABEL: test_x86_wrgsbase_64: 375 ; IVY: # %bb.0: 376 ; IVY-NEXT: wrgsbaseq %rdi # sched: [100:0.33] 377 ; IVY-NEXT: retq # sched: [1:1.00] 378 ; 379 ; HASWELL-LABEL: test_x86_wrgsbase_64: 380 ; HASWELL: # %bb.0: 381 ; HASWELL-NEXT: wrgsbaseq %rdi # sched: [100:0.25] 382 ; HASWELL-NEXT: retq # sched: [7:1.00] 383 ; 384 ; SKYLAKE-LABEL: test_x86_wrgsbase_64: 385 ; SKYLAKE: # %bb.0: 386 ; SKYLAKE-NEXT: wrgsbaseq %rdi # sched: [100:0.25] 387 ; SKYLAKE-NEXT: retq # sched: [7:1.00] 388 ; 389 ; SKX-LABEL: test_x86_wrgsbase_64: 390 ; SKX: # %bb.0: 391 ; SKX-NEXT: wrgsbaseq %rdi # sched: [100:0.25] 392 ; SKX-NEXT: retq # sched: [7:1.00] 393 ; 394 ; KNL-LABEL: test_x86_wrgsbase_64: 395 ; KNL: # %bb.0: 396 ; KNL-NEXT: wrgsbaseq %rdi # sched: [100:0.25] 397 ; KNL-NEXT: retq # sched: [7:1.00] 398 ; 399 ; BDVER-LABEL: test_x86_wrgsbase_64: 400 ; BDVER: # %bb.0: 401 ; BDVER-NEXT: wrgsbaseq %rdi 402 ; BDVER-NEXT: retq 403 ; 404 ; ZNVER1-LABEL: test_x86_wrgsbase_64: 405 ; ZNVER1: # %bb.0: 406 ; ZNVER1-NEXT: wrgsbaseq %rdi # sched: [100:0.25] 407 ; ZNVER1-NEXT: retq # sched: [1:0.50] 408 call void @llvm.x86.wrgsbase.64(i64 %x) 409 ret void 410 } 411 declare void @llvm.x86.wrgsbase.64(i64) nounwind readnone 412