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