xref: /llvm-project/llvm/test/CodeGen/X86/pr15705.ll (revision 4ab3041acbdc274050d6c53f72619c7455cbc97a)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
4
5define i32 @PR15705(i32 %x, i32 %a, i32 %b, i32 %c) #0 {
6; X86-LABEL: PR15705:
7; X86:       # %bb.0: # %entry
8; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
9; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
10; X86-NEXT:    movl {{[0-9]+}}(%esp), %edx
11; X86-NEXT:    cmpl %ecx, %edx
12; X86-NEXT:    je .LBB0_4
13; X86-NEXT:  # %bb.1: # %if.end
14; X86-NEXT:    cmpl %eax, %edx
15; X86-NEXT:    jne .LBB0_3
16; X86-NEXT:  # %bb.2:
17; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
18; X86-NEXT:  .LBB0_3: # %if.end
19; X86-NEXT:    movl %ecx, %eax
20; X86-NEXT:  .LBB0_4: # %return
21; X86-NEXT:    retl
22;
23; X64-LABEL: PR15705:
24; X64:       # %bb.0: # %entry
25; X64-NEXT:    movl %edx, %eax
26; X64-NEXT:    cmpl %esi, %edi
27; X64-NEXT:    je .LBB0_2
28; X64-NEXT:  # %bb.1: # %if.end
29; X64-NEXT:    cmpl %eax, %edi
30; X64-NEXT:    cmovel %ecx, %esi
31; X64-NEXT:    movl %esi, %eax
32; X64-NEXT:  .LBB0_2: # %return
33; X64-NEXT:    retq
34entry:
35  %cmp = icmp eq i32 %x, %a
36  br i1 %cmp, label %return, label %if.end
37
38if.end:
39  %cmp1 = icmp eq i32 %x, %b
40  %c.a = select i1 %cmp1, i32 %c, i32 %a
41  br label %return
42
43return:
44  %retval.0 = phi i32 [ %b, %entry ], [ %c.a, %if.end ]
45  ret i32 %retval.0
46}
47
48attributes #0 = { nounwind readnone ssp "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
49