xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/fast-isel-cmp-branch.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=x86_64-linux -asm-verbose=false -verify-machineinstrs < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=x86_64-windows-itanium -asm-verbose=false -verify-machineinstrs < %s | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Fast-isel mustn't add a block to the MBB successor/predecessor list twice.
5*9880d681SAndroid Build Coastguard Worker; The machine verifier will catch and complain about this case.
6*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: baz
7*9880d681SAndroid Build Coastguard Worker; CHECK: retq
8*9880d681SAndroid Build Coastguard Workerdefine void @baz() {
9*9880d681SAndroid Build Coastguard Workerentry:
10*9880d681SAndroid Build Coastguard Worker  br i1 undef, label %exit, label %exit
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Workerexit:
13*9880d681SAndroid Build Coastguard Worker  ret void
14*9880d681SAndroid Build Coastguard Worker}
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; rdar://8337108
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; Fast-isel shouldn't try to look through the compare because it's in a
19*9880d681SAndroid Build Coastguard Worker; different basic block, so its operands aren't necessarily exported
20*9880d681SAndroid Build Coastguard Worker; for cross-block usage.
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; CHECK: movb    %al, [[OFS:[0-9]*]](%rsp)
23*9880d681SAndroid Build Coastguard Worker; CHECK: callq   {{_?}}bar
24*9880d681SAndroid Build Coastguard Worker; CHECK: movb    [[OFS]](%rsp), %al
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerdeclare void @bar()
27*9880d681SAndroid Build Coastguard Worker
28*9880d681SAndroid Build Coastguard Workerdefine void @foo(i32 %a, i32 %b) nounwind personality i32 (...)* @__gxx_personality_v0 {
29*9880d681SAndroid Build Coastguard Workerentry:
30*9880d681SAndroid Build Coastguard Worker  %q = add i32 %a, 7
31*9880d681SAndroid Build Coastguard Worker  %r = add i32 %b, 9
32*9880d681SAndroid Build Coastguard Worker  %t = icmp ult i32 %q, %r
33*9880d681SAndroid Build Coastguard Worker  invoke void @bar() to label %next unwind label %unw
34*9880d681SAndroid Build Coastguard Workernext:
35*9880d681SAndroid Build Coastguard Worker  br i1 %t, label %true, label %return
36*9880d681SAndroid Build Coastguard Workertrue:
37*9880d681SAndroid Build Coastguard Worker  call void @bar()
38*9880d681SAndroid Build Coastguard Worker  br label %return
39*9880d681SAndroid Build Coastguard Workerreturn:
40*9880d681SAndroid Build Coastguard Worker  ret void
41*9880d681SAndroid Build Coastguard Workerunw:
42*9880d681SAndroid Build Coastguard Worker  %exn = landingpad {i8*, i32}
43*9880d681SAndroid Build Coastguard Worker            cleanup
44*9880d681SAndroid Build Coastguard Worker  unreachable
45*9880d681SAndroid Build Coastguard Worker}
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Workerdeclare i32 @__gxx_personality_v0(...)
48