xref: /llvm-project/llvm/test/CodeGen/Thumb2/v8_IT_4.ll (revision b5b663aac17415625340eb29c8010832bfc4c21c)
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=thumbv8-eabi -float-abi=hard -arm-restrict-it | FileCheck --check-prefixes=P01 %s
3; RUN: llc < %s -mtriple=thumbv7-eabi -float-abi=hard -arm-restrict-it | FileCheck --check-prefixes=P01 %s
4; RUN: llc < %s -mtriple=thumbv8-eabi -float-abi=hard -regalloc=basic -arm-restrict-it | FileCheck --check-prefixes=P23 %s
5; RUN: llc < %s -mtriple=thumbv7-eabi -float-abi=hard -regalloc=basic -arm-restrict-it | FileCheck --check-prefixes=P23 %s
6
7%"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" = type { ptr }
8%"struct.__gnu_cxx::new_allocator<char>" = type <{ i8 }>
9%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >" = type { %"struct.__gnu_cxx::__normal_iterator<char*,std::basic_string<char, std::char_traits<char>, std::allocator<char> > >" }
10%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep" = type { %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" }
11%"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >::_Rep_base" = type { i32, i32, i32 }
12
13
14define weak arm_aapcs_vfpcc i32 @_ZNKSs7compareERKSs(ptr %this, ptr %__str) {
15; P01-LABEL: _ZNKSs7compareERKSs:
16; P01:       @ %bb.0: @ %entry
17; P01-NEXT:    .save {r4, r5, r6, r7, r8, lr}
18; P01-NEXT:    push.w {r4, r5, r6, r7, r8, lr}
19; P01-NEXT:    mov r8, r1
20; P01-NEXT:    mov r5, r0
21; P01-NEXT:    bl _ZNKSs4sizeEv
22; P01-NEXT:    mov r4, r0
23; P01-NEXT:    mov r0, r8
24; P01-NEXT:    bl _ZNKSs4sizeEv
25; P01-NEXT:    mov r6, r4
26; P01-NEXT:    cmp r4, r0
27; P01-NEXT:    mov r7, r0
28; P01-NEXT:    it hi
29; P01-NEXT:    movhi r6, r0
30; P01-NEXT:    mov r0, r5
31; P01-NEXT:    bl _ZNKSs7_M_dataEv
32; P01-NEXT:    mov r5, r0
33; P01-NEXT:    mov r0, r8
34; P01-NEXT:    bl _ZNKSs4dataEv
35; P01-NEXT:    mov r1, r0
36; P01-NEXT:    mov r0, r5
37; P01-NEXT:    mov r2, r6
38; P01-NEXT:    bl memcmp
39; P01-NEXT:    subs r1, r4, r7
40; P01-NEXT:    cmp r0, #0
41; P01-NEXT:    it eq
42; P01-NEXT:    moveq r0, r1
43; P01-NEXT:    pop.w {r4, r5, r6, r7, r8, pc}
44;
45; P23-LABEL: _ZNKSs7compareERKSs:
46; P23:       @ %bb.0: @ %entry
47; P23-NEXT:    .save {r4, r5, r6, r7, r8, lr}
48; P23-NEXT:    push.w {r4, r5, r6, r7, r8, lr}
49; P23-NEXT:    mov r8, r1
50; P23-NEXT:    mov r7, r0
51; P23-NEXT:    bl _ZNKSs4sizeEv
52; P23-NEXT:    mov r6, r0
53; P23-NEXT:    mov r0, r8
54; P23-NEXT:    bl _ZNKSs4sizeEv
55; P23-NEXT:    mov r4, r6
56; P23-NEXT:    cmp r6, r0
57; P23-NEXT:    mov r5, r0
58; P23-NEXT:    it hi
59; P23-NEXT:    movhi r4, r0
60; P23-NEXT:    mov r0, r7
61; P23-NEXT:    bl _ZNKSs7_M_dataEv
62; P23-NEXT:    mov r7, r0
63; P23-NEXT:    mov r0, r8
64; P23-NEXT:    bl _ZNKSs4dataEv
65; P23-NEXT:    mov r1, r0
66; P23-NEXT:    mov r0, r7
67; P23-NEXT:    mov r2, r4
68; P23-NEXT:    bl memcmp
69; P23-NEXT:    subs r1, r6, r5
70; P23-NEXT:    cmp r0, #0
71; P23-NEXT:    it eq
72; P23-NEXT:    moveq r0, r1
73; P23-NEXT:    pop.w {r4, r5, r6, r7, r8, pc}
74entry:
75  %0 = tail call arm_aapcs_vfpcc  i32 @_ZNKSs4sizeEv(ptr %this) ; <i32> [#uses=3]
76  %1 = tail call arm_aapcs_vfpcc  i32 @_ZNKSs4sizeEv(ptr %__str) ; <i32> [#uses=3]
77  %2 = icmp ult i32 %1, %0                        ; <i1> [#uses=1]
78  %3 = select i1 %2, i32 %1, i32 %0               ; <i32> [#uses=1]
79  %4 = tail call arm_aapcs_vfpcc  ptr @_ZNKSs7_M_dataEv(ptr %this) ; <ptr> [#uses=1]
80  %5 = tail call arm_aapcs_vfpcc  ptr @_ZNKSs4dataEv(ptr %__str) ; <ptr> [#uses=1]
81  %6 = tail call arm_aapcs_vfpcc  i32 @memcmp(ptr %4, ptr %5, i32 %3) nounwind readonly ; <i32> [#uses=2]
82  %7 = icmp eq i32 %6, 0                          ; <i1> [#uses=1]
83  br i1 %7, label %bb, label %bb1
84
85bb:                                               ; preds = %entry
86  %8 = sub i32 %0, %1                             ; <i32> [#uses=1]
87  ret i32 %8
88
89bb1:                                              ; preds = %entry
90  ret i32 %6
91}
92
93declare arm_aapcs_vfpcc i32 @memcmp(ptr nocapture, ptr nocapture, i32) nounwind readonly
94
95declare arm_aapcs_vfpcc i32 @_ZNKSs4sizeEv(ptr %this)
96
97declare arm_aapcs_vfpcc ptr @_ZNKSs7_M_dataEv(ptr %this)
98
99declare arm_aapcs_vfpcc ptr @_ZNKSs4dataEv(ptr %this)
100