Hi, This patch following on from the fix for turning on __builtin_shuffle for c++ , enables folding of vec_perm_exprs in the front-end for constexpr and constructor style values. I was originally going to go with Marc's patch but then took a look at what it would take to support this properly which appeared to me to be just calling fold with the right parameters.
With simple tests based on variations from c-c++-common/vshuf*.c using constexpr execution tests appear to pass - There is still an issue with the compiler giving an error on seeing a subscript operation with a __builtin_shuffle - I'm going to let that one for someone else to pick up because I don't have the time to pick this up right at this minute and the fact is that folks could use an extra vector for the time being. Regression tested with a bootstrap and testrun on powerpc / x86_64-linux-gnu and cross-tested on arm-linux-gnueabi Thoughts ? regards, Ramana cp/ PR C++/51033 * semantics.c (constexpr_call): Fix typo in comment. (cxx_eval_vec_perm_expr): New. (cxx_eval_constant_expression): Fold VEC_PERM_EXPRs. testsuite/ * g++.dg/torture/vshuf-16.inc: New test. * g++.dg/torture/vshuf-2.inc: New test. * g++.dg/torture/vshuf-4.inc: New test. * g++.dg/torture/vshuf-8.inc: New test. * g++.dg/torture/vshuf-main.inc: New test. * g++.dg/torture/vshuf-v16hi.C: New test. * g++.dg/torture/vshuf-v16qi.C: New test. * g++.dg/torture/vshuf-v2df.C: New test. * g++.dg/torture/vshuf-v2di.C: New test. * g++.dg/torture/vshuf-v2sf.C: New test. * g++.dg/torture/vshuf-v2si.C: New test. * g++.dg/torture/vshuf-v4df.C: New test. * g++.dg/torture/vshuf-v4di.C: New test. * g++.dg/torture/vshuf-v4sf.C: New test. * g++.dg/torture/vshuf-v4si.C: New test. * g++.dg/torture/vshuf-v8hi.C: New test. * g++.dg/torture/vshuf-v8qi.C: New test. * g++.dg/torture/vshuf-v8si.C: New test.
constexpr-vshuf.patch
Description: Binary data