免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12345
最近访问板块 发新帖
楼主: zylthinking
打印 上一主题 下一主题

[其他] 什么叫非显式的整型立即数 [复制链接]

论坛徽章:
0
41 [报告]
发表于 2012-10-15 17:54 |只看该作者
回复 40# zylthinking


    你这个完全不是表达的那个意思。0b被当作普通字符串了,你生成asm看看就知道了。

论坛徽章:
11
未羊
日期:2013-12-16 12:45:4615-16赛季CBA联赛之青岛
日期:2016-04-11 19:17:4715-16赛季CBA联赛之广夏
日期:2016-04-06 16:34:012015亚冠之卡尔希纳萨夫
日期:2015-11-10 10:04:522015亚冠之大阪钢巴
日期:2015-07-30 18:29:402015亚冠之城南
日期:2015-06-15 17:56:392015亚冠之卡尔希纳萨夫
日期:2015-05-15 15:19:272015亚冠之山东鲁能
日期:2015-05-14 12:38:13金牛座
日期:2014-12-04 15:34:06子鼠
日期:2014-10-16 13:40:4715-16赛季CBA联赛之八一
日期:2016-07-22 09:41:40
42 [报告]
发表于 2012-10-15 17:57 |只看该作者
sonicling 发表于 2012-10-15 17:54
回复 40# zylthinking


我知道, 所以才printf 出来啊
还有2个问题, 一个就是例子上的Ks,  K 应在定义为 -128 -- 127 这个范围才和文档说的一致吧, 文档说 K 是 out of -128 --- 127
另外一个问题就是, 什么是const_vector?

论坛徽章:
0
43 [报告]
发表于 2012-10-15 18:23 |只看该作者
回复 42# zylthinking


    1.不同的平台上constraint可能不同。特别是I J K ....这些是平台相关的constraint

i386上的定义:

  1. ;; Integer constant constraints.
  2. (define_constraint "I"
  3.   "Integer constant in the range 0 @dots{} 31, for 32-bit shifts."
  4.   (and (match_code "const_int")
  5.        (match_test "IN_RANGE (ival, 0, 31)")))

  6. (define_constraint "J"
  7.   "Integer constant in the range 0 @dots{} 63, for 64-bit shifts."
  8.   (and (match_code "const_int")
  9.        (match_test "IN_RANGE (ival, 0, 63)")))

  10. (define_constraint "K"
  11.   "Signed 8-bit integer constant."
  12.   (and (match_code "const_int")
  13.        (match_test "IN_RANGE (ival, -128, 127)")))

  14. (define_constraint "L"
  15.   "@code{0xFF} or @code{0xFFFF}, for andsi as a zero-extending move."
  16.   (and (match_code "const_int")
  17.        (match_test "ival == 0xFF || ival == 0xFFFF")))
复制代码
m68k上的定义:
  1. (define_constraint "I"
  2.   "Integer constant in the range 1 @dots 8, for immediate shift counts and addq."
  3.   (and (match_code "const_int")
  4.        (match_test "ival > 0 && ival <= 8")))

  5. (define_constraint "J"
  6.   "Signed 16-bit integer constant."
  7.   (and (match_code "const_int")
  8.        (match_test "ival >= -0x8000 && ival <= 0x7fff")))

  9. (define_constraint "K"
  10.   "Integer constant that moveq can't handle."
  11.   (and (match_code "const_int")
  12.        (match_test "ival < -0x80 || ival >= 0x80")))

  13. (define_constraint "L"
  14.   "Integer constant in the range -8 @dots -1, for subq."
  15.   (and (match_code "const_int")
  16.        (match_test "ival < 0 && ival >= -8")))
复制代码
2. const vector就是一组const,gcc的内部表示。

论坛徽章:
11
未羊
日期:2013-12-16 12:45:4615-16赛季CBA联赛之青岛
日期:2016-04-11 19:17:4715-16赛季CBA联赛之广夏
日期:2016-04-06 16:34:012015亚冠之卡尔希纳萨夫
日期:2015-11-10 10:04:522015亚冠之大阪钢巴
日期:2015-07-30 18:29:402015亚冠之城南
日期:2015-06-15 17:56:392015亚冠之卡尔希纳萨夫
日期:2015-05-15 15:19:272015亚冠之山东鲁能
日期:2015-05-14 12:38:13金牛座
日期:2014-12-04 15:34:06子鼠
日期:2014-10-16 13:40:4715-16赛季CBA联赛之八一
日期:2016-07-22 09:41:40
44 [报告]
发表于 2012-10-15 18:29 |只看该作者
sonicling 发表于 2012-10-15 18:23
回复 42# zylthinking


我只说那个例子, 感觉它似乎说反了, 不彻底搞明白不舒服, 呵呵

论坛徽章:
11
未羊
日期:2013-12-16 12:45:4615-16赛季CBA联赛之青岛
日期:2016-04-11 19:17:4715-16赛季CBA联赛之广夏
日期:2016-04-06 16:34:012015亚冠之卡尔希纳萨夫
日期:2015-11-10 10:04:522015亚冠之大阪钢巴
日期:2015-07-30 18:29:402015亚冠之城南
日期:2015-06-15 17:56:392015亚冠之卡尔希纳萨夫
日期:2015-05-15 15:19:272015亚冠之山东鲁能
日期:2015-05-14 12:38:13金牛座
日期:2014-12-04 15:34:06子鼠
日期:2014-10-16 13:40:4715-16赛季CBA联赛之八一
日期:2016-07-22 09:41:40
45 [报告]
发表于 2012-10-17 01:29 |只看该作者
已经搞清楚了, Ks 是没错的, 正如文档所言, 这是一个协议, 而不能按照字面意思理解
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP