diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -3351,6 +3351,11 @@ case PPC::BI__builtin_tabortdci: return SemaBuiltinConstantArgRange(TheCall, 0, 0, 31) || SemaBuiltinConstantArgRange(TheCall, 2, 0, 31); + case PPC::BI__builtin_altivec_vctsxs: + case PPC::BI__builtin_altivec_vctuxs: + case PPC::BI__builtin_altivec_vcfsx: + case PPC::BI__builtin_altivec_vcfux: + return SemaBuiltinConstantArgRange(TheCall, 1, 0, 31); case PPC::BI__builtin_altivec_dst: case PPC::BI__builtin_altivec_dstt: case PPC::BI__builtin_altivec_dstst: diff --git a/clang/test/CodeGen/builtins-ppc-error.c b/clang/test/CodeGen/builtins-ppc-error.c --- a/clang/test/CodeGen/builtins-ppc-error.c +++ b/clang/test/CodeGen/builtins-ppc-error.c @@ -50,6 +50,7 @@ void testCTF(int index) { vec_ctf(vsi, index); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} expected-error {{argument to '__builtin_altivec_vcfux' must be a constant integer}} vec_ctf(vui, index); //expected-error {{argument to '__builtin_altivec_vcfsx' must be a constant integer}} expected-error {{argument to '__builtin_altivec_vcfux' must be a constant integer}} + vec_ctf(vsi, 32); //expected-error 1+ {{argument value 32 is outside the valid range [0, 31]}} } void testVCFSX(int index) { @@ -62,7 +63,7 @@ void testCTS(int index) { vec_cts(vf, index); //expected-error {{argument to '__builtin_altivec_vctsxs' must be a constant integer}} - + vec_cts(vf, 32); //expected-error {{argument value 32 is outside the valid range [0, 31]}} } void testVCTSXS(int index) { @@ -71,7 +72,7 @@ void testCTU(int index) { vec_ctu(vf, index); //expected-error {{argument to '__builtin_altivec_vctuxs' must be a constant integer}} - + vec_ctu(vf, 32); //expected-error {{argument value 32 is outside the valid range [0, 31]}} } void testVCTUXS(int index) {