Create  Edit  Diff  FrontPage  Index  Search  Changes  Login

はじめてのひき - FizzBuzzAsm_ppc Diff

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

! Version

% gcc -v
Using built-in specs.
Target: powerpc-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --program-prefix= --host=powerpc-apple-darwin9 --target=powerpc-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

! Optimized

fizzbuzz_opt.o:     file format mach-o-be

Disassembly of section LC_SEGMENT.:

0000000000000000 <LC_SEGMENT.>:
   0: 7c 08 02 a6 mflr    r0
   4: be e1 ff dc stmw    r23,-36(r1)
   8: 90 01 00 08 stw     r0,8(r1)
   c: 94 21 ff 90 stwu    r1,-112(r1)
  10: 42 9f 00 05 bcl-    20,4*cr7+so,0x14
  14: 7f e8 02 a6 mflr    r31
  18: 3b c0 00 01 li      r30,1
  1c: 3f a0 88 88 lis     r29,-30584
  20: 63 bd 88 89 ori     r29,r29,34953
  24: 3f 5f 00 00 addis   r26,r31,0
  28: 3f 80 66 66 lis     r28,26214
  2c: 63 9c 66 67 ori     r28,r28,26215
  30: 3e ff 00 00 addis   r23,r31,0
  34: 3f 60 55 55 lis     r27,21845
  38: 63 7b 55 56 ori     r27,r27,21846
  3c: 3f 1f 00 00 addis   r24,r31,0
  40: 3f 3f 00 00 addis   r25,r31,0
  44: 7c 1e e8 96 mulhw   r0,r30,r29
  48: 7c 00 f2 14 add     r0,r0,r30
  4c: 7c 00 1e 70 srawi   r0,r0,3
  50: 7f c2 fe 70 srawi   r2,r30,31
  54: 7c 02 00 50 subf    r0,r2,r0
  58: 1c 00 00 0f mulli   r0,r0,15
  5c: 7f 9e 00 00 cmpw    cr7,r30,r0
  60: 40 9e 00 10 bne-    cr7,0x70
  64: 38 7a 04 58 addi    r3,r26,1112
  68: 48 00 00 b9 bl      0x120
  6c: 48 00 00 5c b       0xc8
  70: 7c 1e e0 96 mulhw   r0,r30,r28
  74: 7c 00 0e 70 srawi   r0,r0,1
  78: 7f c2 fe 70 srawi   r2,r30,31
  7c: 7c 02 00 50 subf    r0,r2,r0
  80: 1c 00 00 05 mulli   r0,r0,5
  84: 7f 9e 00 00 cmpw    cr7,r30,r0
  88: 40 9e 00 10 bne-    cr7,0x98
  8c: 38 77 04 64 addi    r3,r23,1124
  90: 48 00 00 91 bl      0x120
  94: 48 00 00 34 b       0xc8
  98: 7c 1e d8 96 mulhw   r0,r30,r27
  9c: 7f c2 fe 70 srawi   r2,r30,31
  a0: 7c 02 00 50 subf    r0,r2,r0
  a4: 1c 00 00 03 mulli   r0,r0,3
  a8: 7f 9e 00 00 cmpw    cr7,r30,r0
  ac: 40 9e 00 10 bne-    cr7,0xbc
  b0: 38 78 04 6c addi    r3,r24,1132
  b4: 48 00 00 6d bl      0x120
  b8: 48 00 00 10 b       0xc8
  bc: 38 79 04 74 addi    r3,r25,1140
  c0: 7f c4 f3 78 mr      r4,r30
  c4: 48 00 00 3d bl      0x100
  c8: 2f 9e 00 64 cmpwi   cr7,r30,100
  cc: 3b de 00 01 addi    r30,r30,1
  d0: 40 9e ff 74 bne+    cr7,0x44
  d4: 38 21 00 70 addi    r1,r1,112
  d8: 80 01 00 08 lwz     r0,8(r1)
  dc: 7c 08 03 a6 mtlr    r0
  e0: ba e1 ff dc lmw     r23,-36(r1)
  e4: 4e 80 00 20 blr

