On 10/15/23 02:12, Roger Sayle wrote:
This patch adds a pre-reload splitter to arc.md, to use the bset (set

specific bit instruction) to implement 1<<x (i.e. left shifts of one)

on ARC processors that don't have a barrel shifter.

Currently,

int foo(int x) {

   return 1 << x;

}
FYI conceptually this would be helpful on the H8 port as well since it does a loop. But unfortunately the bset instruction on the H8 masks the bit position with 0x7, so a straightforward implementation would only work in QImode which is pretty uninteresting.

While I could probably cobble together something on the H8 for HI/SI by detecting when there's a suitable mask in the IL, but I doubt that happens much in practice.

jeff

Reply via email to