登录
注册
开源
企业版
高校版
搜索
帮助中心
使用条款
关于我们
开源
企业版
高校版
私有云
模力方舟
登录
注册
9月20日,Gitee × 模力方舟来成都了!聚焦 AI 应用在开发范式、算力架构、交互设计、硬件选型等跨场景创新实践,点击立即报名~
代码拉取完成,页面将自动刷新
开源项目
>
开发工具
>
编译/构建/部署
&&
捐赠
捐赠前请先登录
取消
前往登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
Watch
不关注
关注所有动态
仅关注版本发行动态
关注但不提醒动态
1.4K
Star
7.6K
Fork
1.4K
GVP
方舟编译器
/
OpenArkCompiler
代码
Issues
196
Pull Requests
14
Wiki
统计
流水线
服务
质量分析
Jenkins for Gitee
腾讯云托管
腾讯云 Serverless
悬镜安全
阿里云 SAE
Codeblitz
SBOM
我知道了,不再自动展开
更新失败,请稍后重试!
移除标识
内容风险标识
本任务被
标识为内容中包含有代码安全 Bug 、隐私泄露等敏感信息,仓库外成员不可访问
【spec性能分析】iv冗余的swtx
待办的
#I3U16H
Leo Young
成员
创建于
2021-06-02 15:56
- 源码:spec 525 pixel.c 函数:x264_pixel_sad_16x16 ``` static int name( uint8_t *pix1, int i_stride_pix1, \ uint8_t *pix2, int i_stride_pix2 ) \ { \ int i_sum = 0; \ for( int y = 0; y < ly; y++ ) \ { \ for( int x = 0; x < lx; x++ ) \ { \ i_sum += abs( pix1[x] - pix2[x] ); \ } \ pix1 += i_stride_pix1; \ pix2 += i_stride_pix2; \ } \ return i_sum; \ } ``` maple汇编 ``` 1386 mov w4, w1 1387 mov w1, #0 1388 mov w6, #0 1389 sxtw x7, w3 1390 sxtw x8, w4 1391 .L.4__4: 1392 mov w5, #0 <===== "mov x5, #0 x5为iv" 1393 .L.4__2: 1394 sxtw x3, w5 <====== "冗余" 1395 ldrb w4, [x0,x3] 1396 ldrb w3, [x2,x3] 1397 subs w3, w4, w3 1398 cneg w3, w3, MI 1399 add w1, w1, w3 1400 add w5, w5, #1 1401 cmp w5, #16 1402 blt .L.4__2 1403 .L.4__1: 1404 add x0, x0, x8 1405 add x2, x2, x7 1406 add w6, w6, #1 1407 cmp w6, #16 1408 blt .L.4__4 1409 .L.4__3: 1410 mov w0, w1 1411 .L.4__12: 1412 ret ``` maple IR ``` func &x264_pixel_sad_16x16 static (reg %7 <* u8>, reg %11 i32, reg %8 <* u8>, reg %10 i32) i32 { 1335 funcid 4 1336 1337 LOC 2 61 1338 regassign i32 %4 (constval i32 0) 1339 regassign i32 %5 (constval i32 0) 1340 regassign u64 %1 (cvt u64 i32 (regread i32 %10)) 1341 regassign u64 %2 (cvt u64 i32 (regread i32 %11)) 1342 @@4 regassign i32 %6 (constval i32 0) <====== "%6为 iv 可直接变为 i64" 1343 @@2 regassign u64 %3 (cvt u64 i32 (regread i32 %6)) <====== "冗余" 1344 regassign i32 %4 (add i32 ( 1345 regread i32 %4, 1346 abs i32 (sub i32 ( 1347 iread u32 <* u8> 0 (add u64 (regread ptr %7, regread u64 %3)), 1348 iread u32 <* u8> 0 (add u64 (regread ptr %8, regread u64 %3)))))) 1349 regassign i32 %6 (add i32 (regread i32 %6, constval i32 1)) 1350 brtrue @@2 (lt i32 i32 (regread i32 %6, constval i32 16)) 1351 @@1 regassign ptr %7 (add u64 (regread ptr %7, regread u64 %2)) 1352 regassign ptr %8 (add u64 (regread ptr %8, regread u64 %1)) 1353 regassign i32 %5 (add i32 (regread i32 %5, constval i32 1)) 1354 brtrue @@4 (lt i32 i32 (regread i32 %5, constval i32 16)) 1355 @@3 return (regread i32 %4) 1356 } ``` gcc汇编 ``` 18: mov x5, #0x0 // #0 20: ldrb w4, [x7, x5] ldrb w6, [x2, x5] subs w4, w4, w6 cneg w4, w4, mi // mi = first add w0, w0, w4 add x5, x5, #0x1 cmp x5, #0x10 b.ne 20 add x7, x7, x1 add x2, x2, x3 subs w8, w8, #0x1 b.ne 18 ```
- 源码:spec 525 pixel.c 函数:x264_pixel_sad_16x16 ``` static int name( uint8_t *pix1, int i_stride_pix1, \ uint8_t *pix2, int i_stride_pix2 ) \ { \ int i_sum = 0; \ for( int y = 0; y < ly; y++ ) \ { \ for( int x = 0; x < lx; x++ ) \ { \ i_sum += abs( pix1[x] - pix2[x] ); \ } \ pix1 += i_stride_pix1; \ pix2 += i_stride_pix2; \ } \ return i_sum; \ } ``` maple汇编 ``` 1386 mov w4, w1 1387 mov w1, #0 1388 mov w6, #0 1389 sxtw x7, w3 1390 sxtw x8, w4 1391 .L.4__4: 1392 mov w5, #0 <===== "mov x5, #0 x5为iv" 1393 .L.4__2: 1394 sxtw x3, w5 <====== "冗余" 1395 ldrb w4, [x0,x3] 1396 ldrb w3, [x2,x3] 1397 subs w3, w4, w3 1398 cneg w3, w3, MI 1399 add w1, w1, w3 1400 add w5, w5, #1 1401 cmp w5, #16 1402 blt .L.4__2 1403 .L.4__1: 1404 add x0, x0, x8 1405 add x2, x2, x7 1406 add w6, w6, #1 1407 cmp w6, #16 1408 blt .L.4__4 1409 .L.4__3: 1410 mov w0, w1 1411 .L.4__12: 1412 ret ``` maple IR ``` func &x264_pixel_sad_16x16 static (reg %7 <* u8>, reg %11 i32, reg %8 <* u8>, reg %10 i32) i32 { 1335 funcid 4 1336 1337 LOC 2 61 1338 regassign i32 %4 (constval i32 0) 1339 regassign i32 %5 (constval i32 0) 1340 regassign u64 %1 (cvt u64 i32 (regread i32 %10)) 1341 regassign u64 %2 (cvt u64 i32 (regread i32 %11)) 1342 @@4 regassign i32 %6 (constval i32 0) <====== "%6为 iv 可直接变为 i64" 1343 @@2 regassign u64 %3 (cvt u64 i32 (regread i32 %6)) <====== "冗余" 1344 regassign i32 %4 (add i32 ( 1345 regread i32 %4, 1346 abs i32 (sub i32 ( 1347 iread u32 <* u8> 0 (add u64 (regread ptr %7, regread u64 %3)), 1348 iread u32 <* u8> 0 (add u64 (regread ptr %8, regread u64 %3)))))) 1349 regassign i32 %6 (add i32 (regread i32 %6, constval i32 1)) 1350 brtrue @@2 (lt i32 i32 (regread i32 %6, constval i32 16)) 1351 @@1 regassign ptr %7 (add u64 (regread ptr %7, regread u64 %2)) 1352 regassign ptr %8 (add u64 (regread ptr %8, regread u64 %1)) 1353 regassign i32 %5 (add i32 (regread i32 %5, constval i32 1)) 1354 brtrue @@4 (lt i32 i32 (regread i32 %5, constval i32 16)) 1355 @@3 return (regread i32 %4) 1356 } ``` gcc汇编 ``` 18: mov x5, #0x0 // #0 20: ldrb w4, [x7, x5] ldrb w6, [x2, x5] subs w4, w4, w6 cneg w4, w4, mi // mi = first add w0, w0, w4 add x5, x5, #0x1 cmp x5, #0x10 b.ne 20 add x7, x7, x1 add x2, x2, x3 subs w8, w8, #0x1 b.ne 18 ```
评论 (
4
)
登录
后才可以发表评论
状态
待办的
待办的
进行中
已完成
已关闭
负责人
未设置
williambillchen
williambillchen
负责人
协作者
+负责人
+协作者
Zack
alfred-huang
负责人
协作者
+负责人
+协作者
标签
未设置
标签管理
里程碑
未关联里程碑
未关联里程碑
Pull Requests
未关联
未关联
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
未关联
分支 (27)
标签 (2)
master
lite_maplecg_assembler
merge_branch_20230823
merge_branch_20230608
lite_maplecg
update_llvm_15
merge_branch
wchen_merge169
dev_MapleFE
newir09
fredchow_ginlinepgo1
fredchow_lfovect1
wchen_merge174
fye_pgo_cglower
wchen_merge175
fredchow_lfounroll4
fredchow_funcdelete1
newir08
wchen_merge170
ahuang_m103
newir07
wchen_merge173
newir06
newir05
dev_MapleFE_v2
newir04
abstractir
v1.0.0
v0.2.1
开始日期   -   截止日期
-
置顶选项
不置顶
置顶等级:高
置顶等级:中
置顶等级:低
优先级
不指定
严重
主要
次要
不重要
参与者(2)
C++
1
https://gitee.com/openarkcompiler/OpenArkCompiler.git
git@gitee.com:openarkcompiler/OpenArkCompiler.git
openarkcompiler
OpenArkCompiler
OpenArkCompiler
点此查找更多帮助
搜索帮助
Git 命令在线学习
如何在 Gitee 导入 GitHub 仓库
Git 仓库基础操作
企业版和社区版功能对比
SSH 公钥设置
如何处理代码冲突
仓库体积过大,如何减小?
如何找回被删除的仓库数据
Gitee 产品配额说明
GitHub仓库快速导入Gitee及同步更新
什么是 Release(发行版)
将 PHP 项目自动发布到 packagist.org
仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册