| OLD | NEW |
| 1 ; This tests the NaCl intrinsics memset, memcpy and memmove. | 1 ; This tests the NaCl intrinsics memset, memcpy and memmove. |
| 2 | 2 |
| 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 3 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 4 ; RUN: --target x8632 --sandbox -i %s --args -O2 \ | 4 ; RUN: --target x8632 --sandbox -i %s --args -O2 \ |
| 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 5 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 6 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 7 ; RUN: --target x8632 --sandbox -i %s --args -Om1 --fmem-intrin-opt \ | 7 ; RUN: --target x8632 --sandbox -i %s --args -Om1 --fmem-intrin-opt \ |
| 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 8 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
| 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
| 10 ; RUN: --target x8632 --sandbox -i %s --args -Om1 \ | 10 ; RUN: --target x8632 --sandbox -i %s --args -Om1 \ |
| 11 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix OM1 %s | 11 ; RUN: | %if --need=target_X8632 --command FileCheck --check-prefix OM1 %s |
| 12 | 12 |
| 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ | 13 ; RUN: %if --need=target_ARM32 --need=allow_dump \ |
| 14 ; RUN: --command %p2i --filetype=obj --assemble --disassemble --target arm32 \ | 14 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target arm32 \ |
| 15 ; RUN: -i %s --args -O2 \ | 15 ; RUN: -i %s --args -O2 --skip-unimplemented \ |
| 16 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ | 16 ; RUN: | %if --need=target_ARM32 --need=allow_dump \ |
| 17 ; RUN: --command FileCheck --check-prefix ARM32 %s | 17 ; RUN: --command FileCheck --check-prefix ARM32 %s |
| 18 | 18 |
| 19 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) | 19 declare void @llvm.memcpy.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) |
| 20 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) | 20 declare void @llvm.memmove.p0i8.p0i8.i32(i8*, i8*, i32, i32, i1) |
| 21 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) | 21 declare void @llvm.memset.p0i8.i32(i8*, i8, i32, i32, i1) |
| 22 | 22 |
| 23 define internal void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { | 23 define internal void @test_memcpy(i32 %iptr_dst, i32 %iptr_src, i32 %len) { |
| 24 entry: | 24 entry: |
| 25 %dst = inttoptr i32 %iptr_dst to i8* | 25 %dst = inttoptr i32 %iptr_dst to i8* |
| 26 %src = inttoptr i32 %iptr_src to i8* | 26 %src = inttoptr i32 %iptr_src to i8* |
| 27 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 27 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 28 i32 %len, i32 1, i1 false) | 28 i32 %len, i32 1, i1 false) |
| 29 ret void | 29 ret void |
| 30 } | 30 } |
| 31 ; CHECK-LABEL: test_memcpy | 31 ; CHECK-LABEL: test_memcpy |
| 32 ; CHECK: call {{.*}} R_{{.*}} memcpy | 32 ; CHECK: call {{.*}} R_{{.*}} memcpy |
| 33 ; OM1-LABEL: test_memcpy | 33 ; OM1-LABEL: test_memcpy |
| 34 ; OM1: call {{.*}} memcpy | 34 ; OM1: call {{.*}} memcpy |
| 35 ; ARM32-LABEL: test_memcpy | 35 ; ARM32-LABEL: test_memcpy |
| 36 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 36 ; ARM32: bl {{.*}} memcpy |
| 37 ; ARM32: movt [[CALL]] | |
| 38 ; ARM32: blx [[CALL]] | |
| 39 | 37 |
| 40 define internal void @test_memcpy_long_const_len(i32 %iptr_dst, i32 %iptr_src) { | 38 define internal void @test_memcpy_long_const_len(i32 %iptr_dst, i32 %iptr_src) { |
| 41 entry: | 39 entry: |
| 42 %dst = inttoptr i32 %iptr_dst to i8* | 40 %dst = inttoptr i32 %iptr_dst to i8* |
| 43 %src = inttoptr i32 %iptr_src to i8* | 41 %src = inttoptr i32 %iptr_src to i8* |
| 44 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 42 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 45 i32 4876, i32 1, i1 false) | 43 i32 4876, i32 1, i1 false) |
| 46 ret void | 44 ret void |
| 47 } | 45 } |
| 48 ; CHECK-LABEL: test_memcpy_long_const_len | 46 ; CHECK-LABEL: test_memcpy_long_const_len |
| 49 ; CHECK: call {{.*}} R_{{.*}} memcpy | 47 ; CHECK: call {{.*}} R_{{.*}} memcpy |
| 50 ; OM1-LABEL: test_memcpy_long_const_len | 48 ; OM1-LABEL: test_memcpy_long_const_len |
| 51 ; OM1: call {{.*}} memcpy | 49 ; OM1: call {{.*}} memcpy |
| 52 ; ARM32-LABEL: test_memcpy_long_const_len | 50 ; ARM32-LABEL: test_memcpy_long_const_len |
| 53 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 51 ; ARM32: bl {{.*}} memcpy |
| 54 ; ARM32: movt [[CALL]] | |
| 55 ; ARM32: blx [[CALL]] | |
| 56 | 52 |
| 57 define internal void @test_memcpy_very_small_const_len(i32 %iptr_dst, | 53 define internal void @test_memcpy_very_small_const_len(i32 %iptr_dst, |
| 58 i32 %iptr_src) { | 54 i32 %iptr_src) { |
| 59 entry: | 55 entry: |
| 60 %dst = inttoptr i32 %iptr_dst to i8* | 56 %dst = inttoptr i32 %iptr_dst to i8* |
| 61 %src = inttoptr i32 %iptr_src to i8* | 57 %src = inttoptr i32 %iptr_src to i8* |
| 62 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 58 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 63 i32 2, i32 1, i1 false) | 59 i32 2, i32 1, i1 false) |
| 64 ret void | 60 ret void |
| 65 } | 61 } |
| 66 ; CHECK-LABEL: test_memcpy_very_small_const_len | 62 ; CHECK-LABEL: test_memcpy_very_small_const_len |
| 67 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] | 63 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] |
| 68 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] | 64 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] |
| 69 ; CHECK-NOT: mov | 65 ; CHECK-NOT: mov |
| 70 ; OM1-LABEL: test_memcpy_very_small_const_len | 66 ; OM1-LABEL: test_memcpy_very_small_const_len |
| 71 ; OM1: call {{.*}} memcpy | 67 ; OM1: call {{.*}} memcpy |
| 72 ; ARM32-LABEL: test_memcpy_very_small_const_len | 68 ; ARM32-LABEL: test_memcpy_very_small_const_len |
| 73 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 69 ; ARM32: bl {{.*}} memcpy |
| 74 ; ARM32: movt [[CALL]] | |
| 75 ; ARM32: blx [[CALL]] | |
| 76 | 70 |
| 77 define internal void @test_memcpy_const_len_3(i32 %iptr_dst, i32 %iptr_src) { | 71 define internal void @test_memcpy_const_len_3(i32 %iptr_dst, i32 %iptr_src) { |
| 78 entry: | 72 entry: |
| 79 %dst = inttoptr i32 %iptr_dst to i8* | 73 %dst = inttoptr i32 %iptr_dst to i8* |
| 80 %src = inttoptr i32 %iptr_src to i8* | 74 %src = inttoptr i32 %iptr_src to i8* |
| 81 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 75 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 82 i32 3, i32 1, i1 false) | 76 i32 3, i32 1, i1 false) |
| 83 ret void | 77 ret void |
| 84 } | 78 } |
| 85 ; CHECK-LABEL: test_memcpy_const_len_3 | 79 ; CHECK-LABEL: test_memcpy_const_len_3 |
| 86 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] | 80 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] |
| 87 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] | 81 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] |
| 88 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x2] | 82 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x2] |
| 89 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG]] | 83 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG]] |
| 90 ; CHECK-NOT: mov | 84 ; CHECK-NOT: mov |
| 91 ; OM1-LABEL: test_memcpy_const_len_3 | 85 ; OM1-LABEL: test_memcpy_const_len_3 |
| 92 ; OM1: call {{.*}} memcpy | 86 ; OM1: call {{.*}} memcpy |
| 93 ; ARM32-LABEL: test_memcpy_const_len_3 | 87 ; ARM32-LABEL: test_memcpy_const_len_3 |
| 94 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 88 ; ARM32: bl {{.*}} memcpy |
| 95 ; ARM32: movt [[CALL]] | |
| 96 ; ARM32: blx [[CALL]] | |
| 97 | 89 |
| 98 define internal void @test_memcpy_mid_const_len(i32 %iptr_dst, i32 %iptr_src) { | 90 define internal void @test_memcpy_mid_const_len(i32 %iptr_dst, i32 %iptr_src) { |
| 99 entry: | 91 entry: |
| 100 %dst = inttoptr i32 %iptr_dst to i8* | 92 %dst = inttoptr i32 %iptr_dst to i8* |
| 101 %src = inttoptr i32 %iptr_src to i8* | 93 %src = inttoptr i32 %iptr_src to i8* |
| 102 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 94 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 103 i32 9, i32 1, i1 false) | 95 i32 9, i32 1, i1 false) |
| 104 ret void | 96 ret void |
| 105 } | 97 } |
| 106 ; CHECK-LABEL: test_memcpy_mid_const_len | 98 ; CHECK-LABEL: test_memcpy_mid_const_len |
| 107 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}] | 99 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}] |
| 108 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]] | 100 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]] |
| 109 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x8] | 101 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x8] |
| 110 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG]] | 102 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG]] |
| 111 ; CHECK-NOT: mov | 103 ; CHECK-NOT: mov |
| 112 ; OM1-LABEL: test_memcpy_mid_const_len | 104 ; OM1-LABEL: test_memcpy_mid_const_len |
| 113 ; OM1: call {{.*}} memcpy | 105 ; OM1: call {{.*}} memcpy |
| 114 ; ARM32-LABEL: test_memcpy_mid_const_len | 106 ; ARM32-LABEL: test_memcpy_mid_const_len |
| 115 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 107 ; ARM32: bl {{.*}} memcpy |
| 116 ; ARM32: movt [[CALL]] | |
| 117 ; ARM32: blx [[CALL]] | |
| 118 | 108 |
| 119 define internal void @test_memcpy_mid_const_len_overlap(i32 %iptr_dst, | 109 define internal void @test_memcpy_mid_const_len_overlap(i32 %iptr_dst, |
| 120 i32 %iptr_src) { | 110 i32 %iptr_src) { |
| 121 entry: | 111 entry: |
| 122 %dst = inttoptr i32 %iptr_dst to i8* | 112 %dst = inttoptr i32 %iptr_dst to i8* |
| 123 %src = inttoptr i32 %iptr_src to i8* | 113 %src = inttoptr i32 %iptr_src to i8* |
| 124 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 114 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 125 i32 15, i32 1, i1 false) | 115 i32 15, i32 1, i1 false) |
| 126 ret void | 116 ret void |
| 127 } | 117 } |
| 128 ; CHECK-LABEL: test_memcpy_mid_const_len_overlap | 118 ; CHECK-LABEL: test_memcpy_mid_const_len_overlap |
| 129 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}] | 119 ; CHECK: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}] |
| 130 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]] | 120 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG]] |
| 131 ; CHECK-NEXT: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7] | 121 ; CHECK-NEXT: movq [[REG:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7] |
| 132 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG]] | 122 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG]] |
| 133 ; CHECK-NOT: mov | 123 ; CHECK-NOT: mov |
| 134 ; OM1-LABEL: test_memcpy_mid_const_len_overlap | 124 ; OM1-LABEL: test_memcpy_mid_const_len_overlap |
| 135 ; OM1: call {{.*}} memcpy | 125 ; OM1: call {{.*}} memcpy |
| 136 ; ARM32-LABEL: test_memcpy_mid_const_len_overlap | 126 ; ARM32-LABEL: test_memcpy_mid_const_len_overlap |
| 137 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 127 ; ARM32: bl {{.*}} memcpy |
| 138 ; ARM32: movt [[CALL]] | |
| 139 ; ARM32: blx [[CALL]] | |
| 140 | 128 |
| 141 define internal void @test_memcpy_big_const_len_overlap(i32 %iptr_dst, | 129 define internal void @test_memcpy_big_const_len_overlap(i32 %iptr_dst, |
| 142 i32 %iptr_src) { | 130 i32 %iptr_src) { |
| 143 entry: | 131 entry: |
| 144 %dst = inttoptr i32 %iptr_dst to i8* | 132 %dst = inttoptr i32 %iptr_dst to i8* |
| 145 %src = inttoptr i32 %iptr_src to i8* | 133 %src = inttoptr i32 %iptr_src to i8* |
| 146 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 134 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 147 i32 30, i32 1, i1 false) | 135 i32 30, i32 1, i1 false) |
| 148 ret void | 136 ret void |
| 149 } | 137 } |
| 150 ; CHECK-LABEL: test_memcpy_big_const_len_overlap | 138 ; CHECK-LABEL: test_memcpy_big_const_len_overlap |
| 151 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}] | 139 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}] |
| 152 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]] | 140 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]] |
| 153 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe] | 141 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe] |
| 154 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG]] | 142 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG]] |
| 155 ; CHECK-NOT: mov | 143 ; CHECK-NOT: mov |
| 156 ; OM1-LABEL: test_memcpy_big_const_len_overlap | 144 ; OM1-LABEL: test_memcpy_big_const_len_overlap |
| 157 ; OM1: call {{.*}} memcpy | 145 ; OM1: call {{.*}} memcpy |
| 158 ; ARM32-LABEL: test_memcpy_big_const_len_overlap | 146 ; ARM32-LABEL: test_memcpy_big_const_len_overlap |
| 159 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 147 ; ARM32: bl {{.*}} memcpy |
| 160 ; ARM32: movt [[CALL]] | |
| 161 ; ARM32: blx [[CALL]] | |
| 162 | 148 |
| 163 define internal void @test_memcpy_large_const_len(i32 %iptr_dst, | 149 define internal void @test_memcpy_large_const_len(i32 %iptr_dst, |
| 164 i32 %iptr_src) { | 150 i32 %iptr_src) { |
| 165 entry: | 151 entry: |
| 166 %dst = inttoptr i32 %iptr_dst to i8* | 152 %dst = inttoptr i32 %iptr_dst to i8* |
| 167 %src = inttoptr i32 %iptr_src to i8* | 153 %src = inttoptr i32 %iptr_src to i8* |
| 168 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, | 154 call void @llvm.memcpy.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 169 i32 33, i32 1, i1 false) | 155 i32 33, i32 1, i1 false) |
| 170 ret void | 156 ret void |
| 171 } | 157 } |
| 172 ; CHECK-LABEL: test_memcpy_large_const_len | 158 ; CHECK-LABEL: test_memcpy_large_const_len |
| 173 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10] | 159 ; CHECK: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10] |
| 174 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG]] | 160 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG]] |
| 175 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}] | 161 ; CHECK-NEXT: movups [[REG:xmm[0-9]+]],XMMWORD PTR [{{.*}}] |
| 176 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]] | 162 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG]] |
| 177 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x20] | 163 ; CHECK-NEXT: mov [[REG:[^,]*]],BYTE PTR [{{.*}}+0x20] |
| 178 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG]] | 164 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG]] |
| 179 ; CHECK-NOT: mov | 165 ; CHECK-NOT: mov |
| 180 ; OM1-LABEL: test_memcpy_large_const_len | 166 ; OM1-LABEL: test_memcpy_large_const_len |
| 181 ; OM1: call {{.*}} memcpy | 167 ; OM1: call {{.*}} memcpy |
| 182 ; ARM32-LABEL: test_memcpy_large_const_len | 168 ; ARM32-LABEL: test_memcpy_large_const_len |
| 183 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memcpy | 169 ; ARM32: bl {{.*}} memcpy |
| 184 ; ARM32: movt [[CALL]] | |
| 185 ; ARM32: blx [[CALL]] | |
| 186 | 170 |
| 187 define internal void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) { | 171 define internal void @test_memmove(i32 %iptr_dst, i32 %iptr_src, i32 %len) { |
| 188 entry: | 172 entry: |
| 189 %dst = inttoptr i32 %iptr_dst to i8* | 173 %dst = inttoptr i32 %iptr_dst to i8* |
| 190 %src = inttoptr i32 %iptr_src to i8* | 174 %src = inttoptr i32 %iptr_src to i8* |
| 191 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 175 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 192 i32 %len, i32 1, i1 false) | 176 i32 %len, i32 1, i1 false) |
| 193 ret void | 177 ret void |
| 194 } | 178 } |
| 195 ; CHECK-LABEL: test_memmove | 179 ; CHECK-LABEL: test_memmove |
| 196 ; CHECK: call {{.*}} R_{{.*}} memmove | 180 ; CHECK: call {{.*}} R_{{.*}} memmove |
| 197 ; OM1-LABEL: test_memmove | 181 ; OM1-LABEL: test_memmove |
| 198 ; OM1: call {{.*}} memmove | 182 ; OM1: call {{.*}} memmove |
| 199 ; ARM32-LABEL: test_memmove | 183 ; ARM32-LABEL: test_memmove |
| 200 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 184 ; ARM32: bl {{.*}} memmove |
| 201 ; ARM32: movt [[CALL]] | |
| 202 ; ARM32: blx [[CALL]] | |
| 203 | 185 |
| 204 define internal void @test_memmove_long_const_len(i32 %iptr_dst, | 186 define internal void @test_memmove_long_const_len(i32 %iptr_dst, |
| 205 i32 %iptr_src) { | 187 i32 %iptr_src) { |
| 206 entry: | 188 entry: |
| 207 %dst = inttoptr i32 %iptr_dst to i8* | 189 %dst = inttoptr i32 %iptr_dst to i8* |
| 208 %src = inttoptr i32 %iptr_src to i8* | 190 %src = inttoptr i32 %iptr_src to i8* |
| 209 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 191 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 210 i32 4876, i32 1, i1 false) | 192 i32 4876, i32 1, i1 false) |
| 211 ret void | 193 ret void |
| 212 } | 194 } |
| 213 ; CHECK-LABEL: test_memmove_long_const_len | 195 ; CHECK-LABEL: test_memmove_long_const_len |
| 214 ; CHECK: call {{.*}} R_{{.*}} memmove | 196 ; CHECK: call {{.*}} R_{{.*}} memmove |
| 215 ; OM1-LABEL: test_memmove_long_const_len | 197 ; OM1-LABEL: test_memmove_long_const_len |
| 216 ; OM1: call {{.*}} memmove | 198 ; OM1: call {{.*}} memmove |
| 217 ; ARM32-LABEL: test_memmove_long_const_len | 199 ; ARM32-LABEL: test_memmove_long_const_len |
| 218 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 200 ; ARM32: bl {{.*}} memmove |
| 219 ; ARM32: movt [[CALL]] | |
| 220 ; ARM32: blx [[CALL]] | |
| 221 | 201 |
| 222 define internal void @test_memmove_very_small_const_len(i32 %iptr_dst, | 202 define internal void @test_memmove_very_small_const_len(i32 %iptr_dst, |
| 223 i32 %iptr_src) { | 203 i32 %iptr_src) { |
| 224 entry: | 204 entry: |
| 225 %dst = inttoptr i32 %iptr_dst to i8* | 205 %dst = inttoptr i32 %iptr_dst to i8* |
| 226 %src = inttoptr i32 %iptr_src to i8* | 206 %src = inttoptr i32 %iptr_src to i8* |
| 227 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 207 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 228 i32 2, i32 1, i1 false) | 208 i32 2, i32 1, i1 false) |
| 229 ret void | 209 ret void |
| 230 } | 210 } |
| 231 ; CHECK-LABEL: test_memmove_very_small_const_len | 211 ; CHECK-LABEL: test_memmove_very_small_const_len |
| 232 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] | 212 ; CHECK: mov [[REG:[^,]*]],WORD PTR [{{.*}}] |
| 233 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] | 213 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG]] |
| 234 ; CHECK-NOT: mov | 214 ; CHECK-NOT: mov |
| 235 ; OM1-LABEL: test_memmove_very_small_const_len | 215 ; OM1-LABEL: test_memmove_very_small_const_len |
| 236 ; OM1: call {{.*}} memmove | 216 ; OM1: call {{.*}} memmove |
| 237 ; ARM32-LABEL: test_memmove_very_small_const_len | 217 ; ARM32-LABEL: test_memmove_very_small_const_len |
| 238 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 218 ; ARM32: bl {{.*}} memmove |
| 239 ; ARM32: movt [[CALL]] | |
| 240 ; ARM32: blx [[CALL]] | |
| 241 | 219 |
| 242 define internal void @test_memmove_const_len_3(i32 %iptr_dst, i32 %iptr_src) { | 220 define internal void @test_memmove_const_len_3(i32 %iptr_dst, i32 %iptr_src) { |
| 243 entry: | 221 entry: |
| 244 %dst = inttoptr i32 %iptr_dst to i8* | 222 %dst = inttoptr i32 %iptr_dst to i8* |
| 245 %src = inttoptr i32 %iptr_src to i8* | 223 %src = inttoptr i32 %iptr_src to i8* |
| 246 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 224 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 247 i32 3, i32 1, i1 false) | 225 i32 3, i32 1, i1 false) |
| 248 ret void | 226 ret void |
| 249 } | 227 } |
| 250 ; CHECK-LABEL: test_memmove_const_len_3 | 228 ; CHECK-LABEL: test_memmove_const_len_3 |
| 251 ; CHECK: mov [[REG0:[^,]*]],WORD PTR [{{.*}}] | 229 ; CHECK: mov [[REG0:[^,]*]],WORD PTR [{{.*}}] |
| 252 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x2] | 230 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x2] |
| 253 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG0]] | 231 ; CHECK-NEXT: mov WORD PTR [{{.*}}],[[REG0]] |
| 254 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG1]] | 232 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],[[REG1]] |
| 255 ; CHECK-NOT: mov | 233 ; CHECK-NOT: mov |
| 256 ; OM1-LABEL: test_memmove_const_len_3 | 234 ; OM1-LABEL: test_memmove_const_len_3 |
| 257 ; OM1: call {{.*}} memmove | 235 ; OM1: call {{.*}} memmove |
| 258 ; ARM32-LABEL: test_memmove_const_len_3 | 236 ; ARM32-LABEL: test_memmove_const_len_3 |
| 259 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 237 ; ARM32: bl {{.*}} memmove |
| 260 ; ARM32: movt [[CALL]] | |
| 261 ; ARM32: blx [[CALL]] | |
| 262 | 238 |
| 263 define internal void @test_memmove_mid_const_len(i32 %iptr_dst, i32 %iptr_src) { | 239 define internal void @test_memmove_mid_const_len(i32 %iptr_dst, i32 %iptr_src) { |
| 264 entry: | 240 entry: |
| 265 %dst = inttoptr i32 %iptr_dst to i8* | 241 %dst = inttoptr i32 %iptr_dst to i8* |
| 266 %src = inttoptr i32 %iptr_src to i8* | 242 %src = inttoptr i32 %iptr_src to i8* |
| 267 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 243 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 268 i32 9, i32 1, i1 false) | 244 i32 9, i32 1, i1 false) |
| 269 ret void | 245 ret void |
| 270 } | 246 } |
| 271 ; CHECK-LABEL: test_memmove_mid_const_len | 247 ; CHECK-LABEL: test_memmove_mid_const_len |
| 272 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}] | 248 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}] |
| 273 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x8] | 249 ; CHECK-NEXT: mov [[REG1:[^,]*]],BYTE PTR [{{.*}}+0x8] |
| 274 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]] | 250 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]] |
| 275 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG1]] | 251 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],[[REG1]] |
| 276 ; CHECK-NOT: mov | 252 ; CHECK-NOT: mov |
| 277 ; OM1-LABEL: test_memmove_mid_const_len | 253 ; OM1-LABEL: test_memmove_mid_const_len |
| 278 ; OM1: call {{.*}} memmove | 254 ; OM1: call {{.*}} memmove |
| 279 ; ARM32-LABEL: test_memmove_mid_const_len | 255 ; ARM32-LABEL: test_memmove_mid_const_len |
| 280 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 256 ; ARM32: bl {{.*}} memmove |
| 281 ; ARM32: movt [[CALL]] | |
| 282 ; ARM32: blx [[CALL]] | |
| 283 | 257 |
| 284 define internal void @test_memmove_mid_const_len_overlap(i32 %iptr_dst, | 258 define internal void @test_memmove_mid_const_len_overlap(i32 %iptr_dst, |
| 285 i32 %iptr_src) { | 259 i32 %iptr_src) { |
| 286 entry: | 260 entry: |
| 287 %dst = inttoptr i32 %iptr_dst to i8* | 261 %dst = inttoptr i32 %iptr_dst to i8* |
| 288 %src = inttoptr i32 %iptr_src to i8* | 262 %src = inttoptr i32 %iptr_src to i8* |
| 289 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 263 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 290 i32 15, i32 1, i1 false) | 264 i32 15, i32 1, i1 false) |
| 291 ret void | 265 ret void |
| 292 } | 266 } |
| 293 ; CHECK-LABEL: test_memmove_mid_const_len_overlap | 267 ; CHECK-LABEL: test_memmove_mid_const_len_overlap |
| 294 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}] | 268 ; CHECK: movq [[REG0:xmm[0-9]+]],QWORD PTR [{{.*}}] |
| 295 ; CHECK-NEXT: movq [[REG1:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7] | 269 ; CHECK-NEXT: movq [[REG1:xmm[0-9]+]],QWORD PTR [{{.*}}+0x7] |
| 296 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]] | 270 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[REG0]] |
| 297 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG1]] | 271 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[REG1]] |
| 298 ; CHECK-NOT: mov | 272 ; CHECK-NOT: mov |
| 299 ; OM1-LABEL: test_memmove_mid_const_len_overlap | 273 ; OM1-LABEL: test_memmove_mid_const_len_overlap |
| 300 ; OM1: call {{.*}} memmove | 274 ; OM1: call {{.*}} memmove |
| 301 ; ARM32-LABEL: test_memmove_mid_const_len_overlap | 275 ; ARM32-LABEL: test_memmove_mid_const_len_overlap |
| 302 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 276 ; ARM32: bl {{.*}} memmove |
| 303 ; ARM32: movt [[CALL]] | |
| 304 ; ARM32: blx [[CALL]] | |
| 305 | 277 |
| 306 define internal void @test_memmove_big_const_len_overlap(i32 %iptr_dst, | 278 define internal void @test_memmove_big_const_len_overlap(i32 %iptr_dst, |
| 307 i32 %iptr_src) { | 279 i32 %iptr_src) { |
| 308 entry: | 280 entry: |
| 309 %dst = inttoptr i32 %iptr_dst to i8* | 281 %dst = inttoptr i32 %iptr_dst to i8* |
| 310 %src = inttoptr i32 %iptr_src to i8* | 282 %src = inttoptr i32 %iptr_src to i8* |
| 311 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 283 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 312 i32 30, i32 1, i1 false) | 284 i32 30, i32 1, i1 false) |
| 313 ret void | 285 ret void |
| 314 } | 286 } |
| 315 ; CHECK-LABEL: test_memmove_big_const_len_overlap | 287 ; CHECK-LABEL: test_memmove_big_const_len_overlap |
| 316 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}] | 288 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}] |
| 317 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe] | 289 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0xe] |
| 318 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG0]] | 290 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG0]] |
| 319 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG1]] | 291 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[REG1]] |
| 320 ; CHECK-NOT: mov | 292 ; CHECK-NOT: mov |
| 321 ; OM1-LABEL: test_memmove_big_const_len_overlap | 293 ; OM1-LABEL: test_memmove_big_const_len_overlap |
| 322 ; OM1: call {{.*}} memmove | 294 ; OM1: call {{.*}} memmove |
| 323 ; ARM32-LABEL: test_memmove_big_const_len_overlap | 295 ; ARM32-LABEL: test_memmove_big_const_len_overlap |
| 324 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 296 ; ARM32: bl {{.*}} memmove |
| 325 ; ARM32: movt [[CALL]] | |
| 326 ; ARM32: blx [[CALL]] | |
| 327 | 297 |
| 328 define internal void @test_memmove_large_const_len(i32 %iptr_dst, | 298 define internal void @test_memmove_large_const_len(i32 %iptr_dst, |
| 329 i32 %iptr_src) { | 299 i32 %iptr_src) { |
| 330 entry: | 300 entry: |
| 331 %dst = inttoptr i32 %iptr_dst to i8* | 301 %dst = inttoptr i32 %iptr_dst to i8* |
| 332 %src = inttoptr i32 %iptr_src to i8* | 302 %src = inttoptr i32 %iptr_src to i8* |
| 333 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, | 303 call void @llvm.memmove.p0i8.p0i8.i32(i8* %dst, i8* %src, |
| 334 i32 33, i32 1, i1 false) | 304 i32 33, i32 1, i1 false) |
| 335 ret void | 305 ret void |
| 336 } | 306 } |
| 337 ; CHECK-LABEL: test_memmove_large_const_len | 307 ; CHECK-LABEL: test_memmove_large_const_len |
| 338 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10] | 308 ; CHECK: movups [[REG0:xmm[0-9]+]],XMMWORD PTR [{{.*}}+0x10] |
| 339 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}] | 309 ; CHECK-NEXT: movups [[REG1:xmm[0-9]+]],XMMWORD PTR [{{.*}}] |
| 340 ; CHECK-NEXT: mov [[REG2:[^,]*]],BYTE PTR [{{.*}}+0x20] | 310 ; CHECK-NEXT: mov [[REG2:[^,]*]],BYTE PTR [{{.*}}+0x20] |
| 341 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG0]] | 311 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[REG0]] |
| 342 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG1]] | 312 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[REG1]] |
| 343 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG2]] | 313 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],[[REG2]] |
| 344 ; CHECK-NOT: mov | 314 ; CHECK-NOT: mov |
| 345 ; OM1-LABEL: test_memmove_large_const_len | 315 ; OM1-LABEL: test_memmove_large_const_len |
| 346 ; OM1: call {{.*}} memmove | 316 ; OM1: call {{.*}} memmove |
| 347 ; ARM32-LABEL: test_memmove_large_const_len | 317 ; ARM32-LABEL: test_memmove_large_const_len |
| 348 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memmove | 318 ; ARM32: bl {{.*}} memmove |
| 349 ; ARM32: movt [[CALL]] | |
| 350 ; ARM32: blx [[CALL]] | |
| 351 | 319 |
| 352 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { | 320 define internal void @test_memset(i32 %iptr_dst, i32 %wide_val, i32 %len) { |
| 353 entry: | 321 entry: |
| 354 %val = trunc i32 %wide_val to i8 | 322 %val = trunc i32 %wide_val to i8 |
| 355 %dst = inttoptr i32 %iptr_dst to i8* | 323 %dst = inttoptr i32 %iptr_dst to i8* |
| 356 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, | 324 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, |
| 357 i32 %len, i32 1, i1 false) | 325 i32 %len, i32 1, i1 false) |
| 358 ret void | 326 ret void |
| 359 } | 327 } |
| 360 ; CHECK-LABEL: test_memset | 328 ; CHECK-LABEL: test_memset |
| 361 ; CHECK: movzx | 329 ; CHECK: movzx |
| 362 ; CHECK: call {{.*}} R_{{.*}} memset | 330 ; CHECK: call {{.*}} R_{{.*}} memset |
| 363 ; OM1-LABEL: test_memset | 331 ; OM1-LABEL: test_memset |
| 364 ; OM1: movzx | 332 ; OM1: movzx |
| 365 ; OM1: call {{.*}} R_{{.*}} memset | 333 ; OM1: call {{.*}} R_{{.*}} memset |
| 366 ; ARM32-LABEL: test_memset | 334 ; ARM32-LABEL: test_memset |
| 367 ; ARM32: uxtb | 335 ; ARM32: uxtb |
| 368 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 336 ; ARM32: bl {{.*}} memset |
| 369 ; ARM32: movt [[CALL]] | |
| 370 ; ARM32: blx [[CALL]] | |
| 371 | 337 |
| 372 define internal void @test_memset_const_len_align(i32 %iptr_dst, | 338 define internal void @test_memset_const_len_align(i32 %iptr_dst, |
| 373 i32 %wide_val) { | 339 i32 %wide_val) { |
| 374 entry: | 340 entry: |
| 375 %val = trunc i32 %wide_val to i8 | 341 %val = trunc i32 %wide_val to i8 |
| 376 %dst = inttoptr i32 %iptr_dst to i8* | 342 %dst = inttoptr i32 %iptr_dst to i8* |
| 377 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, | 343 call void @llvm.memset.p0i8.i32(i8* %dst, i8 %val, |
| 378 i32 32, i32 1, i1 false) | 344 i32 32, i32 1, i1 false) |
| 379 ret void | 345 ret void |
| 380 } | 346 } |
| 381 ; CHECK-LABEL: test_memset_const_len_align | 347 ; CHECK-LABEL: test_memset_const_len_align |
| 382 ; CHECK: movzx | 348 ; CHECK: movzx |
| 383 ; CHECK: call {{.*}} R_{{.*}} memset | 349 ; CHECK: call {{.*}} R_{{.*}} memset |
| 384 ; OM1-LABEL: test_memset_const_len_align | 350 ; OM1-LABEL: test_memset_const_len_align |
| 385 ; OM1: movzx | 351 ; OM1: movzx |
| 386 ; OM1: call {{.*}} R_{{.*}} memset | 352 ; OM1: call {{.*}} R_{{.*}} memset |
| 387 ; ARM32-LABEL: test_memset_const_len_align | 353 ; ARM32-LABEL: test_memset_const_len_align |
| 388 ; ARM32: uxtb | 354 ; ARM32: uxtb |
| 389 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 355 ; ARM32: bl {{.*}} memset |
| 390 ; ARM32: movt [[CALL]] | |
| 391 ; ARM32: blx [[CALL]] | |
| 392 | 356 |
| 393 define internal void @test_memset_long_const_len_zero_val_align( | 357 define internal void @test_memset_long_const_len_zero_val_align( |
| 394 i32 %iptr_dst) { | 358 i32 %iptr_dst) { |
| 395 entry: | 359 entry: |
| 396 %dst = inttoptr i32 %iptr_dst to i8* | 360 %dst = inttoptr i32 %iptr_dst to i8* |
| 397 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, | 361 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, |
| 398 i32 4876, i32 1, i1 false) | 362 i32 4876, i32 1, i1 false) |
| 399 ret void | 363 ret void |
| 400 } | 364 } |
| 401 ; CHECK-LABEL: test_memset_long_const_len_zero_val_align | 365 ; CHECK-LABEL: test_memset_long_const_len_zero_val_align |
| 402 ; CHECK: call {{.*}} R_{{.*}} memset | 366 ; CHECK: call {{.*}} R_{{.*}} memset |
| 403 ; OM1-LABEL: test_memset_long_const_len_zero_val_align | 367 ; OM1-LABEL: test_memset_long_const_len_zero_val_align |
| 404 ; OM1: call {{.*}} R_{{.*}} memset | 368 ; OM1: call {{.*}} R_{{.*}} memset |
| 405 ; ARM32-LABEL: test_memset_long_const_len_zero_val_align | 369 ; ARM32-LABEL: test_memset_long_const_len_zero_val_align |
| 406 ; ARM32: uxtb | 370 ; ARM32: uxtb |
| 407 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 371 ; ARM32: bl {{.*}} memset |
| 408 ; ARM32: movt [[CALL]] | |
| 409 ; ARM32: blx [[CALL]] | |
| 410 | 372 |
| 411 define internal void @test_memset_const_val(i32 %iptr_dst, i32 %len) { | 373 define internal void @test_memset_const_val(i32 %iptr_dst, i32 %len) { |
| 412 entry: | 374 entry: |
| 413 %dst = inttoptr i32 %iptr_dst to i8* | 375 %dst = inttoptr i32 %iptr_dst to i8* |
| 414 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 %len, i32 1, i1 false) | 376 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 %len, i32 1, i1 false) |
| 415 ret void | 377 ret void |
| 416 } | 378 } |
| 417 ; CHECK-LABEL: test_memset_const_val | 379 ; CHECK-LABEL: test_memset_const_val |
| 418 ; CHECK-NOT: movzx | 380 ; CHECK-NOT: movzx |
| 419 ; CHECK: call {{.*}} R_{{.*}} memset | 381 ; CHECK: call {{.*}} R_{{.*}} memset |
| 420 ; OM1-LABEL: test_memset_const_val | 382 ; OM1-LABEL: test_memset_const_val |
| 421 ; OM1: call {{.*}} R_{{.*}} memset | 383 ; OM1: call {{.*}} R_{{.*}} memset |
| 422 ; ARM32-LABEL: test_memset_const_val | 384 ; ARM32-LABEL: test_memset_const_val |
| 423 ; ARM32: uxtb | 385 ; ARM32: uxtb |
| 424 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 386 ; ARM32: bl {{.*}} memset |
| 425 ; ARM32: movt [[CALL]] | |
| 426 ; ARM32: blx [[CALL]] | |
| 427 | 387 |
| 428 define internal void @test_memset_const_val_len_very_small(i32 %iptr_dst) { | 388 define internal void @test_memset_const_val_len_very_small(i32 %iptr_dst) { |
| 429 entry: | 389 entry: |
| 430 %dst = inttoptr i32 %iptr_dst to i8* | 390 %dst = inttoptr i32 %iptr_dst to i8* |
| 431 call void @llvm.memset.p0i8.i32(i8* %dst, i8 10, i32 2, i32 1, i1 false) | 391 call void @llvm.memset.p0i8.i32(i8* %dst, i8 10, i32 2, i32 1, i1 false) |
| 432 ret void | 392 ret void |
| 433 } | 393 } |
| 434 ; CHECK-LABEL: test_memset_const_val_len_very_small | 394 ; CHECK-LABEL: test_memset_const_val_len_very_small |
| 435 ; CHECK: mov WORD PTR [{{.*}}],0xa0a | 395 ; CHECK: mov WORD PTR [{{.*}}],0xa0a |
| 436 ; CHECK-NOT: mov | 396 ; CHECK-NOT: mov |
| 437 ; OM1-LABEL: test_memset_const_val_len_very_small | 397 ; OM1-LABEL: test_memset_const_val_len_very_small |
| 438 ; OM1: call {{.*}} R_{{.*}} memset | 398 ; OM1: call {{.*}} R_{{.*}} memset |
| 439 ; ARM32-LABEL: test_memset_const_val_len_very_small | 399 ; ARM32-LABEL: test_memset_const_val_len_very_small |
| 440 ; ARM32: uxtb | 400 ; ARM32: uxtb |
| 441 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 401 ; ARM32: bl {{.*}} memset |
| 442 ; ARM32: movt [[CALL]] | |
| 443 ; ARM32: blx [[CALL]] | |
| 444 | 402 |
| 445 define internal void @test_memset_const_val_len_3(i32 %iptr_dst) { | 403 define internal void @test_memset_const_val_len_3(i32 %iptr_dst) { |
| 446 entry: | 404 entry: |
| 447 %dst = inttoptr i32 %iptr_dst to i8* | 405 %dst = inttoptr i32 %iptr_dst to i8* |
| 448 call void @llvm.memset.p0i8.i32(i8* %dst, i8 16, i32 3, i32 1, i1 false) | 406 call void @llvm.memset.p0i8.i32(i8* %dst, i8 16, i32 3, i32 1, i1 false) |
| 449 ret void | 407 ret void |
| 450 } | 408 } |
| 451 ; CHECK-LABEL: test_memset_const_val_len_3 | 409 ; CHECK-LABEL: test_memset_const_val_len_3 |
| 452 ; CHECK: mov WORD PTR [{{.*}}],0x1010 | 410 ; CHECK: mov WORD PTR [{{.*}}],0x1010 |
| 453 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],0x10 | 411 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x2],0x10 |
| 454 ; CHECK-NOT: mov | 412 ; CHECK-NOT: mov |
| 455 ; OM1-LABEL: test_memset_const_val_len_3 | 413 ; OM1-LABEL: test_memset_const_val_len_3 |
| 456 ; OM1: call {{.*}} R_{{.*}} memset | 414 ; OM1: call {{.*}} R_{{.*}} memset |
| 457 ; ARM32-LABEL: test_memset_const_val_len_3 | 415 ; ARM32-LABEL: test_memset_const_val_len_3 |
| 458 ; ARM32: uxtb | 416 ; ARM32: uxtb |
| 459 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 417 ; ARM32: bl {{.*}} memset |
| 460 ; ARM32: movt [[CALL]] | |
| 461 ; ARM32: blx [[CALL]] | |
| 462 | 418 |
| 463 define internal void @test_memset_const_val_len_mid(i32 %iptr_dst) { | 419 define internal void @test_memset_const_val_len_mid(i32 %iptr_dst) { |
| 464 entry: | 420 entry: |
| 465 %dst = inttoptr i32 %iptr_dst to i8* | 421 %dst = inttoptr i32 %iptr_dst to i8* |
| 466 call void @llvm.memset.p0i8.i32(i8* %dst, i8 32, i32 9, i32 1, i1 false) | 422 call void @llvm.memset.p0i8.i32(i8* %dst, i8 32, i32 9, i32 1, i1 false) |
| 467 ret void | 423 ret void |
| 468 } | 424 } |
| 469 ; CHECK-LABEL: test_memset_const_val_len_mid | 425 ; CHECK-LABEL: test_memset_const_val_len_mid |
| 470 ; CHECK: mov DWORD PTR [{{.*}}+0x4],0x20202020 | 426 ; CHECK: mov DWORD PTR [{{.*}}+0x4],0x20202020 |
| 471 ; CHECK: mov DWORD PTR [{{.*}}],0x20202020 | 427 ; CHECK: mov DWORD PTR [{{.*}}],0x20202020 |
| 472 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],0x20 | 428 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x8],0x20 |
| 473 ; CHECK-NOT: mov | 429 ; CHECK-NOT: mov |
| 474 ; OM1-LABEL: test_memset_const_val_len_mid | 430 ; OM1-LABEL: test_memset_const_val_len_mid |
| 475 ; OM1: call {{.*}} R_{{.*}} memset | 431 ; OM1: call {{.*}} R_{{.*}} memset |
| 476 ; ARM32-LABEL: test_memset_const_val_len_mid | 432 ; ARM32-LABEL: test_memset_const_val_len_mid |
| 477 ; ARM32: uxtb | 433 ; ARM32: uxtb |
| 478 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 434 ; ARM32: bl {{.*}} memset |
| 479 ; ARM32: movt [[CALL]] | |
| 480 ; ARM32: blx [[CALL]] | |
| 481 | 435 |
| 482 define internal void @test_memset_zero_const_len_small(i32 %iptr_dst) { | 436 define internal void @test_memset_zero_const_len_small(i32 %iptr_dst) { |
| 483 entry: | 437 entry: |
| 484 %dst = inttoptr i32 %iptr_dst to i8* | 438 %dst = inttoptr i32 %iptr_dst to i8* |
| 485 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 12, i32 1, i1 false) | 439 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 12, i32 1, i1 false) |
| 486 ret void | 440 ret void |
| 487 } | 441 } |
| 488 ; CHECK-LABEL: test_memset_zero_const_len_small | 442 ; CHECK-LABEL: test_memset_zero_const_len_small |
| 489 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] | 443 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] |
| 490 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]] | 444 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]] |
| 491 ; CHECK-NEXT: mov DWORD PTR [{{.*}}+0x8],0x0 | 445 ; CHECK-NEXT: mov DWORD PTR [{{.*}}+0x8],0x0 |
| 492 ; CHECK-NOT: mov | 446 ; CHECK-NOT: mov |
| 493 ; OM1-LABEL: test_memset_zero_const_len_small | 447 ; OM1-LABEL: test_memset_zero_const_len_small |
| 494 ; OM1: call {{.*}} R_{{.*}} memset | 448 ; OM1: call {{.*}} R_{{.*}} memset |
| 495 ; ARM32-LABEL: test_memset_zero_const_len_small | 449 ; ARM32-LABEL: test_memset_zero_const_len_small |
| 496 ; ARM32: uxtb | 450 ; ARM32: uxtb |
| 497 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 451 ; ARM32: bl {{.*}} memset |
| 498 ; ARM32: movt [[CALL]] | |
| 499 ; ARM32: blx [[CALL]] | |
| 500 | 452 |
| 501 define internal void @test_memset_zero_const_len_small_overlap(i32 %iptr_dst) { | 453 define internal void @test_memset_zero_const_len_small_overlap(i32 %iptr_dst) { |
| 502 entry: | 454 entry: |
| 503 %dst = inttoptr i32 %iptr_dst to i8* | 455 %dst = inttoptr i32 %iptr_dst to i8* |
| 504 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 15, i32 1, i1 false) | 456 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 15, i32 1, i1 false) |
| 505 ret void | 457 ret void |
| 506 } | 458 } |
| 507 ; CHECK-LABEL: test_memset_zero_const_len_small_overlap | 459 ; CHECK-LABEL: test_memset_zero_const_len_small_overlap |
| 508 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] | 460 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] |
| 509 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]] | 461 ; CHECK-NEXT: movq QWORD PTR [{{.*}}],[[ZERO]] |
| 510 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[ZERO]] | 462 ; CHECK-NEXT: movq QWORD PTR [{{.*}}+0x7],[[ZERO]] |
| 511 ; CHECK-NOT: mov | 463 ; CHECK-NOT: mov |
| 512 ; OM1-LABEL: test_memset_zero_const_len_small_overlap | 464 ; OM1-LABEL: test_memset_zero_const_len_small_overlap |
| 513 ; OM1: call {{.*}} R_{{.*}} memset | 465 ; OM1: call {{.*}} R_{{.*}} memset |
| 514 ; ARM32-LABEL: test_memset_zero_const_len_small_overlap | 466 ; ARM32-LABEL: test_memset_zero_const_len_small_overlap |
| 515 ; ARM32: uxtb | 467 ; ARM32: uxtb |
| 516 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 468 ; ARM32: bl {{.*}} memset |
| 517 ; ARM32: movt [[CALL]] | |
| 518 ; ARM32: blx [[CALL]] | |
| 519 | 469 |
| 520 define internal void @test_memset_zero_const_len_big_overlap(i32 %iptr_dst) { | 470 define internal void @test_memset_zero_const_len_big_overlap(i32 %iptr_dst) { |
| 521 entry: | 471 entry: |
| 522 %dst = inttoptr i32 %iptr_dst to i8* | 472 %dst = inttoptr i32 %iptr_dst to i8* |
| 523 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 30, i32 1, i1 false) | 473 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 30, i32 1, i1 false) |
| 524 ret void | 474 ret void |
| 525 } | 475 } |
| 526 ; CHECK-LABEL: test_memset_zero_const_len_big_overlap | 476 ; CHECK-LABEL: test_memset_zero_const_len_big_overlap |
| 527 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] | 477 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] |
| 528 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]] | 478 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]] |
| 529 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[ZERO]] | 479 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0xe],[[ZERO]] |
| 530 ; CHECK-NOT: mov | 480 ; CHECK-NOT: mov |
| 531 ; OM1-LABEL: test_memset_zero_const_len_big_overlap | 481 ; OM1-LABEL: test_memset_zero_const_len_big_overlap |
| 532 ; OM1: call {{.*}} R_{{.*}} memset | 482 ; OM1: call {{.*}} R_{{.*}} memset |
| 533 ; ARM32-LABEL: test_memset_zero_const_len_big_overlap | 483 ; ARM32-LABEL: test_memset_zero_const_len_big_overlap |
| 534 ; ARM32: uxtb | 484 ; ARM32: uxtb |
| 535 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 485 ; ARM32: bl {{.*}} memset |
| 536 ; ARM32: movt [[CALL]] | |
| 537 ; ARM32: blx [[CALL]] | |
| 538 | 486 |
| 539 define internal void @test_memset_zero_const_len_large(i32 %iptr_dst) { | 487 define internal void @test_memset_zero_const_len_large(i32 %iptr_dst) { |
| 540 entry: | 488 entry: |
| 541 %dst = inttoptr i32 %iptr_dst to i8* | 489 %dst = inttoptr i32 %iptr_dst to i8* |
| 542 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 33, i32 1, i1 false) | 490 call void @llvm.memset.p0i8.i32(i8* %dst, i8 0, i32 33, i32 1, i1 false) |
| 543 ret void | 491 ret void |
| 544 } | 492 } |
| 545 ; CHECK-LABEL: test_memset_zero_const_len_large | 493 ; CHECK-LABEL: test_memset_zero_const_len_large |
| 546 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] | 494 ; CHECK: pxor [[ZERO:xmm[0-9]+]],[[ZERO]] |
| 547 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[ZERO]] | 495 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}+0x10],[[ZERO]] |
| 548 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]] | 496 ; CHECK-NEXT: movups XMMWORD PTR [{{.*}}],[[ZERO]] |
| 549 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],0x0 | 497 ; CHECK-NEXT: mov BYTE PTR [{{.*}}+0x20],0x0 |
| 550 ; CHECK-NOT: mov | 498 ; CHECK-NOT: mov |
| 551 ; OM1-LABEL: test_memset_zero_const_len_large | 499 ; OM1-LABEL: test_memset_zero_const_len_large |
| 552 ; OM1: call {{.*}} R_{{.*}} memset | 500 ; OM1: call {{.*}} R_{{.*}} memset |
| 553 ; ARM32-LABEL: test_memset_zero_const_len_large | 501 ; ARM32-LABEL: test_memset_zero_const_len_large |
| 554 ; ARM32: uxtb | 502 ; ARM32: uxtb |
| 555 ; ARM32: movw [[CALL:r[0-9]]], {{.+}} memset | 503 ; ARM32: bl {{.*}} memset |
| 556 ; ARM32: movt [[CALL]] | |
| 557 ; ARM32: blx [[CALL]] | |
| OLD | NEW |