diff options
| author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-07-28 13:47:02 +0000 |
|---|---|---|
| committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2017-07-28 13:47:02 +0000 |
| commit | 9207fab61aa5099cf574a35e7a3a395777bdeb7e (patch) | |
| tree | 66a9d82a25b4f5f65ae42bc26b792d111af1fb41 /clang/test | |
| parent | 25e9e1b8660a1b01479bc006268f21643a32f125 (diff) | |
| download | bcm5719-llvm-9207fab61aa5099cf574a35e7a3a395777bdeb7e.tar.gz bcm5719-llvm-9207fab61aa5099cf574a35e7a3a395777bdeb7e.zip | |
[X86] Add tests showing inability of vector non-temporal load/store intrinsic to force pointer alignment (PR33830)
Clang specifies a max type alignment of 16 bytes on darwin targets, meaning that the builtin nontemporal stores don't correctly align the loads/stores to 32 or 64 bytes when required, resulting in lowering to temporal unaligned loads/stores.
llvm-svn: 309382
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGen/x86-nontemporal.c | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/clang/test/CodeGen/x86-nontemporal.c b/clang/test/CodeGen/x86-nontemporal.c new file mode 100644 index 00000000000..5d809de7c67 --- /dev/null +++ b/clang/test/CodeGen/x86-nontemporal.c @@ -0,0 +1,117 @@ +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -fno-signed-char -emit-llvm -o - -Wall -Werror | FileCheck %s --check-prefix=CHECK + +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -emit-llvm -o - -Wall -Werror -fmax-type-align=16 | FileCheck %s --check-prefix=CHECK16 +// RUN: %clang_cc1 -ffreestanding %s -triple=x86_64-apple-darwin -target-feature +sse4.1 -target-feature +avx -target-feature +avx2 -target-feature +avx512f -fno-signed-char -emit-llvm -o - -Wall -Werror -fmax-type-align=16 | FileCheck %s --check-prefix=CHECK16 + +#include <x86intrin.h> + +// FIXME: (PR33830) Tests showing failure to correctly align non-temporal load/stores on darwin targets where fmax-type-align is set to 16. + +// +// 128-bit vectors +// + +void test_mm_stream_pd(double* A, __m128d B) { + // CHECK-LABEL: test_mm_stream_pd + // CHECK: store <2 x double> %{{.*}}, <2 x double>* %{{.*}}, align 16, !nontemporal + _mm_stream_pd(A, B); +} + +void test_mm_stream_ps(float* A, __m128 B) { + // CHECK16-LABEL: test_mm_stream_ps + // CHECK16: store <4 x float> %{{.*}}, <4 x float>* %{{.*}}, align 16, !nontemporal + _mm_stream_ps(A, B); +} + +void test_mm_stream_si128(__m128i* A, __m128i B) { + // CHECK-LABEL: test_mm_stream_si128 + // CHECK: store <2 x i64> %{{.*}}, <2 x i64>* %{{.*}}, align 16, !nontemporal + _mm_stream_si128(A, B); +} + +__m128i test_mm_stream_load_si128(__m128i const *A) { + // CHECK-LABEL: test_mm_stream_load_si128 + // CHECK: load <2 x i64>, <2 x i64>* %{{.*}}, align 16, !nontemporal + return _mm_stream_load_si128(A); +} + +// +// 256-bit vectors +// + +void test_mm256_stream_pd(double* A, __m256d B) { + // CHECK-LABEL: test_mm256_stream_pd + // CHECK: store <4 x double> %{{.*}}, <4 x double>* %{{.*}}, align 32, !nontemporal + + // CHECK16-LABEL: test_mm256_stream_pd + // CHECK16: store <4 x double> %{{.*}}, <4 x double>* %{{.*}}, align 16, !nontemporal + _mm256_stream_pd(A, B); +} + +void test_mm256_stream_ps(float* A, __m256 B) { + // CHECK-LABEL: test_mm256_stream_ps + // CHECK: store <8 x float> %{{.*}}, <8 x float>* %{{.*}}, align 32, !nontemporal + + // CHECK16-LABEL: test_mm256_stream_ps + // CHECK16: store <8 x float> %{{.*}}, <8 x float>* %{{.*}}, align 16, !nontemporal + _mm256_stream_ps(A, B); +} + +void test_mm256_stream_si256(__m256i* A, __m256i B) { + // CHECK-LABEL: test_mm256_stream_si256 + // CHECK: store <4 x i64> %{{.*}}, <4 x i64>* %{{.*}}, align 32, !nontemporal + + // CHECK16-LABEL: test_mm256_stream_si256 + // CHECK16: store <4 x i64> %{{.*}}, <4 x i64>* %{{.*}}, align 16, !nontemporal + _mm256_stream_si256(A, B); +} + +__m256i test_mm256_stream_load_si256(__m256i const *A) { + // CHECK-LABEL: test_mm256_stream_load_si256 + // CHECK: load <4 x i64>, <4 x i64>* %{{.*}}, align 32, !nontemporal + + // CHECK16-LABEL: test_mm256_stream_load_si256 + // CHECK16: load <4 x i64>, <4 x i64>* %{{.*}}, align 16, !nontemporal + return _mm256_stream_load_si256(A); +} + +// +// 512-bit vectors +// + +void test_mm512_stream_pd(double* A, __m512d B) { + // CHECK-LABEL: test_mm512_stream_pd + // CHECK: store <8 x double> %{{.*}}, <8 x double>* %{{.*}}, align 64, !nontemporal + + // CHECK16-LABEL: test_mm512_stream_pd + // CHECK16: store <8 x double> %{{.*}}, <8 x double>* %{{.*}}, align 16, !nontemporal + _mm512_stream_pd(A, B); +} + +void test_mm512_stream_ps(float* A, __m512 B) { + // CHECK-LABEL: test_mm512_stream_ps + // CHECK: store <16 x float> %{{.*}}, <16 x float>* %{{.*}}, align 64, !nontemporal + + // CHECK16-LABEL: test_mm512_stream_ps + // CHECK16: store <16 x float> %{{.*}}, <16 x float>* %{{.*}}, align 16, !nontemporal + _mm512_stream_ps(A, B); +} + +void test_mm512_stream_si512(__m512i* A, __m512i B) { + // CHECK-LABEL: test_mm512_stream_si512 + // CHECK: store <8 x i64> %{{.*}}, <8 x i64>* %{{.*}}, align 64, !nontemporal + + // CHECK16-LABEL: test_mm512_stream_si512 + // CHECK16: store <8 x i64> %{{.*}}, <8 x i64>* %{{.*}}, align 16, !nontemporal + _mm512_stream_si512(A, B); +} + +__m512i test_mm512_stream_load_si512(void *A) { + // CHECK-LABEL: test_mm512_stream_load_si512 + // CHECK: load <8 x i64>, <8 x i64>* %{{.*}}, align 64, !nontemporal + + // CHECK16-LABEL: test_mm512_stream_load_si512 + // CHECK16: load <8 x i64>, <8 x i64>* %{{.*}}, align 16, !nontemporal + return _mm512_stream_load_si512(A); +} |