! Normal

fizzbuzz.o:     file format mach-o-be

Disassembly of section LC_SEGMENT.:

0000000000000000 <LC_SEGMENT.>:
   0: 7c 08 02 a6 mflr    r0
   4: bf c1 ff f8 stmw    r30,-8(r1)
   8: 90 01 00 08 stw     r0,8(r1)
   c: 94 21 ff 90 stwu    r1,-112(r1)
  10: 7c 3e 0b 78 mr      r30,r1
  14: 42 9f 00 05 bcl-    20,4*cr7+so,0x18
  18: 7f e8 02 a6 mflr    r31
  1c: 38 00 00 01 li      r0,1
  20: 90 1e 00 38 stw     r0,56(r30)
  24: 48 00 01 04 b       0x128
  28: 80 5e 00 38 lwz     r2,56(r30)
  2c: 3c 00 88 88 lis     r0,-30584
  30: 60 00 88 89 ori     r0,r0,34953
  34: 7c 02 00 96 mulhw   r0,r2,r0
  38: 7c 00 12 14 add     r0,r0,r2
  3c: 7c 09 1e 70 srawi   r9,r0,3
  40: 7c 40 fe 70 srawi   r0,r2,31
  44: 7d 20 48 50 subf    r9,r0,r9
  48: 91 3e 00 50 stw     r9,80(r30)
  4c: 81 3e 00 50 lwz     r9,80(r30)
  50: 1c 09 00 0f mulli   r0,r9,15
  54: 7c 40 10 50 subf    r2,r0,r2
  58: 90 5e 00 50 stw     r2,80(r30)
  5c: 80 1e 00 50 lwz     r0,80(r30)
  60: 2f 80 00 00 cmpwi   cr7,r0,0
  64: 40 9e 00 14 bne-    cr7,0x78
  68: 3c 5f 00 00 addis   r2,r31,0
  6c: 38 62 04 6c addi    r3,r2,1132
  70: 48 00 01 11 bl      0x180
  74: 48 00 00 a8 b       0x11c
  78: 80 5e 00 38 lwz     r2,56(r30)
  7c: 3c 00 66 66 lis     r0,26214
  80: 60 00 66 67 ori     r0,r0,26215
  84: 7c 02 00 96 mulhw   r0,r2,r0
  88: 7c 09 0e 70 srawi   r9,r0,1
  8c: 7c 40 fe 70 srawi   r0,r2,31
  90: 7d 20 48 50 subf    r9,r0,r9
  94: 91 3e 00 4c stw     r9,76(r30)
  98: 81 3e 00 4c lwz     r9,76(r30)
  9c: 1c 09 00 05 mulli   r0,r9,5
  a0: 7c 40 10 50 subf    r2,r0,r2
  a4: 90 5e 00 4c stw     r2,76(r30)
  a8: 80 1e 00 4c lwz     r0,76(r30)
  ac: 2f 80 00 00 cmpwi   cr7,r0,0
  b0: 40 9e 00 14 bne-    cr7,0xc4
  b4: 3c 5f 00 00 addis   r2,r31,0
  b8: 38 62 04 78 addi    r3,r2,1144
  bc: 48 00 00 c5 bl      0x180
  c0: 48 00 00 5c b       0x11c
  c4: 80 5e 00 38 lwz     r2,56(r30)
  c8: 3c 00 55 55 lis     r0,21845
  cc: 60 00 55 56 ori     r0,r0,21846
  d0: 7d 22 00 96 mulhw   r9,r2,r0
  d4: 7c 40 fe 70 srawi   r0,r2,31
  d8: 7d 20 48 50 subf    r9,r0,r9
  dc: 91 3e 00 48 stw     r9,72(r30)
  e0: 81 3e 00 48 lwz     r9,72(r30)
  e4: 1c 09 00 03 mulli   r0,r9,3
  e8: 7c 40 10 50 subf    r2,r0,r2
  ec: 90 5e 00 48 stw     r2,72(r30)
  f0: 80 1e 00 48 lwz     r0,72(r30)
  f4: 2f 80 00 00 cmpwi   cr7,r0,0
  f8: 40 9e 00 14 bne-    cr7,0x10c
  fc: 3c 5f 00 00 addis   r2,r31,0
