Performance Improvement: Top down or bottom up ?

Started by James Ladd, June 05, 2006, 04:28:19 AM

Previous topic - Next topic

MichaelW

Maybe something like this:

    .macro hintbranch
      .byte 0x3e
    .endm

    .macro hintnobranch
      .byte 0x2e
    .endm

    FORP4ONLY = 1

    .ifdef FORP4ONLY
      .print "yes"
      hintbranch
      jz target
    .else
      .print "no"
      jz target
    .endif
  target:


  11                  .macro hintbranch
  12                    .byte 0x3e
  13                  .endm
  14
  15                  .macro hintnobranch
  16                    .byte 0x2e
  17                  .endm
  18
  19                  FORP4ONLY = 1
  20
  21                  .ifdef FORP4ONLY
  22                    .print "yes"
  23                    hintbranch
  23 0000 3E        > .byte 0x3e
  24 0001 7400            jz target
  25                  .else
  26                    .print "no"
  27                    jz target
  28                  .endif
  29                target:
eschew obfuscation

James Ladd

MichaelW,

If there is ever a poll for who is super helpfull I'll be sure and enter your name !   :bg

Thanks.

James Ladd

Ok, I have this im my main include now.

.ifdef NOP4
.print "Not Assembling for a Pentium 4 so no branch hints are used."
.macro hintbranch
.endm

.macro hintnobranch
.endm
.else
.macro hintbranch
    .byte 0x3e
.endm

.macro hintnobranch
    .byte 0x2e
.endm
.endif

.ifdef WIN
.include "win.inc"
.else
.include "linux.inc"
.endif


So I will put branch hints in the code, but they wont be output unless compiling for
a P4. By default my makefile assumes compilation for a P4 unless you say:

make NOP4=1