Number of GPRs

Article: ARM Goes 64-bit
By: Kenneth Jonsson (kj.delete@this.localhost.org), August 17, 2012 11:54 am
Room: Moderated Discussions
Wilco (Wilco.Dijkstra.delete@this.ntlworld.com) on August 17, 2012 6:31 am wrote:

>
> These results are
> wrong - it is trivial to write a function which uses all registers, so pretty
> much impossible they are unused in ~70k instructions. Did you compile with all
> optimizations disabled or perhaps used an old disassembler? (sl,fp,ip were used
> for r10-r12 in the past). Btw you need to include SP and LR as both are GPRs
> (with some special purpose instructions).
>
> Wilco

I compiled with -O2 (recompiled now and double-checked that -O2 and no -O0 was passed to the compiler) and I excluded r13 (stack pointer, which "objdump" show as "sp"), r14 (link register, shown as "lr") and r15 (program counter, listed as "pc"). The compiler is gcc 4.3.3, so not the latest and greatest. I got all this information via objdump, sed, sort and uniq and I'm not a expert on sed. But I opened the full output from "objdump -d" in emacs to double-check that those registers weren't use, only thing I saw with "r11" in was "cr11".

Also, I think my sed reg-exp is correct as they managed to extract the PPC registers r10-r31.

What I did was dumping the whole image file as assembler code, cut out all characters up to the opcode, located every match for r[0-9]+, put the match on a separate line and deleted everything else, i.e.

101e8: e0000492 mul r0, r2, r4

would become

r0
r2
r4

after my "sed" step

Sorted that output, sent it to "uniq -c". I'm not saying that this method is fool-proof or even 100% correct, but it seems to be close enough to get the general trend. And that seem to be that there are very few occasions where 16 or even 8 GPRs seem to be a limiting factor for a modern compiler.

But you are right, it is very odd that three registers would not be used at all, especially as PPC and MIPS used all registers even if quite a lot of them was used quite rarely.

BTW, I tried the same thing on x86_64 using ICC and GCC on a slightly bigger image that contain all the things the ARM version contained + some more stuff. I just post the RAW figures, first column is the number of times the register was used, second column the name (as presented by objdump)

ICC seem to have more spread of its use of registers, but both compilers hardly uses r10 and r11. ICC does generate more instructions tough...

ICC, 550k instructions using at least one of the registers below

20 %xmm11
30 %xmm9
33 %xmm8
47 %r11w
49 %r15w
51 %r11b
55 %r13w
61 %r10w
62 %r9w
64 %r14w
65 %ebp
71 %di
77 %r10b
83 %r12w
83 %r9b
85 %xmm6
88 %xmm10
89 %xmm7
90 %xmm5
91 %r14b
114 %r13b
116 %bx
118 %xmm4
121 %r8w
123 %si
132 %r12b
137 %xmm3
168 %esp
172 %sil
235 %cx
235 %r8b
246 %cs
317 %xmm2
370 %ch
409 %xmm1
431 %dh
536 %bl
676 %dx
688 %bh
749 %xmm0
793 %dil
820 %r15b
849 %ah
1325 %dl
1557 %r11d
1759 %r11
1849 %r10d
2497 %r10
2763 %r9
3159 %r9d
3298 %ax
3900 %r15d
4082 %r14d
4543 %r8
4648 %r13d
4735 %r8d
5724 %r12d
8567 %ebx
10045 %cl
10398 %rip
11137 %edi
13496 %ecx
13505 %esi
14344 %r15
16712 %r14
20295 %r13
20479 %rcx
20579 %edx
21177 %rsp
21901 %rdx
23871 %r12
29124 %rsi
35488 %rbx
36093 %rdi
55063 %al
60391 %eax
69022 %rbp
102955 %rax


GCC, 470k instructions using at least one of the registers below

