This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Exploit the rldicl + rldicr when "and" with constant
AbandonedPublic

Authored by Esme on Dec 26 2019, 2:49 AM.

Details

Reviewers
jsji
nemanjai
shchenz
hfinkel
steven.zhang
Group Reviewers
Restricted Project
Summary

If it is "and" with constant, for some special pattern, we could use the rotate and instructions instead of the "andi." which requires us to generate the mask using several instructions. i.e. If the mask looks like this. That is, it has two groups of ones, and either the number of leading zeroes or trailing zeroes is zero.

//     MB  MB2    ME2    ME      
// +----------------------+ 
// |0001111100000011111111| 
// +----------------------+ 
//  0          32        64

We could optimize it as follows:

  1. Rotate left MB2 + 1 bits and then, clear the bits (MB2, ME2)
    MB  MB2    ME2    ME        MB  MB2    ME2    ME
+----------------------+    +----------------------+
|1111111111111111111111| -> |0000001111111111111111+
+----------------------+    +----------------------+
 0          32        64     0          32        64
  1. Rotate back and then, clear the bits [0, MB)
    MB  MB2    ME2    ME        MB  MB2    ME2    ME
+----------------------+    +----------------------+
|0000001111111111111111| -> |0001111100000011111111+
+----------------------+    +----------------------+
 0          32        64     0          32        64

Diff Detail

Event Timeline

steven.zhang created this revision.Dec 26 2019, 2:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 26 2019, 2:49 AM
steven.zhang planned changes to this revision.Feb 17 2020, 10:32 PM
Esme commandeered this revision.Dec 1 2020, 1:03 AM
Esme added a reviewer: steven.zhang.
Esme abandoned this revision.Jan 5 2021, 7:12 PM

D93894 covers this patch.