diff options
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 8 | ||||
| -rw-r--r-- | clang/test/Sema/builtins-x86.c | 33 |
2 files changed, 41 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 3093ac5abeb..b9af98da132 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -932,6 +932,14 @@ bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { case X86::BI__builtin_ia32_cmppd256: case X86::BI__builtin_ia32_cmpps512_mask: case X86::BI__builtin_ia32_cmppd512_mask: i = 2; l = 0; u = 31; break; + case X86::BI__builtin_ia32_vpcomub: + case X86::BI__builtin_ia32_vpcomuw: + case X86::BI__builtin_ia32_vpcomud: + case X86::BI__builtin_ia32_vpcomuq: + case X86::BI__builtin_ia32_vpcomb: + case X86::BI__builtin_ia32_vpcomw: + case X86::BI__builtin_ia32_vpcomd: + case X86::BI__builtin_ia32_vpcomq: i = 2; l = 0; u = 7; break; } return SemaBuiltinConstantArgRange(TheCall, i, l, u); } diff --git a/clang/test/Sema/builtins-x86.c b/clang/test/Sema/builtins-x86.c index 71004e1e2ba..326d2a3a7a1 100644 --- a/clang/test/Sema/builtins-x86.c +++ b/clang/test/Sema/builtins-x86.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s +typedef long long __m128i __attribute__((__vector_size__(16))); typedef float __m128 __attribute__((__vector_size__(16))); typedef double __m128d __attribute__((__vector_size__(16))); @@ -32,3 +33,35 @@ __mmask16 test__builtin_ia32_cmpps512_mask(__m512d __a, __m512d __b) { __mmask8 test__builtin_ia32_cmppd512_mask(__m512d __a, __m512d __b) { __builtin_ia32_cmppd512_mask(__a, __b, 32, -1, 0); // expected-error {{argument should be a value from 0 to 31}} } + +__m128i test__builtin_ia32_vpcomub(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomub(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomuw(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomuw(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomud(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomud(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomuq(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomuq(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomb(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomub(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomw(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomuw(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomd(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomud(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} + +__m128i test__builtin_ia32_vpcomq(__m128i __a, __m128i __b) { + __builtin_ia32_vpcomuq(__a, __b, 8); // expected-error {{argument should be a value from 0 to 7}} +} |

