aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sinfo.adb
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2022-01-11 12:30:44 +0000
committerRoger Sayle <roger@nextmovesoftware.com>2022-01-11 12:30:44 +0000
commit0752c75536e92212ac71c4a44bbc7a18bd7e0315 (patch)
tree30bd2c75c3b0be568acc0012501742138e3d6398 /gcc/ada/sinfo.adb
parent19d81fda48f30c4fc11c8912749351acd9159c17 (diff)
downloadgcc-0752c75536e92212ac71c4a44bbc7a18bd7e0315.zip
gcc-0752c75536e92212ac71c4a44bbc7a18bd7e0315.tar.gz
gcc-0752c75536e92212ac71c4a44bbc7a18bd7e0315.tar.bz2
Recognize MULT_HIGHPART_EXPR in tree-ssa-math-opts pass.
This is the third iteration of a patch to perceive MULT_HIGHPART_EXPR in the middle-end. As they say "the third time's a charm". The first version implemented this in match.pd, which was considered too early. https://gcc.gnu.org/pipermail/gcc-patches/2020-August/551316.html The second version attempted to do this during RTL expansion, and was considered to be too late in the middle-end. https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576922.html https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576923.html This latest version incorporates Richard Biener's feedback/suggestion to perceive MULT_HIGHPART_EXPR in one of the "instruction selection passes", specifically tree-ssa-math-opts, where the recognition of highpart multiplications takes place in the same pass as widening multiplications. With each rewrite, the patch is also getting more aggressive in the set of widening multiplications that it recognizes as highpart multiplies. Currently any widening multiplication followed by a right shift (either signed or unsigned) by a bit count sufficient to eliminate the lowpart is recognized. The result of this shift doesn't need to be truncated. As previously, this patch confirms the target provides a suitable optab before introducing the MULT_HIGHPART_EXPR. This is the reason the testcase is restricted to x86_64, as this pass doesn't do anything on some platforms, but x86_64 should be sufficient to confirm that the pass is working/continues to work. 2022-01-11 Roger Sayle <roger@nextmovesoftware.com> Richard Biener <rguenther@suse.de> gcc/ChangeLog * tree-ssa-math-opts.c (struct widen_mul_stats): Add a highpart_mults_inserted field. (convert_mult_to_highpart): New function to convert right shift of a widening multiply into a MULT_HIGHPART_EXPR. (math_opts_dom_walker::after_dom_children) [RSHIFT_EXPR]: Call new convert_mult_to_highpart function. (pass_optimize_widening_mul::execute): Add a statistics counter for tracking "highpart multiplications inserted" events. gcc/testsuite/ChangeLog * gcc.target/i386/mult-highpart.c: New test case.
Diffstat (limited to 'gcc/ada/sinfo.adb')
0 files changed, 0 insertions, 0 deletions