| 1 |
; REQUIRES: x86-registered-target |
| 2 |
; RUN: opt < %s -codegenprepare -mtriple=x86_64 -S -o %t |
| 3 |
; RUN: FileCheck %s < %t --check-prefix=IR |
| 4 |
; RUN: llc -mtriple=x86_64-- -stop-after=finalize-isel %t -o - | FileCheck %s --check-prefix=MIR |
| 5 |
|
| 6 |
define internal i32 @arc_compare(i1 %c) { |
| 7 |
entry: |
| 8 |
%0 = load i64, ptr undef, align 8 |
| 9 |
br i1 %c, label %return, label %if.end |
| 10 |
|
| 11 |
if.end: ; preds = %entry |
| 12 |
;; Check pseudo probes are next to each other at the beginning of this block. |
| 13 |
; IR-label: if.end |
| 14 |
; IR: call void @llvm.pseudoprobe(i64 5116412291814990879, i64 1, i32 0, i64 -1) |
| 15 |
; IR: call void @llvm.pseudoprobe(i64 5116412291814990879, i64 3, i32 0, i64 -1) |
| 16 |
call void @llvm.pseudoprobe(i64 5116412291814990879, i64 1, i32 0, i64 -1) |
| 17 |
%1 = load i16, ptr undef, align 8 |
| 18 |
call void @llvm.pseudoprobe(i64 5116412291814990879, i64 3, i32 0, i64 -1) |
| 19 |
%2 = and i16 %1, 16 |
| 20 |
%3 = icmp eq i16 %2, 0 |
| 21 |
;; Check the load-and-cmp sequence is fold into a test instruction. |
| 22 |
; MIR-label: bb.1.if.end |
| 23 |
; MIR: %[[#REG:]]:gr64 = IMPLICIT_DEF |
| 24 |
; MIR: TEST8mi killed %[[#REG]], 1, $noreg, 0, $noreg, 16 |
| 25 |
; MIR: JCC_1 |
| 26 |
br i1 %3, label %return, label %if.end6 |
| 27 |
|
| 28 |
if.end6: ; preds = %if.end |
| 29 |
call void @llvm.pseudoprobe(i64 5116412291814990879, i64 5, i32 0, i64 -1) |
| 30 |
br label %return |
| 31 |
|
| 32 |
return: ; preds = %if.end6, %if.end, %entry |
| 33 |
ret i32 undef |
| 34 |
} |
| 35 |
|
| 36 |
; Function Attrs: inaccessiblememonly nounwind willreturn |
| 37 |
declare void @llvm.pseudoprobe(i64, i64, i32, i64) #0 |
| 38 |
|
| 39 |
attributes #0 = { inaccessiblememonly nounwind willreturn } |