Use conditional internal functions in if-conversion
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / rlwimi.h
blobc944e2a4b885e6048099952fa7d180367b1b4199
1 typedef unsigned int u32;
3 static inline u32 rot_insert(u32 x, u32 y, u32 n, u32 mb, u32 me)
5 if (n)
6 x = 0
7 #ifdef SL
8 | (x << n)
9 #endif
10 #ifdef SR
11 | (x >> (32 - n))
12 #endif
15 u32 s = -1;
16 if (n)
17 s = 0
18 #ifdef SL
19 | (s << n)
20 #endif
21 #ifdef SR
22 | (s >> (32 - n))
23 #endif
26 u32 mask = 0;
27 mask += 1U << (31 - mb);
28 mask += 1U << (31 - mb);
29 mask -= 1U << (31 - me);
30 mask -= (mb > me);
32 if (mask & ~s)
33 return 12345*y;
35 return (x & mask) | (y & ~mask);
38 #define X3(N,B,E) \
39 u32 f_##N##_##B##_##E(u32 x, u32 y) { return rot_insert(x,y,N,B,E); } \
40 u32 g_##N##_##B##_##E(u32 x, u32 y) { return rot_insert(y,x,N,B,E); }
42 #define X2(N,B) \
43 X3(N,B,0) \
44 X3(N,B,1) \
45 X3(N,B,2) \
46 X3(N,B,7) \
47 X3(N,B,8) \
48 X3(N,B,9) \
49 X3(N,B,15) \
50 X3(N,B,16) \
51 X3(N,B,17) \
52 X3(N,B,23) \
53 X3(N,B,24) \
54 X3(N,B,25) \
55 X3(N,B,29) \
56 X3(N,B,30) \
57 X3(N,B,31)
58 #define X1(N) \
59 X2(N,0) \
60 X2(N,1) \
61 X2(N,2) \
62 X2(N,7) \
63 X2(N,8) \
64 X2(N,9) \
65 X2(N,15) \
66 X2(N,16) \
67 X2(N,17) \
68 X2(N,23) \
69 X2(N,24) \
70 X2(N,25) \
71 X2(N,29) \
72 X2(N,30) \
73 X2(N,31)
74 #define X() \
75 X1(0) \
76 X1(1) \
77 X1(2) \
78 X1(7) \
79 X1(8) \
80 X1(9) \
81 X1(15) \
82 X1(16) \
83 X1(17) \
84 X1(23) \
85 X1(24) \
86 X1(25) \
87 X1(29) \
88 X1(30) \
89 X1(31)
91 X()