[x86] Teach the builtin argument range check to allow invalid ranges in

dead code.

This is important for C++ templates that essentially compute the valid
input in a way that is constant and will cause all the invalid cases to
be dead code that is deleted. Code in the wild actually does this and
GCC also accepts these kinds of patterns so it is important to support
it.

To make this work, we provide a non-error path to diagnose these issues,
and use a default-error warning instead. This keeps the relatively
strict handling but prevents nastiness like SFINAE on these errors. It
also allows us to safely use the system to diagnose this only when it
occurs at runtime (in emitted code).

Entertainingly, this required fixing the syntax in various other ways
for the x86 test because we never bothered to diagnose that the returns
were invalid.

Since debugging these compile failures was super confusing, I've also
improved the diagnostic to actually say what the value was. Most of the
checks I've made ignore this to simplify maintenance, but I've checked
it in a few places to make sure the diagnsotic is working.

Depends on D48462. Without that, we might actually crash some part of
the compiler after bypassing the error here.

Thanks to Richard, Ben Kramer, and especially Craig Topper for all the
help here.

Differential Revision: https://reviews.llvm.org/D48464

llvm-svn: 335309
This commit is contained in:
Chandler Carruth 2018-06-21 23:46:09 +00:00
parent 342b095689
commit 16e6bc23a1
20 changed files with 340 additions and 300 deletions

View File

@ -8132,7 +8132,10 @@ def err_altivec_empty_initializer : Error<"expected initializer">;
def err_invalid_neon_type_code : Error<
"incompatible constant for this __builtin_neon function">;
def err_argument_invalid_range : Error<
"argument should be a value from %0 to %1">;
"argument value %0 is outside the valid range [%1, %2]">;
def warn_argument_invalid_range : Warning<
"argument value %0 is outside the valid range [%1, %2]">, DefaultError,
InGroup<DiagGroup<"argument-outside-range">>;
def err_argument_not_multiple : Error<
"argument should be a multiple of %0">;
def warn_neon_vector_initializer_non_portable : Warning<

View File

@ -10431,8 +10431,8 @@ private:
bool IsDelete);
bool SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
llvm::APSInt &Result);
bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
int Low, int High);
bool SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum, int Low,
int High, bool RangeIsError = true);
bool SemaBuiltinConstantArgMultiple(CallExpr *TheCall, int ArgNum,
unsigned Multiple);
bool SemaBuiltinARMSpecialReg(unsigned BuiltinID, CallExpr *TheCall,

View File

@ -2937,7 +2937,12 @@ bool Sema::CheckX86BuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
i = 4; l = 0; u = 255;
break;
}
return SemaBuiltinConstantArgRange(TheCall, i, l, u);
// Note that we don't force a hard error on the range check here, allowing
// template-generated or macro-generated dead code to potentially have out-of-
// range values. These need to code generate, but don't need to necessarily
// make any sense. We use a warning that defaults to an error.
return SemaBuiltinConstantArgRange(TheCall, i, l, u, /*RangeIsError*/ false);
}
/// Given a FunctionDecl's FormatAttr, attempts to populate the FomatStringInfo
@ -5005,7 +5010,7 @@ bool Sema::SemaBuiltinConstantArg(CallExpr *TheCall, int ArgNum,
/// SemaBuiltinConstantArgRange - Handle a check if argument ArgNum of CallExpr
/// TheCall is a constant expression in the range [Low, High].
bool Sema::SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
int Low, int High) {
int Low, int High, bool RangeIsError) {
llvm::APSInt Result;
// We can't check the value of a dependent argument.
@ -5017,9 +5022,18 @@ bool Sema::SemaBuiltinConstantArgRange(CallExpr *TheCall, int ArgNum,
if (SemaBuiltinConstantArg(TheCall, ArgNum, Result))
return true;
if (Result.getSExtValue() < Low || Result.getSExtValue() > High)
return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range)
<< Low << High << Arg->getSourceRange();
if (Result.getSExtValue() < Low || Result.getSExtValue() > High) {
if (RangeIsError)
return Diag(TheCall->getLocStart(), diag::err_argument_invalid_range)
<< Result.toString(10) << Low << High << Arg->getSourceRange();
else
// Defer the warning until we know if the code will be emitted so that
// dead code can ignore this.
DiagRuntimeBehavior(TheCall->getLocStart(), TheCall,
PDiag(diag::warn_argument_invalid_range)
<< Result.toString(10) << Low << High
<< Arg->getSourceRange());
}
return false;
}

View File

