This revision was automatically updated to reflect the committed changes. Closed by commit rC335309: [x86] Teach the builtin argument range check to allow invalid ranges in (authored by chandlerc, committed by ).
Changed prior to commit: https://reviews.llvm.org/D48464?vs=152404&id=152411#toc Repository: rC Clang https://reviews.llvm.org/D48464 Files: include/clang/Basic/DiagnosticSemaKinds.td include/clang/Sema/Sema.h lib/Sema/SemaChecking.cpp test/CodeGen/builtins-mips-args.c test/CodeGen/builtins-systemz-vector-error.c test/CodeGen/builtins-systemz-vector2-error.c test/CodeGen/builtins-systemz-zvector-error.c test/CodeGen/builtins-systemz-zvector2-error.c test/CodeGen/hexagon-check-builtins.c test/Sema/aarch64-neon-fp16-ranges.c test/Sema/aarch64-neon-ranges.c test/Sema/arm-neon-types.c test/Sema/builtin-object-size.c test/Sema/builtin-prefetch.c test/Sema/builtins-arm.c test/Sema/builtins-arm64.c test/Sema/builtins-ppc.c test/Sema/builtins-x86.c test/Sema/builtins-x86.cpp test/SemaCXX/neon-vector-types.cpp
Index: test/Sema/aarch64-neon-ranges.c =================================================================== --- test/Sema/aarch64-neon-ranges.c +++ test/Sema/aarch64-neon-ranges.c @@ -11,12 +11,12 @@ 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 @@ 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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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 @@ 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}} - - 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}} + 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-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}} } Index: test/Sema/builtins-arm64.c =================================================================== --- test/Sema/builtins-arm64.c +++ test/Sema/builtins-arm64.c @@ -18,14 +18,14 @@ } 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}} } Index: test/Sema/aarch64-neon-fp16-ranges.c =================================================================== --- test/Sema/aarch64-neon-fp16-ranges.c +++ 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}} } Index: test/Sema/builtins-x86.cpp =================================================================== --- test/Sema/builtins-x86.cpp +++ 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 Index: test/Sema/builtins-ppc.c =================================================================== --- test/Sema/builtins-ppc.c +++ 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 @@ 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); } Index: test/Sema/builtins-arm.c =================================================================== --- test/Sema/builtins-arm.c +++ test/Sema/builtins-arm.c @@ -35,18 +35,18 @@ #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 @@ 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 @@ 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 @@ 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}} } Index: test/Sema/builtins-x86.c =================================================================== --- test/Sema/builtins-x86.c +++ test/Sema/builtins-x86.c @@ -22,145 +22,145 @@ } __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]}} } Index: test/Sema/arm-neon-types.c =================================================================== --- test/Sema/arm-neon-types.c +++ test/Sema/arm-neon-types.c @@ -17,7 +17,7 @@ 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))); Index: test/Sema/builtin-object-size.c =================================================================== --- test/Sema/builtin-object-size.c +++ test/Sema/builtin-object-size.c @@ -13,10 +13,10 @@ __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 @@ 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 Index: test/Sema/builtin-prefetch.c =================================================================== --- test/Sema/builtin-prefetch.c +++ test/Sema/builtin-prefetch.c @@ -8,7 +8,7 @@ __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]}} } Index: test/SemaCXX/neon-vector-types.cpp =================================================================== --- test/SemaCXX/neon-vector-types.cpp +++ test/SemaCXX/neon-vector-types.cpp @@ -35,7 +35,7 @@ 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}} }); } Index: test/CodeGen/builtins-mips-args.c =================================================================== --- test/CodeGen/builtins-mips-args.c +++ test/CodeGen/builtins-mips-args.c @@ -7,10 +7,10 @@ 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 @@ __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}} } Index: test/CodeGen/hexagon-check-builtins.c =================================================================== --- test/CodeGen/hexagon-check-builtins.c +++ test/CodeGen/hexagon-check-builtins.c @@ -2,28 +2,28 @@ // 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); } 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); } Index: test/CodeGen/builtins-systemz-zvector-error.c =================================================================== --- test/CodeGen/builtins-systemz-zvector-error.c +++ test/CodeGen/builtins-systemz-zvector-error.c @@ -560,6 +560,6 @@ // 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}} } Index: test/CodeGen/builtins-systemz-vector2-error.c =================================================================== --- test/CodeGen/builtins-systemz-vector2-error.c +++ test/CodeGen/builtins-systemz-vector2-error.c @@ -28,34 +28,34 @@ 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}} } Index: test/CodeGen/builtins-systemz-vector-error.c =================================================================== --- test/CodeGen/builtins-systemz-vector-error.c +++ test/CodeGen/builtins-systemz-vector-error.c @@ -27,148 +27,148 @@ 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}} } Index: test/CodeGen/builtins-systemz-zvector2-error.c =================================================================== --- test/CodeGen/builtins-systemz-zvector2-error.c +++ test/CodeGen/builtins-systemz-zvector2-error.c @@ -127,8 +127,8 @@ // 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) { Index: lib/Sema/SemaChecking.cpp =================================================================== --- lib/Sema/SemaChecking.cpp +++ lib/Sema/SemaChecking.cpp @@ -2937,7 +2937,12 @@ 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 @@ /// 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 @@ 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; } Index: include/clang/Basic/DiagnosticSemaKinds.td =================================================================== --- include/clang/Basic/DiagnosticSemaKinds.td +++ include/clang/Basic/DiagnosticSemaKinds.td @@ -8132,7 +8132,10 @@ 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< Index: include/clang/Sema/Sema.h =================================================================== --- include/clang/Sema/Sema.h +++ include/clang/Sema/Sema.h @@ -10431,8 +10431,8 @@ 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,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits