1 /* { dg-do compile } */
2 /* { dg-additional-options "--save-temps -O1" } */
3 /* { dg-final { check-function-bodies "**" "" "" } } */
4
5 #include <stdint.h>
6
7 #pragma GCC target "+cssc"
8
9 #define MIN(X, Y) ((X) > (Y) ? (Y) : (X))
10 #define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
11
12 #define FUNC(T, OP, IMM) \
13 T \
14 T##_##OP##_##IMM (T a) \
15 { \
16 return OP (a, IMM); \
17 } \
18
19 #define FUNCNEG(T, OP, IMM) \
20 T \
21 T##_##OP##_m##IMM (T a) \
22 { \
23 return OP (a, - (IMM)); \
24 } \
25
26 /*
27 ** uint32_t_MIN_255:
28 ** umin w0, w0, 255
29 ** ret
30 */
31
32 FUNC (uint32_t, MIN, 255)
33
34 /*
35 ** uint64_t_MIN_255:
36 ** umin x0, x0, 255
37 ** ret
38 */
39
40 FUNC (uint64_t, MIN, 255)
41
42 /*
43 ** uint32_t_MAX_255:
44 ** umax w0, w0, 255
45 ** ret
46 */
47
48 FUNC (uint32_t, MAX, 255)
49
50
51 /*
52 ** uint64_t_MAX_255:
53 ** umax x0, x0, 255
54 ** ret
55 */
56
57 FUNC (uint64_t, MAX, 255)
58
59 /*
60 ** int32_t_MIN_m128:
61 ** smin w0, w0, -128
62 ** ret
63 */
64
65 FUNCNEG (int32_t, MIN, 128)
66
67 /*
68 ** int32_t_MIN_127:
69 ** smin w0, w0, 127
70 ** ret
71 */
72
73 FUNC (int32_t, MIN, 127)
74
75 /*
76 ** int64_t_MIN_m128:
77 ** smin x0, x0, -128
78 ** ret
79 */
80
81 FUNCNEG (int64_t, MIN, 128)
82
83 /*
84 ** int64_t_MIN_127:
85 ** smin x0, x0, 127
86 ** ret
87 */
88
89 FUNC (int64_t, MIN, 127)
90
91 /*
92 ** int32_t_MAX_m128:
93 ** smax w0, w0, -128
94 ** ret
95 */
96
97 FUNCNEG (int32_t, MAX, 128)
98
99 /*
100 ** int32_t_MAX_127:
101 ** smax w0, w0, 127
102 ** ret
103 */
104
105 FUNC (int32_t, MAX, 127)
106
107 /*
108 ** int64_t_MAX_m128:
109 ** smax x0, x0, -128
110 ** ret
111 */
112
113 FUNCNEG (int64_t, MAX, 128)
114
115 /*
116 ** int64_t_MAX_127:
117 ** smax x0, x0, 127
118 ** ret
119 */
120
121 FUNC (int64_t, MAX, 127)
122
123 /*
124 ** int32_t_MIN_0:
125 ** smin w0, w0, 0
126 ** ret
127 */
128
129 FUNC (int32_t, MIN, 0)
130
131 /*
132 ** int64_t_MIN_0:
133 ** smin x0, x0, 0
134 ** ret
135 */
136
137 FUNC (int64_t, MIN, 0)
138
139 /*
140 ** int32_t_MAX_0:
141 ** smax w0, w0, 0
142 ** ret
143 */
144
145 FUNC (int32_t, MAX, 0)
146
147 /*
148 ** int64_t_MAX_0:
149 ** smax x0, x0, 0
150 ** ret
151 */
152
153 FUNC (int64_t, MAX, 0)
154