100: 38 62 04 80 addi    r3,r2,1152
104: 48 00 00 7d bl      0x180
108: 48 00 00 14 b       0x11c
10c: 3c 5f 00 00 addis   r2,r31,0
110: 38 62 04 88 addi    r3,r2,1160
114: 80 9e 00 38 lwz     r4,56(r30)
118: 48 00 00 49 bl      0x160
11c: 80 5e 00 38 lwz     r2,56(r30)
120: 38 02 00 01 addi    r0,r2,1
124: 90 1e 00 38 stw     r0,56(r30)
128: 80 1e 00 38 lwz     r0,56(r30)
12c: 2f 80 00 64 cmpwi   cr7,r0,100
130: 40 9d fe f8 ble+    cr7,0x28
134: 80 21 00 00 lwz     r1,0(r1)
138: 80 01 00 08 lwz     r0,8(r1)
13c: 7c 08 03 a6 mtlr    r0
140: bb c1 ff f8 lmw     r30,-8(r1)
144: 4e 80 00 20 blr

! Optimized with otool -tvV

fizzbuzz.o:

(__TEXT,__text) section

_main:

00000000        mfspr   r0,lr

00000004        stmw    r23,0xffdc(r1)

00000008        stw     r0,0x8(r1)

0000000c        stwu    r1,0xff90(r1)

00000010        bcl     20,31,0x14

00000014        mfspr   r31,lr

00000018        li      r30,0x1

0000001c        lis     r29,0x8888

00000020        ori     r29,r29,0x8889

00000024        addis   r26,r31,ha16(0x46c-0x14)

00000028        lis     r28,0x6666

0000002c        ori     r28,r28,0x6667

00000030        addis   r23,r31,ha16(0x478-0x14)

00000034        lis     r27,0x5555

00000038        ori     r27,r27,0x5556

0000003c        addis   r24,r31,ha16(0x480-0x14)

00000040        addis   r25,r31,ha16(0x488-0x14)

00000044        mulhw   r0,r30,r29

00000048        add     r0,r0,r30

0000004c        srawi   r0,r0,3

00000050        srawi   r2,r30,31

00000054        subf    r0,r2,r0

00000058        mulli   r0,r0,0xf

0000005c        cmpw    cr7,r30,r0

00000060        bne     cr7,0x70

00000064        addi    r3,r26,lo16(0x46c-0x14)

00000068        bl      0x120   ; symbol stub for: _puts

0000006c        b       0xc8

00000070        mulhw   r0,r30,r28

00000074        srawi   r0,r0,1

00000078        srawi   r2,r30,31

0000007c        subf    r0,r2,r0

00000080        mulli   r0,r0,0x5

00000084        cmpw    cr7,r30,r0

00000088        bne     cr7,0x98

0000008c        addi    r3,r23,lo16(0x478-0x14)

00000090        bl      0x120   ; symbol stub for: _puts

00000094        b       0xc8

00000098        mulhw   r0,r30,r27

0000009c        srawi   r2,r30,31

000000a0        subf    r0,r2,r0

000000a4        mulli   r0,r0,0x3

000000a8        cmpw    cr7,r30,r0

000000ac        bne     cr7,0xbc

000000b0        addi    r3,r24,lo16(0x480-0x14)

000000b4        bl      0x120   ; symbol stub for: _puts

000000b8        b       0xc8

000000bc        addi    r3,r25,lo16(0x488-0x14)

000000c0        or      r4,r30,r30

000000c4        bl      0x100   ; symbol stub for: _printf$LDBL128

000000c8        cmpwi   cr7,r30,0x64

000000cc        addi    r30,r30,0x1

000000d0        bne     cr7,0x44

000000d4        addi    r1,r1,0x70

000000d8        lwz     r0,0x8(r1)

000000dc        mtspr   lr,r0

