1 /* { dg-do compile } */
2 /* { dg-options "-O3 -mhwmult=f5series" } */
3 /* { dg-final { check-function-bodies "**" "" } } */
4
5 /* Verify the MSP430 cost model is working as expected for the default ISA
6 (msp430x) and f5series hwmult, when compiling at -O3. */
7
8 volatile unsigned long a;
9 volatile unsigned int b;
10 volatile unsigned long c;
11 unsigned long res1;
12 unsigned long res2;
13 unsigned long res3;
14
15 /*
16 ** foo:
17 ** ...
18 ** MOV.B #16, R14
19 ** CALL.* #__mspabi_slll
20 ** ...
21 ** MOV.* \&res2.*
22 ** ...
23 ** RLA.*RLC.*
24 ** ...
25 ** MOV.* \&res3.*
26 ** ...
27 ** RLA.*RLC.*
28 ** ...
29 */
30 void foo (void)
31 {
32 /* Use the shift library function for this. */
33 res1 = (a << 16) | b;
34 /* Emit 7 inline shifts for this. */
35 res2 *= 128;
36 /* Perform this multiplication inline, using addition and shifts. */
37 res3 *= 100;
38 }