benchmarks initial commit
[riscv-tests.git] / benchmarks / multiply / multiply.c
1 // *************************************************************************
2 // multiply function (c version)
3 // -------------------------------------------------------------------------
4
5 int multiply( int x, int y )
6 {
7
8 int i;
9 int result = 0;
10
11 for (i = 0; i < 32; i++) {
12 if ((x & 0x1) == 1)
13 result = result + y;
14
15 x = x >> 1;
16 y = y << 1;
17 }
18
19 return result;
20
21 }
22