000000e0        lmw     r23,0xffdc(r1)

000000e4        blr

! Normal with otool -tvV

fizzbuzz.o:

(__TEXT,__text) section

_main:

00000000        mfspr   r0,lr

00000004        stmw    r30,0xfff8(r1)

00000008        stw     r0,0x8(r1)

0000000c        stwu    r1,0xff90(r1)

00000010        or      r30,r1,r1

00000014        bcl     20,31,0x18

00000018        mfspr   r31,lr

0000001c        li      r0,0x1

00000020        stw     r0,0x38(r30)

00000024        b       0x128

00000028        lwz     r2,0x38(r30)

0000002c        lis     r0,0x8888

00000030        ori     r0,r0,0x8889

00000034        mulhw   r0,r2,r0

00000038        add     r0,r0,r2

0000003c        srawi   r9,r0,3

00000040        srawi   r0,r2,31

00000044        subf    r9,r0,r9

00000048        stw     r9,0x50(r30)

0000004c        lwz     r9,0x50(r30)

00000050        mulli   r0,r9,0xf

00000054        subf    r2,r0,r2

00000058        stw     r2,0x50(r30)

0000005c        lwz     r0,0x50(r30)

00000060        cmpwi   cr7,r0,_main

00000064        bne     cr7,0x78

00000068        addis   r2,r31,ha16(0x484-0x18)

0000006c        addi    r3,r2,lo16(0x484-0x18)

00000070        bl      0x180   ; symbol stub for: _puts

00000074        b       0x11c

00000078        lwz     r2,0x38(r30)

0000007c        lis     r0,0x6666

00000080        ori     r0,r0,0x6667

00000084        mulhw   r0,r2,r0

00000088        srawi   r9,r0,1

0000008c        srawi   r0,r2,31

00000090        subf    r9,r0,r9

00000094        stw     r9,0x4c(r30)

00000098        lwz     r9,0x4c(r30)

0000009c        mulli   r0,r9,0x5

000000a0        subf    r2,r0,r2

000000a4        stw     r2,0x4c(r30)

000000a8        lwz     r0,0x4c(r30)

000000ac        cmpwi   cr7,r0,_main

000000b0        bne     cr7,0xc4

000000b4        addis   r2,r31,ha16(0x490-0x18)

000000b8        addi    r3,r2,lo16(0x490-0x18)

000000bc        bl      0x180   ; symbol stub for: _puts

000000c0        b       0x11c

000000c4        lwz     r2,0x38(r30)

000000c8        lis     r0,0x5555

000000cc        ori     r0,r0,0x5556

000000d0        mulhw   r9,r2,r0

000000d4        srawi   r0,r2,31

000000d8        subf    r9,r0,r9

000000dc        stw     r9,0x48(r30)

000000e0        lwz     r9,0x48(r30)

000000e4        mulli   r0,r9,0x3

000000e8        subf    r2,r0,r2

000000ec        stw     r2,0x48(r30)

000000f0        lwz     r0,0x48(r30)

000000f4        cmpwi   cr7,r0,_main

000000f8        bne     cr7,0x10c

000000fc        addis   r2,r31,ha16(0x498-0x18)

00000100        addi    r3,r2,lo16(0x498-0x18)

00000104        bl      0x180   ; symbol stub for: _puts

00000108        b       0x11c

0000010c        addis   r2,r31,ha16(0x4a0-0x18)

00000110        addi    r3,r2,lo16(0x4a0-0x18)

00000114        lwz     r4,0x38(r30)

00000118        bl      0x160   ; symbol stub for: _printf$LDBL128

0000011c        lwz     r2,0x38(r30)

00000120        addi    r0,r2,0x1

00000124        stw     r0,0x38(r30)

00000128        lwz     r0,0x38(r30)

0000012c        cmpwi   cr7,r0,0x64

00000130        ble     cr7,0x28

00000134        lwz     r1,_main(r1)

00000138        lwz     r0,0x8(r1)

0000013c        mtspr   lr,r0

00000140        lmw     r30,0xfff8(r1)

00000144        blr