asr(int s)1 int asr(int s)
2 {
3 s >>= 11U;
4 return s;
5 }
6
lsr(unsigned int u)7 unsigned int lsr(unsigned int u)
8 {
9 u >>= 11;
10 return u;
11 }
12
divr(int s,unsigned long long u)13 int divr(int s, unsigned long long u)
14 {
15 extern int use(int, unsigned);
16 int t = s;
17 s = s / u;
18 u = u / t;
19 return use(s, u);
20 }
21
sdivul(int s,unsigned long long u)22 int sdivul(int s, unsigned long long u)
23 {
24 s /= u; // divu
25 return s;
26 }
27
udivsl(unsigned int u,long long s)28 unsigned int udivsl(unsigned int u, long long s)
29 {
30 u /= s; // divs
31 return u;
32 }
33
uldivs(int s,unsigned long long u)34 int uldivs(int s, unsigned long long u)
35 {
36 u /= s; // divu
37 return u;
38 }
39
sldivu(unsigned int u,long long s)40 unsigned int sldivu(unsigned int u, long long s)
41 {
42 s /= u; // divs
43 return s;
44 }
45
46 /*
47 * check-name: bug-assign-op0
48 * check-command: test-linearize -Wno-decl $file
49 *
50 * check-output-start
51 asr:
52 .L0:
53 <entry-point>
54 asr.32 %r2 <- %arg1, $11
55 ret.32 %r2
56
57
58 lsr:
59 .L2:
60 <entry-point>
61 lsr.32 %r6 <- %arg1, $11
62 ret.32 %r6
63
64
65 divr:
66 .L4:
67 <entry-point>
68 sext.64 %r11 <- (32) %arg1
69 divu.64 %r13 <- %r11, %arg2
70 trunc.32 %r14 <- (64) %r13
71 divu.64 %r18 <- %arg2, %r11
72 trunc.32 %r21 <- (64) %r18
73 call.32 %r22 <- use, %r14, %r21
74 ret.32 %r22
75
76
77 sdivul:
78 .L6:
79 <entry-point>
80 sext.64 %r26 <- (32) %arg1
81 divu.64 %r27 <- %r26, %arg2
82 trunc.32 %r28 <- (64) %r27
83 ret.32 %r28
84
85
86 udivsl:
87 .L8:
88 <entry-point>
89 zext.64 %r33 <- (32) %arg1
90 divs.64 %r34 <- %r33, %arg2
91 trunc.32 %r35 <- (64) %r34
92 ret.32 %r35
93
94
95 uldivs:
96 .L10:
97 <entry-point>
98 sext.64 %r39 <- (32) %arg1
99 divu.64 %r41 <- %arg2, %r39
100 trunc.32 %r43 <- (64) %r41
101 ret.32 %r43
102
103
104 sldivu:
105 .L12:
106 <entry-point>
107 zext.64 %r46 <- (32) %arg1
108 divs.64 %r48 <- %arg2, %r46
109 trunc.32 %r50 <- (64) %r48
110 ret.32 %r50
111
112
113 * check-output-end
114 */
115