RISC-V: Implement instruction patterns for ZBB extension.
[official-gcc.git] / gcc / testsuite / gcc.target / riscv / zbb-rol-ror-02.c
blob24b482f21453b815e89803f57cdd6947a436c447
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv32gc_zbb -mabi=ilp32 -O2" } */
4 unsigned int foo1(unsigned int rs1, unsigned int rs2)
6 unsigned int shamt = rs2 & (32 - 1);
7 return (rs1 << shamt) | (rs1 >> ((32 - shamt) & (32 - 1)));
9 unsigned int foo2(unsigned int rs1, unsigned int rs2)
11 unsigned int shamt = rs2 & (32 - 1);
12 return (rs1 >> shamt) | (rs1 << ((32 - shamt) & (32 - 1)));
15 /* { dg-final { scan-assembler-times "rol" 2 } } */
16 /* { dg-final { scan-assembler-times "ror" 2 } } */