xref: /llvm-project/llvm/test/CodeGen/X86/inlineasm-sched-bug.ll (revision 2e2c61ebd7728b61693d11889b50554e9dc44047)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2; PR13504
3; RUN: llc -mtriple=i686-- -mcpu=atom < %s | FileCheck %s
4; Check that treemap is read before the asm statement.
5
6define i32 @foo(i32 %treemap) nounwind {
7; CHECK-LABEL: foo:
8; CHECK:       # %bb.0: # %entry
9; CHECK-NEXT:    pushl %eax
10; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
11; CHECK-NEXT:    movl %eax, %ecx
12; CHECK-NEXT:    negl %ecx
13; CHECK-NEXT:    andl %eax, %ecx
14; CHECK-NEXT:    movl %ecx, (%esp)
15; CHECK-NEXT:    #APP
16; CHECK-NEXT:    bsfl (%esp), %eax
17; CHECK-NEXT:    #NO_APP
18; CHECK-NEXT:    popl %ecx
19; CHECK-NEXT:    retl
20entry:
21  %sub = sub i32 0, %treemap
22  %and = and i32 %treemap, %sub
23  %0 = call i32 asm "bsfl $1,$0", "=r,rm"(i32 %and)
24  ret i32 %0
25}
26
27