зеркало из https://github.com/github/ruby.git
* bignum.c (big2str_2bdigits): reduce div instruction.
Fix the code so that C compiler unify div instructions of `%` and `/`. Before: 4291b0: 48 89 f0 mov %rsi,%rax 4291b3: 31 d2 xor %edx,%edx 4291b5: 48 83 ef 01 sub $0x1,%rdi 4291b9: 48 f7 f1 div %rcx # <---- ! 4291bc: 41 0f b6 04 11 movzbl (%r9,%rdx,1),%eax 4291c1: 31 d2 xor %edx,%edx 4291c3: 41 88 04 38 mov %al,(%r8,%rdi,1) 4291c7: 48 63 4b 04 movslq 0x4(%rbx),%rcx 4291cb: 48 89 f0 mov %rsi,%rax 4291ce: 48 f7 f1 div %rcx # <---- ! 4291d1: 48 89 c6 mov %rax,%rsi 4291d4: 48 85 ff test %rdi,%rdi 4291d7: 75 d7 jne 4291b0 <big2str_2bdigits+0x50> 4291d9: 48 63 6b 10 movslq 0x10(%rbx),%rbp 4291dd: 48 01 6b 20 add %rbp,0x20(%rbx) 4291e1: 48 8b 44 24 48 mov 0x48(%rsp),%rax 4291e6: 64 48 33 04 25 28 00 xor %fs:0x28,%rax After: 4291b0: 48 63 73 04 movslq 0x4(%rbx),%rsi 4291b4: 31 d2 xor %edx,%edx 4291b6: 48 83 e9 01 sub $0x1,%rcx 4291ba: 48 f7 f6 div %rsi # <---- ! 4291bd: 41 0f b6 14 10 movzbl (%r8,%rdx,1),%edx 4291c2: 88 14 0f mov %dl,(%rdi,%rcx,1) 4291c5: 48 85 c9 test %rcx,%rcx 4291c8: 75 e6 jne 4291b0 <big2str_2bdigits+0x50> 4291ca: 48 63 6b 10 movslq 0x10(%rbx),%rbp 4291ce: 48 01 6b 20 add %rbp,0x20(%rbx) 4291d2: 48 8b 44 24 48 mov 0x48(%rsp),%rax 4291d7: 64 48 33 04 25 28 00 xor %fs:0x28,%rax git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54102 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
4b15b54d68
Коммит
3d5a3a236d
|
@ -1,3 +1,7 @@
|
|||
Mon Mar 14 19:05:39 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* bignum.c (big2str_2bdigits): reduce div instruction.
|
||||
|
||||
Mon Mar 14 18:39:53 2016 Martin Duerst <duerst@it.aoyama.ac.jp>
|
||||
|
||||
* include/ruby/oniguruma.h, enc/unicode.c: Adjusting flag assignments
|
||||
|
|
6
bignum.c
6
bignum.c
|
@ -4615,8 +4615,9 @@ big2str_2bdigits(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t tail
|
|||
p = buf;
|
||||
j = sizeof(buf);
|
||||
do {
|
||||
p[--j] = ruby_digitmap[num % b2s->base];
|
||||
BDIGIT_DBL idx = num % b2s->base;
|
||||
num /= b2s->base;
|
||||
p[--j] = ruby_digitmap[idx];
|
||||
} while (num);
|
||||
len = sizeof(buf) - j;
|
||||
big2str_alloc(b2s, len + taillen);
|
||||
|
@ -4626,8 +4627,9 @@ big2str_2bdigits(struct big2str_struct *b2s, BDIGIT *xds, size_t xn, size_t tail
|
|||
p = b2s->ptr;
|
||||
j = b2s->hbase2_numdigits;
|
||||
do {
|
||||
p[--j] = ruby_digitmap[num % b2s->base];
|
||||
BDIGIT_DBL idx = num % b2s->base;
|
||||
num /= b2s->base;
|
||||
p[--j] = ruby_digitmap[idx];
|
||||
} while (j);
|
||||
len = b2s->hbase2_numdigits;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче