xref: /llvm-project/llvm/test/CodeGen/X86/memcmp-mergeexpand.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
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
5; This tests interaction between MergeICmp and ExpandMemCmp.
6
7%"struct.std::pair" = type { i32, i32 }
8
9define zeroext i1 @opeq1(
10; X86-LABEL: opeq1:
11; X86:       # %bb.0: # %"entry+land.rhs.i"
12; X86-NEXT:    movl {{[0-9]+}}(%esp), %eax
13; X86-NEXT:    movl {{[0-9]+}}(%esp), %ecx
14; X86-NEXT:    movl (%ecx), %edx
15; X86-NEXT:    movl 4(%ecx), %ecx
16; X86-NEXT:    xorl (%eax), %edx
17; X86-NEXT:    xorl 4(%eax), %ecx
18; X86-NEXT:    orl %edx, %ecx
19; X86-NEXT:    sete %al
20; X86-NEXT:    retl
21;
22; X64-LABEL: opeq1:
23; X64:       # %bb.0: # %"entry+land.rhs.i"
24; X64-NEXT:    movq (%rdi), %rax
25; X64-NEXT:    cmpq (%rsi), %rax
26; X64-NEXT:    sete %al
27; X64-NEXT:    retq
28  ptr nocapture readonly dereferenceable(8) %a,
29  ptr nocapture readonly dereferenceable(8) %b) local_unnamed_addr nofree nosync {
30entry:
31  %0 = load i32, ptr %a, align 4
32  %1 = load i32, ptr %b, align 4
33  %cmp.i = icmp eq i32 %0, %1
34  br i1 %cmp.i, label %land.rhs.i, label %opeq1.exit
35
36land.rhs.i:
37  %second.i = getelementptr inbounds %"struct.std::pair", ptr %a, i64 0, i32 1
38  %2 = load i32, ptr %second.i, align 4
39  %second2.i = getelementptr inbounds %"struct.std::pair", ptr %b, i64 0, i32 1
40  %3 = load i32, ptr %second2.i, align 4
41  %cmp3.i = icmp eq i32 %2, %3
42  br label %opeq1.exit
43
44opeq1.exit:
45  %4 = phi i1 [ false, %entry ], [ %cmp3.i, %land.rhs.i ]
46  ret i1 %4
47}
48
49
50