2 %bpl
2 %xmm15
3 %spl
4 %r11w
6 %xmm12
9 %r10w
10 %r9w
20 %r11b
20 %xmm11
23 %r15w
30 %xmm9
35 %xmm8
37 %r10b
41 %r9b
46 %di
46 %r8w
48 %r13w
57 %r14w
58 %r12w
71 %bx
86 %xmm6
88 %xmm10
89 %xmm7
90 %xmm5
94 %r14b
108 %si
118 %xmm4
131 %cx
131 %ebp
133 %r13b
137 %xmm3
141 %sil
152 %r12b
170 %r8b
317 %xmm2
370 %esp
409 %xmm1
606 %dh
728 %ch
752 %r10d
753 %xmm0
800 %r11d
808 %bl
817 %dx
1002 %r15b
1129 %r10
1134 %cl
1229 %dil
1507 %ah
1598 %r15d
1653 %dl
1768 %r9
1768 %r9d
1962 %r11
1999 %bh
2219 %es
2452 %r14d
2794 %r8
3015 %r8d
3253 %r13d
4517 %r12d
4625 %ax
6272 %r15
7636 %ebx
7732 %ecx
8804 %r14
8896 %edi
9267 %rip
10833 %esi
13820 %r13
14573 %rcx
16122 %edx
17633 %rsp
19526 %rdx
20600 %r12
22977 %rsi
30565 %rdi
34351 %rbx
42926 %rbp
46055 %al
50594 %eax
101687 %rax
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
New Article: ARM Goes 64-bitDavid Kanter08/14/12 12:04 AM
  New Article: ARM Goes 64-bitnone08/14/12 12:44 AM
    New Article: ARM Goes 64-bitDavid Kanter08/14/12 01:04 AM
    MIPS MT-ASEPaul A. Clayton08/14/12 09:01 AM
      MONITOR/MWAITEduardoS08/14/12 10:08 AM
        MWAIT not specifically MTPaul A. Clayton08/14/12 10:36 AM
          MWAIT not specifically MTEduardoS08/15/12 03:16 PM
        MONITOR/MWAITanonymou508/14/12 11:07 AM
          MONITOR/MWAITEduardoS08/15/12 03:20 PM
      MIPS MT-ASErwessel08/14/12 10:14 AM
  New Article: ARM Goes 64-bitSHK08/14/12 02:01 AM
  New Article: ARM Goes 64-bitanon08/14/12 02:37 AM
    New Article: ARM Goes 64-bitRichard Cownie08/14/12 03:57 AM
      New Article: ARM Goes 64-bitanon08/14/12 04:29 AM
      New Article: ARM Goes 64-bitnone08/14/12 04:44 AM
        New Article: ARM Goes 64-bitanon08/14/12 05:28 AM
          New Article: ARM Goes 64-bitanon08/14/12 05:32 AM
            New Article: ARM Goes 64-bitEduardoS08/14/12 06:06 AM
          New Article: ARM Goes 64-bitnone08/14/12 05:40 AM
            AArch64 select better than cmovPaul A. Clayton08/14/12 06:08 AM
            New Article: ARM Goes 64-bitanon08/14/12 06:12 AM
              New Article: ARM Goes 64-bitnone08/14/12 06:25 AM
                Predicated ld/store are usefulPaul A. Clayton08/14/12 06:48 AM
                  Predicated ld/store are usefulnone08/14/12 06:56 AM
                    Predicated ld/store are usefulanon08/14/12 07:07 AM
                    Predicated stores might not be that badPaul A. Clayton08/14/12 07:27 AM
                      Predicated stores might not be that badDavid Kanter08/15/12 01:14 AM
                        Predicated stores might not be that badMichael S08/15/12 11:41 AM
                        Predicated stores might not be that badR Byron08/17/12 04:09 AM
                New Article: ARM Goes 64-bitanon08/14/12 06:54 AM
                  New Article: ARM Goes 64-bitnone08/14/12 07:04 AM
                    New Article: ARM Goes 64-bitanon08/14/12 07:43 AM
          New Article: ARM Goes 64-bitEduardoS08/14/12 06:07 AM
            New Article: ARM Goes 64-bitanon08/14/12 06:20 AM
              New Article: ARM Goes 64-bitnone08/14/12 06:29 AM
                New Article: ARM Goes 64-bitanon08/14/12 07:00 AM
            New Article: ARM Goes 64-bitMichael S08/14/12 03:43 PM
        New Article: ARM Goes 64-bitRichard Cownie08/14/12 06:53 AM
          OT: Conrad's "Youth"Richard Cownie08/14/12 07:20 AM
      New Article: ARM Goes 64-bitEduardoS08/14/12 06:04 AM
        New Article: ARM Goes 64-bitmpx08/14/12 08:59 AM
          New Article: ARM Goes 64-bitAntti-Ville Tuunainen08/14/12 09:16 AM
        New Article: ARM Goes 64-bitanonymou508/14/12 11:03 AM
          New Article: ARM Goes 64-bitname9911/17/12 03:31 PM
            Microarchitecting a counter registerPaul A. Clayton11/17/12 07:37 PM
    New Article: ARM Goes 64-bitbakaneko08/14/12 04:21 AM
      New Article: ARM Goes 64-bitname9911/17/12 03:40 PM
        New Article: ARM Goes 64-bitEduardoS11/17/12 04:52 PM
        New Article: ARM Goes 64-bitDoug S11/17/12 05:48 PM
        New Article: ARM Goes 64-bitbakaneko11/18/12 05:40 PM
          New Article: ARM Goes 64-bitWilco11/19/12 07:59 AM
            New Article: ARM Goes 64-bitEduardoS11/19/12 08:23 AM
              New Article: ARM Goes 64-bitWilco11/19/12 09:31 AM
                Downloading µarch-specific binaries?Paul A. Clayton11/19/12 11:21 AM
                New Article: ARM Goes 64-bitEduardoS11/19/12 11:41 AM
                  New Article: ARM Goes 64-bitWilco11/21/12 07:44 AM
                    JIT vs. static compilation (Was: New Article: ARM Goes 64-bit)VMguy11/22/12 03:21 AM
                      JIT vs. static compilation (Was: New Article: ARM Goes 64-bit)David Kanter11/22/12 12:12 PM
                        JIT vs. static compilation (Was: New Article: ARM Goes 64-bit)Gabriele Svelto11/23/12 03:50 AM
                    New Article: ARM Goes 64-bitEduardoS11/23/12 10:09 AM
                      New Article: ARM Goes 64-bitEBFE11/26/12 01:24 AM
                        New Article: ARM Goes 64-bitGabriele Svelto11/26/12 03:33 AM
                          New Article: ARM Goes 64-bitEBFE11/27/12 11:17 PM
                            New Article: ARM Goes 64-bitGabriele Svelto11/28/12 02:32 AM
                        New Article: ARM Goes 64-bitEduardoS11/26/12 12:16 PM
                          New Article: ARM Goes 64-bitEBFE11/28/12 12:33 AM
                            New Article: ARM Goes 64-bitEduardoS11/28/12 05:53 AM
                              New Article: ARM Goes 64-bitMichael S11/28/12 06:15 AM
                                New Article: ARM Goes 64-bitEduardoS11/28/12 07:33 AM
                                  New Article: ARM Goes 64-bitMichael S11/28/12 09:16 AM
                                    New Article: ARM Goes 64-bitEduardoS11/28/12 09:53 AM
                                    New Article: ARM Goes 64-bitEugene Nalimov11/28/12 05:58 PM
                                      Amazing!EduardoS11/28/12 07:25 PM
                                        Amazing! (non-italic response)EduardoS11/28/12 07:25 PM
                                        Amazing!EBFE11/28/12 08:20 PM
                                          Undefined behaviour doubles downEduardoS11/28/12 09:10 PM
                              New Article: ARM Goes 64-bitEBFE11/28/12 07:54 PM
                                New Article: ARM Goes 64-bitEduardoS11/28/12 09:21 PM
                Have you heard of Transmeta?David Kanter11/19/12 03:47 PM
            New Article: ARM Goes 64-bitbakaneko11/19/12 09:08 AM
            New Article: ARM Goes 64-bitDavid Kanter11/19/12 03:40 PM
              Semantic Dictionary EncodingRay11/19/12 10:37 PM
              New Article: ARM Goes 64-bitRohit11/20/12 04:48 PM
                New Article: ARM Goes 64-bitDavid Kanter11/20/12 11:07 PM
                  New Article: ARM Goes 64-bitWilco11/21/12 06:41 AM
                    New Article: ARM Goes 64-bitDavid Kanter11/21/12 10:12 AM
                    A JIT exampleMark Roulo11/21/12 10:30 AM
                      A JIT exampleWilco11/21/12 07:04 PM
                        A JIT examplerwessel11/21/12 09:05 PM
                        A JIT exampleGabriele Svelto11/23/12 03:53 AM
                        A JIT exampleEduardoS11/23/12 10:13 AM
                          A JIT exampleWilco11/23/12 01:41 PM
                            A JIT exampleEduardoS11/23/12 02:06 PM
                            A JIT exampleGabriele Svelto11/23/12 04:09 PM
                              A JIT exampleSymmetry11/26/12 05:58 AM
            New Article: ARM Goes 64-bitRay11/19/12 10:27 PM
    New Article: ARM Goes 64-bitDavid Kanter08/14/12 09:11 AM
  v7-M is Thumb-onlyPaul A. Clayton08/14/12 06:58 AM
  Minor suggested correctionPaul A. Clayton08/14/12 08:33 AM
    Minor suggested correctionanon08/14/12 08:57 AM
  New Article: ARM Goes 64-bitExophase08/14/12 08:33 AM
    New Article: ARM Goes 64-bitDavid Kanter08/14/12 09:16 AM
      New Article: ARM Goes 64-bitjigal08/15/12 01:49 PM
  Correction re ARM and BBC MicroPaul08/14/12 08:59 PM
    Correction re ARM and BBC MicroPer Hesselgren08/15/12 03:27 AM
  Memory BW so lowPer Hesselgren08/15/12 03:14 AM
    Memory BW so lownone08/15/12 11:16 AM
  New Article: ARM Goes 64-bitdado08/15/12 10:25 AM
  Number of GPRsKenneth Jonsson08/16/12 02:35 PM
    Number of GPRsExophase08/16/12 02:52 PM
      Number of GPRsKenneth Jonsson08/17/12 02:41 AM
        Ooops, missing link...Kenneth Jonsson08/17/12 02:44 AM
        64-bit pointers eat some performancePaul A. Clayton08/17/12 06:19 AM
          64-bit pointers eat some performancebakaneko08/17/12 08:37 AM
            Brute force seems to workPaul A. Clayton08/17/12 10:08 AM
              Brute force seems to workbakaneko08/17/12 11:15 AM
          64-bit pointers eat some performanceRichard Cownie08/17/12 08:46 AM
            Pointer compression is atypicalPaul A. Clayton08/17/12 10:43 AM
              Pointer compression is atypicalRichard Cownie08/17/12 12:57 PM
                Pointer compression is atypicalHoward Chu08/22/12 10:17 PM
                  Pointer compression is atypicalRichard Cownie08/23/12 04:48 AM
                    Pointer compression is atypicalHoward Chu08/23/12 06:51 AM
              Pointer compression is atypicalWilco08/17/12 02:41 PM
                Pointer compression is atypicalRichard Cownie08/17/12 04:13 PM
                  Pointer compression is atypicalRicardo B08/19/12 10:44 AM
                  Pointer compression is atypicalHoward Chu08/22/12 10:08 PM
                    Unified libraries?Paul A. Clayton08/23/12 07:49 AM
                    Pointer compression is atypicalRichard Cownie08/23/12 08:44 AM
                      Pointer compression is atypicalHoward Chu08/23/12 05:17 PM
                        Pointer compression is atypicalanon08/23/12 08:15 PM
                          Pointer compression is atypicalHoward Chu08/23/12 09:33 PM
            64-bit pointers eat some performanceFoo_08/18/12 12:09 PM
              64-bit pointers eat some performanceRichard Cownie08/18/12 05:25 PM
                64-bit pointers eat some performanceRichard Cownie08/18/12 05:32 PM
            Page-related benefit of small pointersPaul A. Clayton08/23/12 08:36 AM
        Number of GPRsWilco08/17/12 06:31 AM
          Number of GPRsKenneth Jonsson08/17/12 11:54 AM
            Number of GPRsExophase08/17/12 12:44 PM
              Number of GPRsKenneth Jonsson08/17/12 01:22 PM
                Number of GPRsWilco08/17/12 02:53 PM
        What about dynamic utilization?Exophase08/17/12 09:30 AM
          Compiler vs. assembly aliasing knowledge?Paul A. Clayton08/17/12 10:20 AM
            Compiler vs. assembly aliasing knowledge?Exophase08/17/12 11:09 AM
            Compiler vs. assembly aliasing knowledge?anon08/18/12 02:23 AM
              Compiler vs. assembly aliasing knowledge?Ricardo B08/19/12 11:02 AM
                Compiler vs. assembly aliasing knowledge?anon08/19/12 06:07 PM
                  Compiler vs. assembly aliasing knowledge?Ricardo B08/19/12 07:26 PM
                    Compiler vs. assembly aliasing knowledge?anon08/19/12 10:03 PM
                      Compiler vs. assembly aliasing knowledge?anon08/20/12 01:59 AM
        Number of GPRsDavid Kanter08/17/12 12:46 PM
          RAT issues as part of reason 1Paul A. Clayton08/17/12 02:18 PM
        Number of GPRsname9911/17/12 06:37 PM
          Large ARFs increase renaming costPaul A. Clayton11/17/12 09:23 PM
    Number of GPRsDavid Kanter08/16/12 03:31 PM
    Number of GPRsRichard Cownie08/16/12 05:17 PM
    32 GPRs ~2-3%Paul A. Clayton08/16/12 06:27 PM
      Oops, Message-ID: aaed6e38-c7bd-467e-ba41-f40cf1020e5e@googlegroups.com (NT)Paul A. Clayton08/16/12 06:29 PM
      32 GPRs ~2-3%Exophase08/16/12 10:06 PM
        R31 as SP/zero is kind of neat (NT)Paul A. Clayton08/17/12 06:23 AM
        32 GPRs ~2-3%rwessel08/17/12 08:24 AM
          32 GPRs ~2-3%Exophase08/17/12 09:16 AM
            32 GPRs ~2-3%Max08/17/12 04:19 PM
      32 GPRs ~2-3%name9911/17/12 07:43 PM
    Number of GPRsmpx08/17/12 01:11 AM
      Latency and powerPaul A. Clayton08/17/12 06:54 AM
    Number of GPRsbakaneko08/17/12 03:09 AM
  New Article: ARM Goes 64-bitSteve08/17/12 02:12 PM
    New Article: ARM Goes 64-bitDavid Kanter08/19/12 12:42 PM
      New Article: ARM Goes 64-bitDoug S08/19/12 02:02 PM
      New Article: ARM Goes 64-bitAnon08/19/12 07:16 PM
      New Article: ARM Goes 64-bitSteve08/30/12 07:51 AM
  Scalar vs Vector registersRobert David Graham08/19/12 05:19 PM
    Scalar vs Vector registersDavid Kanter08/19/12 05:29 PM
  New Article: ARM Goes 64-bitBaserock ARM servers08/21/12 04:13 PM
    Baserock ARM serversSysanon08/21/12 04:14 PM
    A-15 virtualization and LPAE?Paul A. Clayton08/21/12 06:13 PM
      A-15 virtualization and LPAE?Anon08/21/12 07:13 PM
        Half-depth advantages?Paul A. Clayton08/21/12 08:42 PM
          Half-depth advantages?Anon08/22/12 03:33 PM
            Thanks for the information (NT)Paul A. Clayton08/22/12 04:04 PM
      A-15 virtualization and LPAE?C. Ladisch08/23/12 11:12 AM
        A-15 virtualization and LPAE?Paul08/23/12 03:17 PM
        Excessive pessimismPaul A. Clayton08/23/12 04:08 PM
          Excessive pessimismDavid Kanter08/23/12 05:05 PM
    New Article: ARM Goes 64-bitMichael S08/22/12 07:12 AM
      BTW, Baserock==product, Codethink==company (NT)Paul A. Clayton08/22/12 08:56 AM
  New Article: ARM Goes 64-bitReinoud Zandijk08/21/12 11:27 PM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell blue?