r229067 - [X86] Add range checking on immediate arguments on XOP vpcom builtins.
Craig Topper
craig.topper at gmail.com
Thu Feb 12 22:04:48 PST 2015
Author: ctopper
Date: Fri Feb 13 00:04:48 2015
New Revision: 229067
URL: http://llvm.org/viewvc/llvm-project?rev=229067&view=rev
Log:
[X86] Add range checking on immediate arguments on XOP vpcom builtins.
Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/Sema/builtins-x86.c
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=229067&r1=229066&r2=229067&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Fri Feb 13 00:04:48 2015
@@ -932,6 +932,14 @@ bool Sema::CheckX86BuiltinFunctionCall(u
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);
}
Modified: cfe/trunk/test/Sema/builtins-x86.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/builtins-x86.c?rev=229067&r1=229066&r2=229067&view=diff
==============================================================================
--- cfe/trunk/test/Sema/builtins-x86.c (original)
+++ cfe/trunk/test/Sema/builtins-x86.c Fri Feb 13 00:04:48 2015
@@ -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_ma
__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}}
+}
More information about the cfe-commits
mailing list