Commit 79374fd
committed
opt: LoopConstantPromotion 跳过 div/mod 除数常量,恢复取模强度削减
const 全局 mod 被 LoopConstantPromotion 用
shl const,0 物化进 vreg 以省去每轮 lui+addiw 重物化,但这把可强度
削减的 srem x, 998244353(魔数乘法 ~5 周期)反而退化成 remw x, vreg
(寄存器除法 ~40 周期)。强度削减收益远大于省一次重物化
第一遍扫描额外收集被用作 DIV_I/MOD_I 除数的常量,第二遍跳过它们
不予提升,保持字面量交给后端已有的 Granlund-Montgomery 魔数除法1 parent 71f8912 commit 79374fd
1 file changed
Lines changed: 18 additions & 1 deletion
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
165 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
| 169 | + | |
167 | 170 | | |
168 | 171 | | |
169 | 172 | | |
170 | 173 | | |
171 | 174 | | |
172 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
173 | 185 | | |
174 | 186 | | |
175 | 187 | | |
| |||
187 | 199 | | |
188 | 200 | | |
189 | 201 | | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
190 | 207 | | |
191 | 208 | | |
192 | 209 | | |
| |||
0 commit comments