@ -7,10 +7,10 @@ void foo() {
int a = 3;
__builtin_mips_wrdsp(2052, a); // expected-error{{argument to '__builtin_mips_wrdsp' must be a constant integer}}
__builtin_mips_rddsp(a); // expected-error{{argument to '__builtin_mips_rddsp' must be a constant integer}}
__builtin_mips_wrdsp(2052, -1); // expected-error{{argument should be a value from 0 to 63}}
__builtin_mips_rddsp(-1); // expected-error{{argument should be a value from 0 to 63}}
__builtin_mips_wrdsp(2052, 64); // expected-error{{argument should be a value from 0 to 63}}
__builtin_mips_rddsp(64); // expected-error{{argument should be a value from 0 to 63}}
__builtin_mips_wrdsp(2052, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_rddsp(-1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_wrdsp(2052, 64); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_rddsp(64); // expected-error-re{{argument value {{.*}} is outside the valid range}}
// MIPS DSP Rev 2
@ -20,18 +20,18 @@ void foo() {
__builtin_mips_precr_sra_r_ph_w(1, 2, a); // expected-error{{argument to '__builtin_mips_precr_sra_r_ph_w' must be a constant integer}}
__builtin_mips_prepend(1, 2, a); // expected-error{{argument to '__builtin_mips_prepend' must be a constant integer}}
__builtin_mips_append(1, 2, -1); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_append(1, 2, 32); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_append(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_append(1, 2, 32); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_balign(1, 2, -1); // expected-error{{argument should be a value from 0 to 3}}
__builtin_mips_balign(1, 2, 4); // expected-error{{argument should be a value from 0 to 3}}
__builtin_mips_balign(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_balign(1, 2, 4); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_precr_sra_ph_w(1, 2, -1); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_precr_sra_ph_w(1, 2, 32); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_precr_sra_ph_w(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_precr_sra_ph_w(1, 2, 32); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_precr_sra_r_ph_w(1, 2, -1); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_precr_sra_r_ph_w(1, 2, 32); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_precr_sra_r_ph_w(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_precr_sra_r_ph_w(1, 2, 32); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_prepend(1, 2, -1); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_prepend(1, 2, -1); // expected-error{{argument should be a value from 0 to 31}}
__builtin_mips_prepend(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
__builtin_mips_prepend(1, 2, -1); // expected-error-re{{argument value {{.*}} is outside the valid range}}
}

View File

@ -27,148 +27,148 @@ const void * volatile cptr;
int cc;
void test_core(void) {
__builtin_s390_lcbb(cptr, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_lcbb(cptr, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_lcbb(cptr, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_lcbb(cptr, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_lcbb(cptr, len); // expected-error {{must be a constant integer}}
__builtin_s390_vlbb(cptr, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vlbb(cptr, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vlbb(cptr, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vlbb(cptr, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vlbb(cptr, len); // expected-error {{must be a constant integer}}
__builtin_s390_vpdi(vul, vul, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vpdi(vul, vul, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vpdi(vul, vul, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vpdi(vul, vul, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vpdi(vul, vul, len); // expected-error {{must be a constant integer}}
}
void test_integer(void) {
__builtin_s390_verimb(vuc, vuc, vuc, -1); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimb(vuc, vuc, vuc, 256); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimb(vuc, vuc, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimb(vuc, vuc, vuc, 256); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimb(vuc, vuc, vuc, len); // expected-error {{must be a constant integer}}
__builtin_s390_verimh(vus, vus, vus, -1); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimh(vus, vus, vus, 256); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimh(vus, vus, vus, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimh(vus, vus, vus, 256); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimh(vus, vus, vus, len); // expected-error {{must be a constant integer}}
__builtin_s390_verimf(vui, vui, vui, -1); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimf(vui, vui, vui, 256); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimf(vui, vui, vui, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimf(vui, vui, vui, 256); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimf(vui, vui, vui, len); // expected-error {{must be a constant integer}}
__builtin_s390_verimg(vul, vul, vul, -1); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimg(vul, vul, vul, 256); // expected-error {{argument should be a value from 0 to 255}}
__builtin_s390_verimg(vul, vul, vul, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimg(vul, vul, vul, 256); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_verimg(vul, vul, vul, len); // expected-error {{must be a constant integer}}
__builtin_s390_vsldb(vuc, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vsldb(vuc, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vsldb(vuc, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vsldb(vuc, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vsldb(vuc, vuc, len); // expected-error {{must be a constant integer}}
}
void test_string(void) {
__builtin_s390_vfaeb(vuc, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaeb(vuc, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaeb(vuc, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaeb(vuc, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaeb(vuc, vuc, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfaeh(vus, vus, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaeh(vus, vus, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaeh(vus, vus, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaeh(vus, vus, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaeh(vus, vus, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfaef(vui, vui, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaef(vui, vui, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaef(vui, vui, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaef(vui, vui, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaef(vui, vui, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfaezb(vuc, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezb(vuc, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezb(vuc, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezb(vuc, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezb(vuc, vuc, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfaezh(vus, vus, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezh(vus, vus, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezh(vus, vus, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezh(vus, vus, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezh(vus, vus, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfaezf(vui, vui, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezf(vui, vui, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezf(vui, vui, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezf(vui, vui, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezf(vui, vui, len); // expected-error {{must be a constant integer}}
__builtin_s390_vstrcb(vuc, vuc, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcb(vuc, vuc, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcb(vuc, vuc, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcb(vuc, vuc, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcb(vuc, vuc, vuc, len); // expected-error {{must be a constant integer}}
__builtin_s390_vstrch(vus, vus, vus, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrch(vus, vus, vus, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrch(vus, vus, vus, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrch(vus, vus, vus, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrch(vus, vus, vus, len); // expected-error {{must be a constant integer}}
__builtin_s390_vstrcf(vui, vui, vui, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcf(vui, vui, vui, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcf(vui, vui, vui, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcf(vui, vui, vui, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcf(vui, vui, vui, len); // expected-error {{must be a constant integer}}
__builtin_s390_vstrczb(vuc, vuc, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczb(vuc, vuc, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczb(vuc, vuc, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczb(vuc, vuc, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczb(vuc, vuc, vuc, len); // expected-error {{must be a constant integer}}
__builtin_s390_vstrczh(vus, vus, vus, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczh(vus, vus, vus, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczh(vus, vus, vus, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczh(vus, vus, vus, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczh(vus, vus, vus, len); // expected-error {{must be a constant integer}}
__builtin_s390_vstrczf(vui, vui, vui, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczf(vui, vui, vui, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczf(vui, vui, vui, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczf(vui, vui, vui, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczf(vui, vui, vui, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfaebs(vuc, vuc, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaebs(vuc, vuc, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaebs(vuc, vuc, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaebs(vuc, vuc, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaebs(vuc, vuc, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfaehs(vus, vus, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaehs(vus, vus, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaehs(vus, vus, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaehs(vus, vus, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaehs(vus, vus, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfaefs(vui, vui, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaefs(vui, vui, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaefs(vui, vui, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaefs(vui, vui, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaefs(vui, vui, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfaezbs(vuc, vuc, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezbs(vuc, vuc, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezbs(vuc, vuc, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezbs(vuc, vuc, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezbs(vuc, vuc, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfaezhs(vus, vus, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezhs(vus, vus, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezhs(vus, vus, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezhs(vus, vus, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezhs(vus, vus, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfaezfs(vui, vui, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezfs(vui, vui, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfaezfs(vui, vui, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezfs(vui, vui, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfaezfs(vui, vui, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vstrcbs(vuc, vuc, vuc, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcbs(vuc, vuc, vuc, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcbs(vuc, vuc, vuc, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcbs(vuc, vuc, vuc, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcbs(vuc, vuc, vuc, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vstrchs(vus, vus, vus, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrchs(vus, vus, vus, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrchs(vus, vus, vus, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrchs(vus, vus, vus, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrchs(vus, vus, vus, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vstrcfs(vui, vui, vui, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcfs(vui, vui, vui, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrcfs(vui, vui, vui, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcfs(vui, vui, vui, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrcfs(vui, vui, vui, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vstrczbs(vuc, vuc, vuc, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczbs(vuc, vuc, vuc, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczbs(vuc, vuc, vuc, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczbs(vuc, vuc, vuc, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczbs(vuc, vuc, vuc, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vstrczhs(vus, vus, vus, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczhs(vus, vus, vus, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczhs(vus, vus, vus, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczhs(vus, vus, vus, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczhs(vus, vus, vus, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vstrczfs(vui, vui, vui, -1, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczfs(vui, vui, vui, 16, &cc); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vstrczfs(vui, vui, vui, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczfs(vui, vui, vui, 16, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vstrczfs(vui, vui, vui, len, &cc); // expected-error {{must be a constant integer}}
}
void test_float(void) {
__builtin_s390_vftcidb(vd, -1, &cc); // expected-error {{argument should be a value from 0 to 4095}}
__builtin_s390_vftcidb(vd, 4096, &cc); // expected-error {{argument should be a value from 0 to 4095}}
__builtin_s390_vftcidb(vd, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vftcidb(vd, 4096, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vftcidb(vd, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfidb(vd, -1, 0); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfidb(vd, 16, 0); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfidb(vd, -1, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfidb(vd, 16, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfidb(vd, len, 0); // expected-error {{must be a constant integer}}
__builtin_s390_vfidb(vd, 0, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfidb(vd, 0, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfidb(vd, 0, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfidb(vd, 0, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfidb(vd, 0, len); // expected-error {{must be a constant integer}}
}

View File

@ -28,34 +28,34 @@ volatile unsigned int len;
int cc;
void test_integer(void) {
__builtin_s390_vmslg(vul, vul, vuc, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vmslg(vul, vul, vuc, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vmslg(vul, vul, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vmslg(vul, vul, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vmslg(vul, vul, vuc, len); // expected-error {{must be a constant integer}}
}
void test_float(void) {
__builtin_s390_vfmaxdb(vd, vd, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfmaxdb(vd, vd, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfmaxdb(vd, vd, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfmaxdb(vd, vd, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfmaxdb(vd, vd, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfmindb(vd, vd, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfmindb(vd, vd, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfmindb(vd, vd, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfmindb(vd, vd, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfmindb(vd, vd, len); // expected-error {{must be a constant integer}}
__builtin_s390_vftcisb(vf, -1, &cc); // expected-error {{argument should be a value from 0 to 4095}}
__builtin_s390_vftcisb(vf, 4096, &cc); // expected-error {{argument should be a value from 0 to 4095}}
__builtin_s390_vftcisb(vf, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vftcisb(vf, 4096, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vftcisb(vf, len, &cc); // expected-error {{must be a constant integer}}
__builtin_s390_vfisb(vf, -1, 0); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfisb(vf, 16, 0); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfisb(vf, -1, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfisb(vf, 16, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfisb(vf, len, 0); // expected-error {{must be a constant integer}}
__builtin_s390_vfisb(vf, 0, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfisb(vf, 0, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfisb(vf, 0, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfisb(vf, 0, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfisb(vf, 0, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfmaxsb(vf, vf, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfmaxsb(vf, vf, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfmaxsb(vf, vf, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfmaxsb(vf, vf, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfmaxsb(vf, vf, len); // expected-error {{must be a constant integer}}
__builtin_s390_vfminsb(vf, vf, -1); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfminsb(vf, vf, 16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_s390_vfminsb(vf, vf, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfminsb(vf, vf, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_s390_vfminsb(vf, vf, len); // expected-error {{must be a constant integer}}
}

View File

@ -560,6 +560,6 @@ void test_float(void) {
// expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 31}}
vbl = vec_fp_test_data_class(vd, idx, &cc); // expected-error {{must be a constant integer}}
vbl = vec_fp_test_data_class(vd, -1, &cc); // expected-error {{should be a value from 0 to 4095}}
vbl = vec_fp_test_data_class(vd, 4096, &cc); // expected-error {{should be a value from 0 to 4095}}
vbl = vec_fp_test_data_class(vd, -1, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vbl = vec_fp_test_data_class(vd, 4096, &cc); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}

View File

@ -127,8 +127,8 @@ void test_integer(void) {
// expected-note@vecintrin.h:* 1 {{must be a constant integer from 0 to 15}}
vuc = vec_msum_u128(vul, vul, vuc, idx); // expected-error {{must be a constant integer}}
vuc = vec_msum_u128(vul, vul, vuc, -1); // expected-error {{should be a value from 0 to 15}}
vuc = vec_msum_u128(vul, vul, vuc, 16); // expected-error {{should be a value from 0 to 15}}
vuc = vec_msum_u128(vul, vul, vuc, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vuc = vec_msum_u128(vul, vul, vuc, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_float(void) {

View File

@ -2,13 +2,13 @@
// RUN: %clang_cc1 -fsyntax-only -triple hexagon-unknown-elf -verify %s
int foo(int x) {
// expected-error@+2 {{argument should be a value from 0 to 31}}
// expected-error@+1 {{argument should be a value from 0 to 31}}
// expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
// expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
return __builtin_HEXAGON_S4_extract(x, 33, -1) +
// expected-error@+1 {{argument should be a value from 0 to 31}}
// expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
__builtin_HEXAGON_S4_extract(x, 3, 91) +
// expected-error@+2 {{argument should be a value from 0 to 31}}
// expected-error@+1 {{argument should be a value from 0 to 31}}
// expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
// expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
__builtin_HEXAGON_S4_extract(x, -1, 35) +
__builtin_HEXAGON_S4_extract(x, 0, 31) +
__builtin_HEXAGON_S4_extract(x, 31, 0);
@ -17,13 +17,13 @@ int foo(int x) {
int bar(void *p, void *q, int x) {
// expected-error@+1 {{argument should be a multiple of 4}}
return __builtin_HEXAGON_L2_loadri_pci(p, -1, x, q) +
// expected-error@+2 {{argument should be a value from -32 to 28}}
// expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
// expected-error@+1 {{argument should be a multiple of 4}}
__builtin_HEXAGON_L2_loadri_pci(p, -99, x, q) +
// expected-error@+1 {{argument should be a value from -32 to 28}}
// expected-error-re@+1 {{argument value {{.*}} is outside the valid range}}
__builtin_HEXAGON_L2_loadri_pci(p, -132, x, q) +
__builtin_HEXAGON_L2_loadri_pci(p, 28, x, q) +
// expected-error@+2 {{argument should be a value from -32 to 28}}
// expected-error-re@+2 {{argument value {{.*}} is outside the valid range}}
// expected-error@+1 {{argument should be a multiple of 4}}
__builtin_HEXAGON_L2_loadri_pci(p, 29, x, q);
}

View File

@ -7,58 +7,58 @@
void test_vcvt_f16_16(int16_t a){
vcvth_n_f16_s16(a, 1);
vcvth_n_f16_s16(a, 16);
vcvth_n_f16_s16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_s16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_s16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_s16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_u16(a, 1);
vcvth_n_f16_u16(a, 16);
vcvth_n_f16_u16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_u16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_u16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_u16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_vcvt_f16_32(int32_t a){
vcvth_n_f16_u32(a, 1);
vcvth_n_f16_u32(a, 16);
vcvth_n_f16_u32(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_u32(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_u32(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_u32(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_s32(a, 1);
vcvth_n_f16_s32(a, 16);
vcvth_n_f16_s32(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_s32(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_s32(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_s32(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_vcvt_f16_64(int64_t a){
vcvth_n_f16_s64(a, 1);
vcvth_n_f16_s64(a, 16);
vcvth_n_f16_s64(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_s64(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_f16_s64(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_f16_s64(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_vcvt_su_f(float16_t a){
vcvth_n_s16_f16(a, 1);
vcvth_n_s16_f16(a, 16);
vcvth_n_s16_f16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_s16_f16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_s16_f16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_s16_f16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_s32_f16(a, 1);
vcvth_n_s32_f16(a, 16);
vcvth_n_s32_f16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_s32_f16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_s32_f16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_s32_f16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_s64_f16(a, 1);
vcvth_n_s64_f16(a, 16);
vcvth_n_s64_f16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_s64_f16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_s64_f16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_s64_f16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_u16_f16(a, 1);
vcvth_n_u16_f16(a, 16);
vcvth_n_u16_f16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_u16_f16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_u16_f16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_u16_f16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_u32_f16(a, 1);
vcvth_n_u32_f16(a, 16);
vcvth_n_u32_f16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_u32_f16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
vcvth_n_u32_f16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vcvth_n_u32_f16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}

View File

@ -11,12 +11,12 @@ void test_vext_8bit(int8x8_t small, int8x16_t big) {
vextq_u8(big, big, 15);
vextq_p8(big, big, 15);
vext_s8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
vext_u8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
vext_p8(small, small, 8); // expected-error {{argument should be a value from 0 to 7}}
vextq_s8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
vextq_u8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
vextq_p8(big, big, 16); // expected-error {{argument should be a value from 0 to 15}}
vext_s8(small, small, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vext_u8(small, small, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vext_p8(small, small, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vextq_s8(big, big, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vextq_u8(big, big, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vextq_p8(big, big, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_mul_lane_f64(float64x1_t small, float64x2_t big, float64x2_t rhs) {
@ -29,11 +29,11 @@ void test_mul_lane_f64(float64x1_t small, float64x2_t big, float64x2_t rhs) {
vfmaq_lane_f64(big, big, small, 0);
vfmaq_laneq_f64(big, big, big, 1);
vmul_lane_f64(small, small, 1); // expected-error {{argument should be a value from 0 to 0}}
vmul_laneq_f64(small, big, 2); // expected-error {{argument should be a value from 0 to 1}}
vfma_lane_f64(small, small, small, 1); // expected-error {{argument should be a value from 0 to 0}}
vfma_laneq_f64(small, small, big, 2); // expected-error {{argument should be a value from 0 to 1}}
vfmaq_laneq_f64(big, big, big, 2); // expected-error {{argument should be a value from 0 to 1}}
vmul_lane_f64(small, small, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vmul_laneq_f64(small, big, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vfma_lane_f64(small, small, small, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vfma_laneq_f64(small, small, big, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vfmaq_laneq_f64(big, big, big, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_ld1st1(int8x8_t small, int8x16_t big, void *addr) {
@ -47,15 +47,15 @@ void test_ld1st1(int8x8_t small, int8x16_t big, void *addr) {
vld1q_lane_s32(addr, big, 3);
vld1q_lane_s64(addr, big, 1);
vld1_lane_s8(addr, small, 8); // expected-error {{argument should be a value from 0 to 7}}
vld1_lane_s16(addr, small, 4); // expected-error {{argument should be a value from 0 to 3}}
vld1_lane_s32(addr, small, 2); // expected-error {{argument should be a value from 0 to 1}}
vld1_lane_s64(addr, small, 1); // expected-error {{argument should be a value from 0 to 0}}
vld1_lane_s8(addr, small, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1_lane_s16(addr, small, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1_lane_s32(addr, small, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1_lane_s64(addr, small, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1q_lane_s8(addr, big, 16); // expected-error {{argument should be a value from 0 to 15}}
vld1q_lane_s16(addr, big, 8); // expected-error {{argument should be a value from 0 to 7}}
vld1q_lane_s32(addr, big, 4); // expected-error {{argument should be a value from 0 to 3}}
vld1q_lane_s64(addr, big, 2); // expected-error {{argument should be a value from 0 to 1}}
vld1q_lane_s8(addr, big, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1q_lane_s16(addr, big, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1q_lane_s32(addr, big, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld1q_lane_s64(addr, big, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1_lane_s8(addr, small, 7);
vst1_lane_s16(addr, small, 3);
@ -67,15 +67,15 @@ void test_ld1st1(int8x8_t small, int8x16_t big, void *addr) {
vst1q_lane_s32(addr, big, 3);
vst1q_lane_s64(addr, big, 1);
vst1_lane_s8(addr, small, 8); // expected-error {{argument should be a value from 0 to 7}}
vst1_lane_s16(addr, small, 4); // expected-error {{argument should be a value from 0 to 3}}
vst1_lane_s32(addr, small, 2); // expected-error {{argument should be a value from 0 to 1}}
vst1_lane_s64(addr, small, 1); // expected-error {{argument should be a value from 0 to 0}}
vst1_lane_s8(addr, small, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1_lane_s16(addr, small, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1_lane_s32(addr, small, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1_lane_s64(addr, small, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1q_lane_s8(addr, big, 16); // expected-error {{argument should be a value from 0 to 15}}
vst1q_lane_s16(addr, big, 8); // expected-error {{argument should be a value from 0 to 7}}
vst1q_lane_s32(addr, big, 4); // expected-error {{argument should be a value from 0 to 3}}
vst1q_lane_s64(addr, big, 2); // expected-error {{argument should be a value from 0 to 1}}
vst1q_lane_s8(addr, big, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1q_lane_s16(addr, big, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1q_lane_s32(addr, big, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst1q_lane_s64(addr, big, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_ld2st2(int8x8x2_t small8, int8x16x2_t big8,
@ -93,15 +93,15 @@ void test_ld2st2(int8x8x2_t small8, int8x16x2_t big8,
vld2q_lane_s32(addr, big32, 3);
vld2q_lane_s64(addr, big64, 1);
vld2_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
vld2_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
vld2_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
vld2_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
vld2_lane_s8(addr, small8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2_lane_s16(addr, small16, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2_lane_s32(addr, small32, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2_lane_s64(addr, small64, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
vld2q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
vld2q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
vld2q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
vld2q_lane_s8(addr, big8, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2q_lane_s16(addr, big16, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2q_lane_s32(addr, big32, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld2q_lane_s64(addr, big64, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2_lane_s8(addr, small8, 7);
vst2_lane_s16(addr, small16, 3);
@ -113,15 +113,15 @@ void test_ld2st2(int8x8x2_t small8, int8x16x2_t big8,
vst2q_lane_s32(addr, big32, 3);
vst2q_lane_s64(addr, big64, 1);
vst2_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
vst2_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
vst2_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
vst2_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
vst2_lane_s8(addr, small8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2_lane_s16(addr, small16, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2_lane_s32(addr, small32, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2_lane_s64(addr, small64, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
vst2q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
vst2q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
vst2q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
vst2q_lane_s8(addr, big8, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2q_lane_s16(addr, big16, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2q_lane_s32(addr, big32, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst2q_lane_s64(addr, big64, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_ld3st3(int8x8x3_t small8, int8x16x3_t big8,
@ -139,15 +139,15 @@ void test_ld3st3(int8x8x3_t small8, int8x16x3_t big8,
vld3q_lane_s32(addr, big32, 3);
vld3q_lane_s64(addr, big64, 1);
vld3_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
vld3_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
vld3_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
vld3_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
vld3_lane_s8(addr, small8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3_lane_s16(addr, small16, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3_lane_s32(addr, small32, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3_lane_s64(addr, small64, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
vld3q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
vld3q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
vld3q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
vld3q_lane_s8(addr, big8, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3q_lane_s16(addr, big16, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3q_lane_s32(addr, big32, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld3q_lane_s64(addr, big64, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3_lane_s8(addr, small8, 7);
vst3_lane_s16(addr, small16, 3);
@ -159,15 +159,15 @@ void test_ld3st3(int8x8x3_t small8, int8x16x3_t big8,
vst3q_lane_s32(addr, big32, 3);
vst3q_lane_s64(addr, big64, 1);
vst3_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
vst3_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
vst3_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
vst3_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
vst3_lane_s8(addr, small8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3_lane_s16(addr, small16, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3_lane_s32(addr, small32, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3_lane_s64(addr, small64, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
vst3q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
vst3q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
vst3q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
vst3q_lane_s8(addr, big8, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3q_lane_s16(addr, big16, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3q_lane_s32(addr, big32, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst3q_lane_s64(addr, big64, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_ld4st4(int8x8x4_t small8, int8x16x4_t big8,
@ -185,15 +185,15 @@ void test_ld4st4(int8x8x4_t small8, int8x16x4_t big8,
vld4q_lane_s32(addr, big32, 3);
vld4q_lane_s64(addr, big64, 1);
vld4_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
vld4_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
vld4_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
vld4_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
vld4_lane_s8(addr, small8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4_lane_s16(addr, small16, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4_lane_s32(addr, small32, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4_lane_s64(addr, small64, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
vld4q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
vld4q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
vld4q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
vld4q_lane_s8(addr, big8, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4q_lane_s16(addr, big16, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4q_lane_s32(addr, big32, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vld4q_lane_s64(addr, big64, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4_lane_s8(addr, small8, 7);
vst4_lane_s16(addr, small16, 3);
@ -205,14 +205,14 @@ void test_ld4st4(int8x8x4_t small8, int8x16x4_t big8,
vst4q_lane_s32(addr, big32, 3);
vst4q_lane_s64(addr, big64, 1);
vst4_lane_s8(addr, small8, 8); // expected-error {{argument should be a value from 0 to 7}}
vst4_lane_s16(addr, small16, 4); // expected-error {{argument should be a value from 0 to 3}}
vst4_lane_s32(addr, small32, 2); // expected-error {{argument should be a value from 0 to 1}}
vst4_lane_s64(addr, small64, 1); // expected-error {{argument should be a value from 0 to 0}}
vst4_lane_s8(addr, small8, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4_lane_s16(addr, small16, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4_lane_s32(addr, small32, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4_lane_s64(addr, small64, 1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4q_lane_s8(addr, big8, 16); // expected-error {{argument should be a value from 0 to 15}}
vst4q_lane_s16(addr, big16, 8); // expected-error {{argument should be a value from 0 to 7}}
vst4q_lane_s32(addr, big32, 4); // expected-error {{argument should be a value from 0 to 3}}
vst4q_lane_s64(addr, big64, 2); // expected-error {{argument should be a value from 0 to 1}}
vst4q_lane_s8(addr, big8, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4q_lane_s16(addr, big16, 8); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4q_lane_s32(addr, big32, 4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vst4q_lane_s64(addr, big64, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}

View File

@ -17,7 +17,7 @@ float32x2_t test2(uint32x2_t x) {
float32x2_t test3(uint32x2_t x) {
// FIXME: The "incompatible result type" error is due to pr10112 and should be
// removed when that is fixed.
return vcvt_n_f32_u32(x, 0); // expected-error {{argument should be a value from 1 to 32}}
return vcvt_n_f32_u32(x, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
typedef signed int vSInt32 __attribute__((__vector_size__(16)));

View File

@ -13,10 +13,10 @@ int f1() {
__builtin_object_size(&a, 3));
}
int f2() {
return __builtin_object_size(&a, -1); // expected-error {{argument should be a value from 0 to 3}}
return __builtin_object_size(&a, -1); // expected-error {{argument value -1 is outside the valid range [0, 3]}}
}
int f3() {
return __builtin_object_size(&a, 4); // expected-error {{argument should be a value from 0 to 3}}
return __builtin_object_size(&a, 4); // expected-error {{argument value 4 is outside the valid range [0, 3]}}
}
@ -41,7 +41,7 @@ void f5(void)
char buf[10];
memset((void *)0x100000000ULL, 0, 0x1000);
memcpy((char *)NULL + 0x10000, buf, 0x10);
memcpy1((char *)NULL + 0x10000, buf, 0x10); // expected-error {{argument should be a value from 0 to 3}}
memcpy1((char *)NULL + 0x10000, buf, 0x10); // expected-error {{argument value 4 is outside the valid range [0, 3]}}
}
// rdar://18431336

View File

@ -8,7 +8,7 @@ void foo() {
__builtin_prefetch(&a, 1, 9, 3); // expected-error{{too many arguments to function}}
__builtin_prefetch(&a, "hello", 2); // expected-error{{argument to '__builtin_prefetch' must be a constant integer}}
__builtin_prefetch(&a, a, 2); // expected-error{{argument to '__builtin_prefetch' must be a constant integer}}
__builtin_prefetch(&a, 2); // expected-error{{argument should be a value from 0 to 1}}
__builtin_prefetch(&a, 0, 4); // expected-error{{argument should be a value from 0 to 3}}
__builtin_prefetch(&a, -1, 4); // expected-error{{argument should be a value from 0 to 1}}
__builtin_prefetch(&a, 2); // expected-error{{argument value 2 is outside the valid range [0, 1]}}
__builtin_prefetch(&a, 0, 4); // expected-error{{argument value 4 is outside the valid range [0, 3]}}
__builtin_prefetch(&a, -1, 4); // expected-error{{argument value -1 is outside the valid range [0, 1]}}
}

View File

@ -35,18 +35,18 @@ void test2() {
#endif
void test3() {
__builtin_arm_dsb(16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_dmb(17); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_isb(18); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_dsb(16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_dmb(17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_isb(18); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test4() {
__builtin_arm_prefetch(0, 2, 0); // expected-error {{argument should be a value from 0 to 1}}
__builtin_arm_prefetch(0, 0, 2); // expected-error {{argument should be a value from 0 to 1}}
__builtin_arm_prefetch(0, 2, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test5() {
__builtin_arm_dbg(16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_dbg(16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test6(int a, int b, int c) {
@ -168,14 +168,14 @@ void test_9_4_1_width_specified_saturation(int a, int b) {
s = __builtin_arm_ssat(8, 2);
s = __builtin_arm_ssat(a, 1);
s = __builtin_arm_ssat(a, 32);
s = __builtin_arm_ssat(a, 0); // expected-error {{argument should be a value from 1 to 32}}
s = __builtin_arm_ssat(a, 33); // expected-error {{argument should be a value from 1 to 32}}
s = __builtin_arm_ssat(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
s = __builtin_arm_ssat(a, 33); // expected-error-re {{argument value {{.*}} is outside the valid range}}
s = __builtin_arm_ssat(a, b); // expected-error {{argument to '__builtin_arm_ssat' must be a constant integer}}
u = __builtin_arm_usat(8, 2);
u = __builtin_arm_usat(a, 0);
u = __builtin_arm_usat(a, 31);
u = __builtin_arm_usat(a, 32); // expected-error {{argument should be a value from 0 to 31}}
u = __builtin_arm_usat(a, 32); // expected-error-re {{argument value {{.*}} is outside the valid range}}
u = __builtin_arm_usat(a, b); // expected-error {{argument to '__builtin_arm_usat' must be a constant integer}}
}
@ -215,12 +215,12 @@ void test_9_5_4_parallel_16bit_saturation(int16x2_t a) {
s = __builtin_arm_ssat16(a, 1);
s = __builtin_arm_ssat16(a, 16);
s = __builtin_arm_ssat16(a, 0); // expected-error {{argument should be a value from 1 to 16}}
s = __builtin_arm_ssat16(a, 17); // expected-error {{argument should be a value from 1 to 16}}
s = __builtin_arm_ssat16(a, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
s = __builtin_arm_ssat16(a, 17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
u = __builtin_arm_usat16(a, 0);
u = __builtin_arm_usat16(a, 15);
u = __builtin_arm_usat16(a, 16); // expected-error {{argument should be a value from 0 to 15}}
u = __builtin_arm_usat16(a, 16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_9_5_5_packing_and_unpacking(int16x2_t a, int8x4_t b, uint16x2_t c, uint8x4_t d) {
@ -327,11 +327,11 @@ void test_VFP(float f, double d) {
fr = __builtin_arm_vcvtr_f(f, 0);
fr = __builtin_arm_vcvtr_f(f, 1);
fr = __builtin_arm_vcvtr_f(f, -1); // expected-error {{argument should be a value from 0 to 1}}
fr = __builtin_arm_vcvtr_f(f, 2); // expected-error {{argument should be a value from 0 to 1}}
fr = __builtin_arm_vcvtr_f(f, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
fr = __builtin_arm_vcvtr_f(f, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
dr = __builtin_arm_vcvtr_f(d, 0);
dr = __builtin_arm_vcvtr_f(d, 1);
dr = __builtin_arm_vcvtr_f(d, -1); // expected-error {{argument should be a value from 0 to 1}}
dr = __builtin_arm_vcvtr_f(d, 2); // expected-error {{argument should be a value from 0 to 1}}
dr = __builtin_arm_vcvtr_f(d, -1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
dr = __builtin_arm_vcvtr_f(d, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}

View File

@ -18,14 +18,14 @@ void test_clear_cache_no_args() {
}
void test_memory_barriers() {
__builtin_arm_dmb(16); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_dsb(17); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_isb(18); // expected-error {{argument should be a value from 0 to 15}}
__builtin_arm_dmb(16); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_dsb(17); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_isb(18); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
void test_prefetch() {
__builtin_arm_prefetch(0, 2, 0, 0, 0); // expected-error {{argument should be a value from 0 to 1}}
__builtin_arm_prefetch(0, 0, 3, 0, 0); // expected-error {{argument should be a value from 0 to 2}}
__builtin_arm_prefetch(0, 0, 0, 2, 0); // expected-error {{argument should be a value from 0 to 1}}
__builtin_arm_prefetch(0, 0, 0, 0, 2); // expected-error {{argument should be a value from 0 to 1}}
__builtin_arm_prefetch(0, 2, 0, 0, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 3, 0, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 0, 2, 0); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_arm_prefetch(0, 0, 0, 0, 2); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}

View File

@ -9,15 +9,15 @@
#ifdef TEST_HTM
void test_htm() {
__builtin_tbegin(4); // expected-error {{argument should be a value from 0 to 1}}
__builtin_tend(-1); // expected-error {{argument should be a value from 0 to 1}}
__builtin_tsr(55); // expected-error {{argument should be a value from 0 to 7}}
__builtin_tabortwc(-5, 2, 3); // expected-error {{argument should be a value from 0 to 31}}
__builtin_tabortdc(55, 2, 3); // expected-error {{argument should be a value from 0 to 31}}
__builtin_tabortwci(-5, 2, 5); // expected-error {{argument should be a value from 0 to 31}}
__builtin_tabortwci(5, 2, 55); // expected-error {{argument should be a value from 0 to 31}}
__builtin_tabortdci(-5, 2, 5); // expected-error {{argument should be a value from 0 to 31}}
__builtin_tabortdci(5, 2, 55); // expected-error {{argument should be a value from 0 to 31}}
__builtin_tbegin(4); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tend(-1); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tsr(55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tabortwc(-5, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tabortdc(55, 2, 3); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tabortwci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tabortwci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tabortdci(-5, 2, 5); // expected-error-re {{argument value {{.*}} is outside the valid range}}
__builtin_tabortdci(5, 2, 55); // expected-error-re {{argument value {{.*}} is outside the valid range}}
}
#endif
@ -30,20 +30,20 @@ void test_htm() {
vector unsigned int test_vshasigmaw_or(void)
{
vector unsigned int a = W_INIT
vector unsigned int b = __builtin_crypto_vshasigmaw(a, 2, 15); // expected-error {{argument should be a value from 0 to 1}}
vector unsigned int c = __builtin_crypto_vshasigmaw(a, -1, 15); // expected-error {{argument should be a value from 0 to 1}}
vector unsigned int d = __builtin_crypto_vshasigmaw(a, 0, 85); // expected-error {{argument should be a value from 0 to 15}}
vector unsigned int e = __builtin_crypto_vshasigmaw(a, 1, -15); // expected-error {{argument should be a value from 0 to 15}}
vector unsigned int b = __builtin_crypto_vshasigmaw(a, 2, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vector unsigned int c = __builtin_crypto_vshasigmaw(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vector unsigned int d = __builtin_crypto_vshasigmaw(a, 0, 85); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vector unsigned int e = __builtin_crypto_vshasigmaw(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
return __builtin_crypto_vshasigmaw(a, 1, 15);
}
vector unsigned long long test_vshasigmad_or(void)
{
vector unsigned long long a = D_INIT
vector unsigned long long b = __builtin_crypto_vshasigmad(a, 2, 15); // expected-error {{argument should be a value from 0 to 1}}
vector unsigned long long c = __builtin_crypto_vshasigmad(a, -1, 15); // expected-error {{argument should be a value from 0 to 1}}
vector unsigned long long d = __builtin_crypto_vshasigmad(a, 0, 85); // expected-error {{argument should be a value from 0 to 1}}
vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error {{argument should be a value from 0 to 1}}
vector unsigned long long b = __builtin_crypto_vshasigmad(a, 2, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vector unsigned long long c = __builtin_crypto_vshasigmad(a, -1, 15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vector unsigned long long d = __builtin_crypto_vshasigmad(a, 0, 85); // expected-error-re {{argument value {{.*}} is outside the valid range}}
vector unsigned long long e = __builtin_crypto_vshasigmad(a, 1, -15); // expected-error-re {{argument value {{.*}} is outside the valid range}}
return __builtin_crypto_vshasigmad(a, 0, 15);
}

View File

@ -22,145 +22,145 @@ void call_x86_32_builtins(void) {
}
__m128 test__builtin_ia32_cmpps(__m128 __a, __m128 __b) {
__builtin_ia32_cmpps(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}}
return __builtin_ia32_cmpps(__a, __b, 32); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
}
__m128d test__builtin_ia32_cmppd(__m128d __a, __m128d __b) {
__builtin_ia32_cmppd(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}}
return __builtin_ia32_cmppd(__a, __b, 32); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
}
__m128 test__builtin_ia32_cmpss(__m128 __a, __m128 __b) {
__builtin_ia32_cmpss(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}}
return __builtin_ia32_cmpss(__a, __b, 32); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
}
__m128d test__builtin_ia32_cmpsd(__m128d __a, __m128d __b) {
__builtin_ia32_cmpsd(__a, __b, 32); // expected-error {{argument should be a value from 0 to 31}}
return __builtin_ia32_cmpsd(__a, __b, 32); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
}
__mmask16 test__builtin_ia32_cmpps512_mask(__m512d __a, __m512d __b) {
__builtin_ia32_cmpps512_mask(__a, __b, 32, -1, 4); // expected-error {{argument should be a value from 0 to 31}}
return __builtin_ia32_cmpps512_mask(__a, __b, 32, -1, 4); // expected-error {{argument value 32 is outside the valid range [0, 31]}}
}
__mmask8 test__builtin_ia32_cmppd512_mask(__m512d __a, __m512d __b) {
__builtin_ia32_cmppd512_mask(__a, __b, 32, -1, 4); // expected-error {{argument should be a value from 0 to 31}}
return __builtin_ia32_cmppd512_mask(__a, __b, 32, -1, 4); // expected-error {{argument value 32 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomub(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomuw(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomud(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomuq(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomub(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomuw(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomud(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 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}}
return __builtin_ia32_vpcomuq(__a, __b, 8); // expected-error {{argument value 8 is outside the valid range [0, 7]}}
}
__mmask16 test__builtin_ia32_cmpps512_mask_rounding(__m512 __a, __m512 __b, __mmask16 __u) {
__builtin_ia32_cmpps512_mask(__a, __b, 0, __u, 0); // expected-error {{invalid rounding argument}}
return __builtin_ia32_cmpps512_mask(__a, __b, 0, __u, 0); // expected-error {{invalid rounding argument}}
}
__m128i test_mm_mask_i32gather_epi32(__m128i a, int const *b, __m128i c, __m128i mask) {
return __builtin_ia32_gatherd_d(a, b, c, mask, 5); // expected-error {{scale argument must be 1, 2, 4, or 8}}
}
__m512i _mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, int const *addr) {
return __builtin_ia32_gatherpfdps(mask, index, addr, 5, 1); // expected-error {{scale argument must be 1, 2, 4, or 8}}
void _mm512_mask_prefetch_i32gather_ps(__m512i index, __mmask16 mask, int const *addr) {
__builtin_ia32_gatherpfdps(mask, index, addr, 5, 1); // expected-error {{scale argument must be 1, 2, 4, or 8}}
}
__m512 _mm512_mask_prefetch_i32gather_ps_2(__m512i index, __mmask16 mask, int const *addr) {
return __builtin_ia32_gatherpfdps(mask, index, addr, 1, 1); // expected-error {{argument should be a value from 2 to 3}}
void _mm512_mask_prefetch_i32gather_ps_2(__m512i index, __mmask16 mask, int const *addr) {
__builtin_ia32_gatherpfdps(mask, index, addr, 1, 1); // expected-error {{argument value 1 is outside the valid range [2, 3]}}
}
__m512i test_mm512_shldi_epi64(__m512i __A, __m512i __B) {
return __builtin_ia32_vpshldq512(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldq512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m512i test_mm512_shldi_epi32(__m512i __A, __m512i __B) {
return __builtin_ia32_vpshldd512(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldd512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m512i test_mm512_shldi_epi16(__m512i __A, __m512i __B) {
return __builtin_ia32_vpshldw512(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldw512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m512i test_mm512_shrdi_epi64(__m512i __A, __m512i __B) {
return __builtin_ia32_vpshrdq512(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdq512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m512i test_mm512_shrdi_epi32(__m512i __A, __m512i __B) {
return __builtin_ia32_vpshrdd512(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdd512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m512i test_mm512_shrdi_epi16(__m512i __A, __m512i __B) {
return __builtin_ia32_vpshrdw512(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdw512(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m256i test_mm256_shldi_epi64(__m256i __A, __m256i __B) {
return __builtin_ia32_vpshldq256(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldq256(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m128i test_mm128_shldi_epi64( __m128i __A, __m128i __B) {
return __builtin_ia32_vpshldq128(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldq128(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m256i test_mm256_shldi_epi32(__m256i __A, __m256i __B) {
return __builtin_ia32_vpshldd256(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldd256(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m128i test_mm128_shldi_epi32(__m128i __A, __m128i __B) {
return __builtin_ia32_vpshldd128(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldd128(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m256i test_mm256_shldi_epi16( __m256i __A, __m256i __B) {
return __builtin_ia32_vpshldw256(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldw256(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m128i test_mm128_shldi_epi16(__m128i __A, __m128i __B) {
return __builtin_ia32_vpshldw128(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshldw128(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m256i test_mm256_shrdi_epi64(__m256i __A, __m256i __B) {
return __builtin_ia32_vpshrdq256(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdq256(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m128i test_mm128_shrdi_epi64(__m128i __A, __m128i __B) {
return __builtin_ia32_vpshrdq128(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdq128(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m256i test_mm256_shrdi_epi32(__m256i __A, __m256i __B) {
return __builtin_ia32_vpshrdd256(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdd256(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m128i test_mm128_shrdi_epi32(__m128i __A, __m128i __B) {
return __builtin_ia32_vpshrdd128(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdd128(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m256i test_mm256_shrdi_epi16(__m256i __A, __m256i __B) {
return __builtin_ia32_vpshrdw256(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdw256(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}
__m128i test_mm128_shrdi_epi16(__m128i __A, __m128i __B) {
return __builtin_ia32_vpshrdw128(__A, __B, 1024); // expected-error {{argument should be a value from 0 to 255}}
return __builtin_ia32_vpshrdw128(__A, __B, 1024); // expected-error {{argument value 1024 is outside the valid range [0, 255]}}
}

View File

@ -0,0 +1,23 @@
// RUN: %clang_cc1 -triple=x86_64-apple-darwin -fsyntax-only -verify %s
//
// Ensure that when we use builtins in C++ code with templates that compute the
// valid immediate, the dead code with the invalid immediate doesn't error.
typedef short __v8hi __attribute__((__vector_size__(16)));
template <int Imm>
__v8hi test(__v8hi a) {
if (Imm < 4)
return __builtin_ia32_pshuflw(a, 0x55 * Imm);
else
return __builtin_ia32_pshuflw(a, 0x55 * (Imm - 4));
}
template __v8hi test<0>(__v8hi);
template __v8hi test<1>(__v8hi);
template __v8hi test<2>(__v8hi);
template __v8hi test<3>(__v8hi);
template __v8hi test<4>(__v8hi);
template __v8hi test<5>(__v8hi);
template __v8hi test<6>(__v8hi);
template __v8hi test<7>(__v8hi);

View File

@ -35,7 +35,7 @@ namespace rdar11688587 {
extern float32x4_t vec;
return __extension__ ({
float32x4_t __a = (vec);
(float32_t)__builtin_neon_vgetq_lane_f32(__a, I); // expected-error{{argument should be a value from 0 to 3}}
(float32_t)__builtin_neon_vgetq_lane_f32(__a, I); // expected-error-re{{argument value {{.*}} is outside the valid range}}
});
}