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