We need unsigned integer here.
Fixes #64534
Differential D157476
[RISCV] Fix wrong type prototype of RVVSlideOneBuiltinSet wangpc on Aug 8 2023, 11:28 PM. Authored by
Details We need unsigned integer here. Fixes #64534
Diff Detail
Event TimelineComment Actions I guess we need to update the test cases too, are you able to generate them by modifying the the generator under riscv-non-isa/rvv-intrinsic-doc? Comment Actions For this patch, we don't need to update tests because they are using the right integer types and we didn't generate tests that pass immediates to integer arguments. Comment Actions I mean vint8mf8_t test_vslide1up_vx_i8mf8(vint8mf8_t src, int8_t value, size_t vl) { return __riscv_vslide1up_vx_i8mf8(src, value, vl); } should change into vint8mf8_t test_vslide1up_vx_i8mf8(vint8mf8_t src, uint8_t value, size_t vl) { return __riscv_vslide1up_vx_i8mf8(src, value, vl); } Comment Actions Why do we need pass unsigned integers when the vector elements are signed? Am I missing something here? Comment Actions Sorry, my previous comment was wrong. Please allow me to correct myself here. I went through the v-spec again, it says that:
So I think the righteous fix here is to have the rs1 parameter as type of long, which is to use l in the TableGen. I still think that modifying the generated test cases is needed. If you find it tedious, may I open up a revision that resolves the problem while adding you as co-author since you gave this problem the first try? Comment Actions
@eopXD Yeah, it's OK! I will hand over the work to you, thanks! :-) Comment Actions Oh sorry, somehow I missed it. vint16m1_t __riscv_vslide1up_vx_i16m1 (vint16m1_t src, int16_t value, size_t vl); vint16m1_t __riscv_vslide1up_vx_i16m1 (vint16m1_t src, long value, size_t vl); We can know the range is [-32768, 32767] for the first intrinsic. When the user pass an argument larger than that(e.g. __riscv_vslide1up_vx_i16m1(src, 0xFFFFFFFF, vl)), the compiler can warn the user and may avoid unexpected behaviors. Comment Actions I have been misunderstanding the problem the whole time. I see the clear solution you have right now. No changes in the spec / test cases are needed. |