[msan] Tests for vector compare intrinsics.

llvm-svn: 267967
This commit is contained in:
Evgeniy Stepanov 2016-04-29 01:20:05 +00:00
parent 35f3e5e4e7
commit 01c7450ec5
1 changed files with 42 additions and 1 deletions

View File

@ -3955,7 +3955,48 @@ TEST(VectorMaddTest, mmx_pmadd_wd) {
EXPECT_EQ((unsigned)(2 * 102 + 3 * 103), c[1]);
}
#endif // defined(__clang__)
TEST(VectorCmpTest, mm_cmpneq_ps) {
V4x32 c;
c = _mm_cmpneq_ps(V4x32{Poisoned<U4>(), 1, 2, 3}, V4x32{4, 5, Poisoned<U4>(), 6});
EXPECT_POISONED(c[0]);
EXPECT_NOT_POISONED(c[1]);
EXPECT_POISONED(c[2]);
EXPECT_NOT_POISONED(c[3]);
c = _mm_cmpneq_ps(V4x32{0, 1, 2, 3}, V4x32{4, 5, 6, 7});
EXPECT_NOT_POISONED(c);
}
TEST(VectorCmpTest, mm_cmpneq_sd) {
V2x64 c;
c = _mm_cmpneq_sd(V2x64{Poisoned<U8>(), 1}, V2x64{2, 3});
EXPECT_POISONED(c[0]);
c = _mm_cmpneq_sd(V2x64{1, 2}, V2x64{Poisoned<U8>(), 3});
EXPECT_POISONED(c[0]);
c = _mm_cmpneq_sd(V2x64{1, 2}, V2x64{3, 4});
EXPECT_NOT_POISONED(c[0]);
c = _mm_cmpneq_sd(V2x64{1, Poisoned<U8>()}, V2x64{2, Poisoned<U8>()});
EXPECT_NOT_POISONED(c[0]);
c = _mm_cmpneq_sd(V2x64{1, Poisoned<U8>()}, V2x64{1, Poisoned<U8>()});
EXPECT_NOT_POISONED(c[0]);
}
TEST(VectorCmpTest, builtin_ia32_ucomisdlt) {
U4 c;
c = __builtin_ia32_ucomisdlt(V2x64{Poisoned<U8>(), 1}, V2x64{2, 3});
EXPECT_POISONED(c);
c = __builtin_ia32_ucomisdlt(V2x64{1, 2}, V2x64{Poisoned<U8>(), 3});
EXPECT_POISONED(c);
c = __builtin_ia32_ucomisdlt(V2x64{1, 2}, V2x64{3, 4});
EXPECT_NOT_POISONED(c);
c = __builtin_ia32_ucomisdlt(V2x64{1, Poisoned<U8>()}, V2x64{2, Poisoned<U8>()});
EXPECT_NOT_POISONED(c);
c = __builtin_ia32_ucomisdlt(V2x64{1, Poisoned<U8>()}, V2x64{1, Poisoned<U8>()});
EXPECT_NOT_POISONED(c);
}
#endif // defined(__x86_64__) && defined(__clang__)
TEST(MemorySanitizerOrigins, SetGet) {
EXPECT_EQ(TrackingOrigins(), !!__msan_get_track_origins());