1*c85f09ccSJohn Levon #define MAX	(sizeof(int) * __CHAR_BIT__)
2*c85f09ccSJohn Levon 
lmax(int a)3*c85f09ccSJohn Levon static int lmax(int a)
4*c85f09ccSJohn Levon {
5*c85f09ccSJohn Levon 	return 1 << MAX;
6*c85f09ccSJohn Levon }
7*c85f09ccSJohn Levon 
lneg(int a)8*c85f09ccSJohn Levon static int lneg(int a)
9*c85f09ccSJohn Levon {
10*c85f09ccSJohn Levon 	return 1 << -1;
11*c85f09ccSJohn Levon }
12*c85f09ccSJohn Levon 
rmax(int a)13*c85f09ccSJohn Levon static int rmax(int a)
14*c85f09ccSJohn Levon {
15*c85f09ccSJohn Levon 	return 1 >> MAX;
16*c85f09ccSJohn Levon }
17*c85f09ccSJohn Levon 
rneg(int a)18*c85f09ccSJohn Levon static int rneg(int a)
19*c85f09ccSJohn Levon {
20*c85f09ccSJohn Levon 	return 1 >> -1;
21*c85f09ccSJohn Levon }
22*c85f09ccSJohn Levon 
23*c85f09ccSJohn Levon /*
24*c85f09ccSJohn Levon  * check-name: bad-shift
25*c85f09ccSJohn Levon  * check-command: test-linearize -Wno-decl $file
26*c85f09ccSJohn Levon  *
27*c85f09ccSJohn Levon  * check-output-start
28*c85f09ccSJohn Levon lmax:
29*c85f09ccSJohn Levon .L0:
30*c85f09ccSJohn Levon 	<entry-point>
31*c85f09ccSJohn Levon 	shl.32      %r1 <- $1, $32
32*c85f09ccSJohn Levon 	ret.32      %r1
33*c85f09ccSJohn Levon 
34*c85f09ccSJohn Levon 
35*c85f09ccSJohn Levon lneg:
36*c85f09ccSJohn Levon .L2:
37*c85f09ccSJohn Levon 	<entry-point>
38*c85f09ccSJohn Levon 	shl.32      %r3 <- $1, $0xffffffff
39*c85f09ccSJohn Levon 	ret.32      %r3
40*c85f09ccSJohn Levon 
41*c85f09ccSJohn Levon 
42*c85f09ccSJohn Levon rmax:
43*c85f09ccSJohn Levon .L4:
44*c85f09ccSJohn Levon 	<entry-point>
45*c85f09ccSJohn Levon 	asr.32      %r5 <- $1, $32
46*c85f09ccSJohn Levon 	ret.32      %r5
47*c85f09ccSJohn Levon 
48*c85f09ccSJohn Levon 
49*c85f09ccSJohn Levon rneg:
50*c85f09ccSJohn Levon .L6:
51*c85f09ccSJohn Levon 	<entry-point>
52*c85f09ccSJohn Levon 	asr.32      %r7 <- $1, $0xffffffff
53*c85f09ccSJohn Levon 	ret.32      %r7
54*c85f09ccSJohn Levon 
55*c85f09ccSJohn Levon 
56*c85f09ccSJohn Levon  * check-output-end
57*c85f09ccSJohn Levon  *
58*c85f09ccSJohn Levon  * check-error-start
59*c85f09ccSJohn Levon expand/bad-shift.c:5:18: warning: shift too big (32) for type int
60*c85f09ccSJohn Levon expand/bad-shift.c:10:18: warning: shift count is negative (-1)
61*c85f09ccSJohn Levon expand/bad-shift.c:15:18: warning: shift too big (32) for type int
62*c85f09ccSJohn Levon expand/bad-shift.c:20:18: warning: shift count is negative (-1)
63*c85f09ccSJohn Levon  * check-error-end
64*c85f09ccSJohn Levon  */
65