[PATCH] D25017: [mips][msa] Range check MSA intrinsics with immediates
Vasileios Kalintiris via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 18 04:25:00 PDT 2016
vkalintiris accepted this revision.
vkalintiris added a comment.
This revision is now accepted and ready to land.
LGTM. See inline comments for a few small changes.
The only issue I've found with test/CodeGen/builtins-mips-msa-error.c is that GCC checks strictly the signedness of the arguments passed to the builtins. Having a FIXME comment in order to make Clang follow the same behaviour in the future would be nice.
================
Comment at: test/CodeGen/builtins-mips-msa-error.c:24-35
+ v16u8 v16u8_a = (v16u8) {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
+ v16u8 v16u8_b = (v16u8) {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16};
+ v16u8 v16u8_r;
+ v8u16 v8u16_a = (v8u16) {0, 1, 2, 3, 4, 5, 6, 7};
+ v8u16 v8u16_b = (v8u16) {1, 2, 3, 4, 5, 6, 7, 8};
+ v8u16 v8u16_r;
+ v4u32 v4u32_a = (v4u32) {0, 1, 2, 3};
----------------
We don't use the `vxxxx_b` vectors anywhere.
================
Comment at: test/CodeGen/builtins-mips-msa-error.c:37-45
+ v8f16 v8f16_a = (v8f16) {0.5, 1, 2, 3, 4, 5, 6, 7};
+ v8f16 v8f16_b = (v8f16) {1.5, 2, 3, 4, 5, 6, 7, 8};
+ v8f16 v8f16_r;
+ v4f32 v4f32_a = (v4f32) {0.5, 1, 2, 3};
+ v4f32 v4f32_b = (v4f32) {1.5, 2, 3, 4};
+ v4f32 v4f32_r;
+ v2f64 v2f64_a = (v2f64) {0.5, 1};
----------------
We don't test anything with these. We can delete them along with the typedef above.
================
Comment at: test/CodeGen/builtins-mips-msa-error.c:49
+ long long ll_r;
+ int int_a = 0;
+
----------------
Unused as well.
================
Comment at: test/CodeGen/builtins-mips-msa-error.c:119
+ int_r = __msa_copy_s_h(v8i16_a, 8); // expected-error {{argument should be a value from 0 to 7}}
+ int_r = __msa_copy_s_w(v4i32_a, 3); // expected-error {{argument should be a value from 0 to 3}}
+ ll_r = __msa_copy_s_d(v2i64_a, 2); // expected-error {{argument should be a value from 0 to 1}}
----------------
The passed argument is in the valid value range.
================
Comment at: test/CodeGen/builtins-mips-msa-error.c:308-311
+ v16i8_r = __msa_clti_s_b(v16i8_a, -1); // expected-error {{argument should be a value from -16 to 15}}
+ v8i16_r = __msa_clti_s_h(v8i16_a, -1); // expected-error {{argument should be a value from -16 to 15}}
+ v4i32_r = __msa_clti_s_w(v4i32_a, -1); // expected-error {{argument should be a value from -16 to 15}}
+ v2i64_r = __msa_clti_s_d(v2i64_a, -1); // expected-error {{argument should be a value from -16 to 15}}
----------------
The passed argument is in the valid range of values.
https://reviews.llvm.org/D25017
More information about the cfe-commits
mailing list