summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2018-06-21 23:46:09 +0000
committerChandler Carruth <chandlerc@gmail.com>2018-06-21 23:46:09 +0000
commit16e6bc23a12ecaee8b2eeb6a4246843ce24e751c (patch)
tree51fa00e804c6bd18247e5d92509a8c81f17d15fe /clang/test/Sema
parent342b095689e4a6ba61eb4fc03b1985c22989b00d (diff)
downloadbcm5719-llvm-16e6bc23a12ecaee8b2eeb6a4246843ce24e751c.tar.gz
bcm5719-llvm-16e6bc23a12ecaee8b2eeb6a4246843ce24e751c.zip
[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
Diffstat (limited to 'clang/test/Sema')
-rw-r--r--clang/test/Sema/aarch64-neon-fp16-ranges.c40
-rw-r--r--clang/test/Sema/aarch64-neon-ranges.c150
-rw-r--r--clang/test/Sema/arm-neon-types.c2
-rw-r--r--clang/test/Sema/builtin-object-size.c6
-rw-r--r--clang/test/Sema/builtin-prefetch.c6
-rw-r--r--clang/test/Sema/builtins-arm.c32
-rw-r--r--clang/test/Sema/builtins-arm64.c14
-rw-r--r--clang/test/Sema/builtins-ppc.c34
-rw-r--r--clang/test/Sema/builtins-x86.c74
-rw-r--r--clang/test/Sema/builtins-x86.cpp23
10 files changed, 202 insertions, 179 deletions
diff --git a/clang/test/Sema/aarch64-neon-fp16-ranges.c b/clang/test/Sema/aarch64-neon-fp16-ranges.c
index acd69474467..60190525e04 100644
--- a/clang/test/Sema/aarch64-neon-fp16-ranges.c
+++ b/clang/test/Sema/aarch64-neon-fp16-ranges.c
@@ -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}}
}
diff --git a/clang/test/Sema/aarch64-neon-ranges.c b/clang/test/Sema/aarch64-neon-ranges.c
index 3a170b8f4cb..f9b652fc9bf 100644
--- a/clang/test/Sema/aarch64-neon-ranges.c
+++ b/clang/test/Sema/aarch64-neon-ranges.c
@@ -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}}
}
diff --git a/clang/test/Sema/arm-neon-types.c b/clang/test/Sema/arm-neon-types.c
index a5ee708b503..989f20ab20e 100644
--- a/clang/test/Sema/arm-neon-types.c
+++ b/clang/test/Sema/arm-neon-types.c
@@ -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)));
diff --git a/clang/test/Sema/builtin-object-size.c b/clang/test/Sema/builtin-object-size.c
index 096882a088c..436e99d9ab8 100644
--- a/clang/test/Sema/builtin-object-size.c
+++ b/clang/test/Sema/builtin-object-size.c
@@ -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
diff --git a/clang/test/Sema/builtin-prefetch.c b/clang/test/Sema/builtin-prefetch.c
index c5fa792a566..478c85b7568 100644
--- a/clang/test/Sema/builtin-prefetch.c
+++ b/clang/test/Sema/builtin-prefetch.c
@@ -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]}}
}
diff --git a/clang/test/Sema/builtins-arm.c b/clang/test/Sema/builtins-arm.c
index 22572e0c3e3..f34499123c4 100644
--- a/clang/test/Sema/builtins-arm.c
+++ b/clang/test/Sema/builtins-arm.c
@@ -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}}
}
diff --git a/clang/test/Sema/builtins-arm64.c b/clang/test/Sema/builtins-arm64.c
index 2779984680f..27144a18cde 100644
--- a/clang/test/Sema/builtins-arm64.c
+++ b/clang/test/Sema/builtins-arm64.c
@@ -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}}
}
diff --git a/clang/test/Sema/builtins-ppc.c b/clang/test/Sema/builtins-ppc.c
index 5c45d02b414..aa6e9843f65 100644
--- a/clang/test/Sema/builtins-ppc.c
+++ b/clang/test/Sema/builtins-ppc.c
@@ -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);
}
diff --git a/clang/test/Sema/builtins-x86.c b/clang/test/Sema/builtins-x86.c
index e96caf2d797..9872a64f187 100644
--- a/clang/test/Sema/builtins-x86.c
+++ b/clang/test/Sema/builtins-x86.c
@@ -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]}}
}
diff --git a/clang/test/Sema/builtins-x86.cpp b/clang/test/Sema/builtins-x86.cpp
new file mode 100644
index 00000000000..d6c03a89994
--- /dev/null
+++ b/clang/test/Sema/builtins-x86.cpp
@@ -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); \ No newline at end of file
OpenPOWER on IntegriCloud