[Sema][X86] Update immediate check for gather/scatter prefetch instructions to match the _MM_HINT_T0/T1 constant definitions

Our _MM_HINT_T0/T1 constant values are 3/2 which matches gcc, but not icc or Intel documentation. Interestingly gcc had this same bug on their implementation of the gather/scatter builtins at one point too.

Fixes PR32411.

llvm-svn: 299233
This commit is contained in:
Craig Topper 2017-03-31 17:22:30 +00:00
parent d41a0c1509
commit f771f79b2f
3 changed files with 18 additions and 18 deletions

View File

@ -2308,7 +2308,7 @@ bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
case X86::BI__builtin_ia32_scatterpfdps: case X86::BI__builtin_ia32_scatterpfdps:
case X86::BI__builtin_ia32_scatterpfqpd: case X86::BI__builtin_ia32_scatterpfqpd:
case X86::BI__builtin_ia32_scatterpfqps: case X86::BI__builtin_ia32_scatterpfqps:
i = 4; l = 1; u = 2; i = 4; l = 2; u = 3;
break; break;
case X86::BI__builtin_ia32_pcmpestrm128: case X86::BI__builtin_ia32_pcmpestrm128:
case X86::BI__builtin_ia32_pcmpestri128: case X86::BI__builtin_ia32_pcmpestri128:

View File

