Message ID | 20230824031316.16599-1-panchenghui@loongson.cn |
---|---|
Headers | show |
Series | Add Loongson SX/ASX instruction support to LoongArch target. | expand |
On Thu, 2023-08-24 at 11:13 +0800, Chenghui Pan wrote: > - Add dg-skip-if for loongarch*-*-* in vshuf test in g++.dg/torture, because > vshuf/xvshuf insn's result is undefined when 6 or 7 bit of vector's element is set, > and insns with this condition are generated in these testcases. I'm almost sure this is wrong. You need to fix the code generation so __builtin_shuffle will always generate something defined on LoongArch, instead of covering up the issue.
On Thu, 2023-08-24 at 11:40 +0800, Xi Ruoyao via Gcc-patches wrote: > On Thu, 2023-08-24 at 11:13 +0800, Chenghui Pan wrote: > > - Add dg-skip-if for loongarch*-*-* in vshuf test in g++.dg/torture, because > > vshuf/xvshuf insn's result is undefined when 6 or 7 bit of vector's element is set, > > and insns with this condition are generated in these testcases. > > I'm almost sure this is wrong. You need to fix the code generation so > __builtin_shuffle will always generate something defined on LoongArch, > instead of covering up the issue. https://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html says clearly: The elements of the input vectors are numbered in memory ordering of vec0 beginning at 0 and vec1 beginning at N. The elements of mask are considered modulo N in the single-operand case and modulo 2*N in the two-operand case. So there is no undefined thing allowed here. You must implement it as it's documented.