@ -6,95 +6,95 @@
void test_mm512_mask_prefetch_i32gather_pd(__m256i index, __mmask8 mask, void const *addr, int hint) { void test_mm512_mask_prefetch_i32gather_pd(__m256i index, __mmask8 mask, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_pd // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_pd
// CHECK: @llvm.x86.avx512.gatherpf.dpd // CHECK: @llvm.x86.avx512.gatherpf.dpd
return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, 1); return _mm512_mask_prefetch_i32gather_pd(index, mask, addr, 2, _MM_HINT_T0);
} }
void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr, int hint) { void test_mm512_prefetch_i32gather_pd(__m256i index, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_prefetch_i32gather_pd // CHECK-LABEL: @test_mm512_prefetch_i32gather_pd
// CHECK: @llvm.x86.avx512.gatherpf.dpd // CHECK: @llvm.x86.avx512.gatherpf.dpd
return _mm512_prefetch_i32gather_pd(index, addr, 2, 1); return _mm512_prefetch_i32gather_pd(index, addr, 2, _MM_HINT_T0);
} }
void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void const *addr, int hint) { void test_mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps // CHECK-LABEL: @test_mm512_mask_prefetch_i32gather_ps
// CHECK: @llvm.x86.avx512.gatherpf.dps // CHECK: @llvm.x86.avx512.gatherpf.dps
return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, 1); return _mm512_mask_prefetch_i32gather_ps(index, mask, addr, 2, _MM_HINT_T0);
} }
void test_mm512_prefetch_i32gather_ps(__m512i index, void const *addr, int hint) { void test_mm512_prefetch_i32gather_ps(__m512i index, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_prefetch_i32gather_ps // CHECK-LABEL: @test_mm512_prefetch_i32gather_ps
// CHECK: @llvm.x86.avx512.gatherpf.dps // CHECK: @llvm.x86.avx512.gatherpf.dps
return _mm512_prefetch_i32gather_ps(index, addr, 2, 1); return _mm512_prefetch_i32gather_ps(index, addr, 2, _MM_HINT_T0);
} }
void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void const *addr, int hint) { void test_mm512_mask_prefetch_i64gather_pd(__m512i index, __mmask8 mask, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_pd
// CHECK: @llvm.x86.avx512.gatherpf.qpd // CHECK: @llvm.x86.avx512.gatherpf.qpd
return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, 1); return _mm512_mask_prefetch_i64gather_pd(index, mask, addr, 2, _MM_HINT_T0);
} }
void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr, int hint) { void test_mm512_prefetch_i64gather_pd(__m512i index, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_prefetch_i64gather_pd // CHECK-LABEL: @test_mm512_prefetch_i64gather_pd
// CHECK: @llvm.x86.avx512.gatherpf.qpd // CHECK: @llvm.x86.avx512.gatherpf.qpd
return _mm512_prefetch_i64gather_pd(index, addr, 2, 1); return _mm512_prefetch_i64gather_pd(index, addr, 2, _MM_HINT_T0);
} }
void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void const *addr, int hint) { void test_mm512_mask_prefetch_i64gather_ps(__m512i index, __mmask8 mask, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps // CHECK-LABEL: @test_mm512_mask_prefetch_i64gather_ps
// CHECK: @llvm.x86.avx512.gatherpf.qps // CHECK: @llvm.x86.avx512.gatherpf.qps
return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, 1); return _mm512_mask_prefetch_i64gather_ps(index, mask, addr, 2, _MM_HINT_T0);
} }
void test_mm512_prefetch_i64gather_ps(__m512i index, void const *addr, int hint) { void test_mm512_prefetch_i64gather_ps(__m512i index, void const *addr, int hint) {
// CHECK-LABEL: @test_mm512_prefetch_i64gather_ps // CHECK-LABEL: @test_mm512_prefetch_i64gather_ps
// CHECK: @llvm.x86.avx512.gatherpf.qps // CHECK: @llvm.x86.avx512.gatherpf.qps
return _mm512_prefetch_i64gather_ps(index, addr, 2, 1); return _mm512_prefetch_i64gather_ps(index, addr, 2, _MM_HINT_T0);
} }
void test_mm512_prefetch_i32scatter_pd(void *addr, __m256i index) { void test_mm512_prefetch_i32scatter_pd(void *addr, __m256i index) {
// CHECK-LABEL: @test_mm512_prefetch_i32scatter_pd // CHECK-LABEL: @test_mm512_prefetch_i32scatter_pd
// CHECK: @llvm.x86.avx512.scatterpf.dpd.512 // CHECK: @llvm.x86.avx512.scatterpf.dpd.512
return _mm512_prefetch_i32scatter_pd(addr, index, 1, 2); return _mm512_prefetch_i32scatter_pd(addr, index, 1, _MM_HINT_T1);
} }
void test_mm512_mask_prefetch_i32scatter_pd(void *addr, __mmask8 mask, __m256i index) { void test_mm512_mask_prefetch_i32scatter_pd(void *addr, __mmask8 mask, __m256i index) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_pd // CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_pd
// CHECK: @llvm.x86.avx512.scatterpf.dpd.512 // CHECK: @llvm.x86.avx512.scatterpf.dpd.512
return _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, 1, 2); return _mm512_mask_prefetch_i32scatter_pd(addr, mask, index, 1, _MM_HINT_T1);
} }
void test_mm512_prefetch_i32scatter_ps(void *addr, __m512i index) { void test_mm512_prefetch_i32scatter_ps(void *addr, __m512i index) {
// CHECK-LABEL: @test_mm512_prefetch_i32scatter_ps // CHECK-LABEL: @test_mm512_prefetch_i32scatter_ps
// CHECK: @llvm.x86.avx512.scatterpf.dps.512 // CHECK: @llvm.x86.avx512.scatterpf.dps.512
return _mm512_prefetch_i32scatter_ps(addr, index, 1, 2); return _mm512_prefetch_i32scatter_ps(addr, index, 1, _MM_HINT_T1);
} }
void test_mm512_mask_prefetch_i32scatter_ps(void *addr, __mmask16 mask, __m512i index) { void test_mm512_mask_prefetch_i32scatter_ps(void *addr, __mmask16 mask, __m512i index) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_ps // CHECK-LABEL: @test_mm512_mask_prefetch_i32scatter_ps
// CHECK: @llvm.x86.avx512.scatterpf.dps.512 // CHECK: @llvm.x86.avx512.scatterpf.dps.512
return _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, 1, 2); return _mm512_mask_prefetch_i32scatter_ps(addr, mask, index, 1, _MM_HINT_T1);
} }
void test_mm512_prefetch_i64scatter_pd(void *addr, __m512i index) { void test_mm512_prefetch_i64scatter_pd(void *addr, __m512i index) {
// CHECK-LABEL: @test_mm512_prefetch_i64scatter_pd // CHECK-LABEL: @test_mm512_prefetch_i64scatter_pd
// CHECK: @llvm.x86.avx512.scatterpf.qpd.512 // CHECK: @llvm.x86.avx512.scatterpf.qpd.512
return _mm512_prefetch_i64scatter_pd(addr, index, 1, 2); return _mm512_prefetch_i64scatter_pd(addr, index, 1, _MM_HINT_T1);
} }
void test_mm512_mask_prefetch_i64scatter_pd(void *addr, __mmask16 mask, __m512i index) { void test_mm512_mask_prefetch_i64scatter_pd(void *addr, __mmask16 mask, __m512i index) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i64scatter_pd // CHECK-LABEL: @test_mm512_mask_prefetch_i64scatter_pd
// CHECK: @llvm.x86.avx512.scatterpf.qpd.512 // CHECK: @llvm.x86.avx512.scatterpf.qpd.512
return _mm512_mask_prefetch_i64scatter_pd(addr, mask, index, 1, 2); return _mm512_mask_prefetch_i64scatter_pd(addr, mask, index, 1, _MM_HINT_T1);
} }
void test_mm512_prefetch_i64scatter_ps(void *addr, __m512i index) { void test_mm512_prefetch_i64scatter_ps(void *addr, __m512i index) {
// CHECK-LABEL: @test_mm512_prefetch_i64scatter_ps // CHECK-LABEL: @test_mm512_prefetch_i64scatter_ps
// CHECK: @llvm.x86.avx512.scatterpf.qps.512 // CHECK: @llvm.x86.avx512.scatterpf.qps.512
return _mm512_prefetch_i64scatter_ps(addr, index, 1, 2); return _mm512_prefetch_i64scatter_ps(addr, index, 1, _MM_HINT_T1);
} }
void test_mm512_mask_prefetch_i64scatter_ps(void *addr, __mmask16 mask, __m512i index) { void test_mm512_mask_prefetch_i64scatter_ps(void *addr, __mmask16 mask, __m512i index) {
// CHECK-LABEL: @test_mm512_mask_prefetch_i64scatter_ps // CHECK-LABEL: @test_mm512_mask_prefetch_i64scatter_ps
// CHECK: @llvm.x86.avx512.scatterpf.qps.512 // CHECK: @llvm.x86.avx512.scatterpf.qps.512
return _mm512_mask_prefetch_i64scatter_ps(addr, mask, index, 1, 2); return _mm512_mask_prefetch_i64scatter_ps(addr, mask, index, 1, _MM_HINT_T1);
} }

View File

@ -80,6 +80,6 @@ __m512i _mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, int con
} }
__m512 _mm512_mask_prefetch_i32gather_ps_2(__m512i index, __mmask16 mask, int const *addr) { __m512 _mm512_mask_prefetch_i32gather_ps_2(__m512i index, __mmask16 mask, int const *addr) {
return __builtin_ia32_gatherpfdps(mask, index, addr, 1, 3); // expected-error {{argument should be a value from 1 to 2}} return __builtin_ia32_gatherpfdps(mask, index, addr, 1, 1); // expected-error {{argument should be a value from 2 to 3}}
} }