Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Testing Instruction Set
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
taviso
Retired Dev
Retired Dev


Joined: 15 Apr 2003
Posts: 261
Location: United Kingdom

PostPosted: Tue Jul 29, 2003 8:36 pm    Post subject: Testing Instruction Set Reply with quote

Earlier today we needed a way to identify which instruction set was used to compile a binary, we were getting reports of "Illegal Instruction" errors on some processors...which was weird, i wrote a script to identify and report which instruction sets were used. It worked great! (the rogue application turned out to be openssl, which has a non-standard build process)

Another alpha dev improved it so that it would update the screen as it searched, and printed which processors it worked on.

I figured it was so cool, i ported it to x86 so you guys can play with it :)

example output:
Code:
taviso@insomniac:~$ ./analyse-x86 /bin/ls   
mmx:     0  sse:     8  sse2:     0
/bin/ls will run on Pentium III and newer.
taviso@insomniac:~$ ./analyse-x6 /usr/bin/mplayer
mmx:  79809  sse:  2887  sse2:   681
/usr/bin/mplayer will run on Pentium IV and newer.


  • The mmx/sse/sse2 numbers are the number of instructions found from that instruction set.
  • I dont have an AMD machine, so 3dnow wont be identified.
  • The processor revision are correct according to intel documentation.
  • If anyone spots any mistakes, feel free to flame me :)


You can download the script here: http://dev.gentoo.org/~taviso/files/analyse-x86
_________________
--------------------------------------
Gentoo on Alpha, is your penguin 64bit?
--------------------------------------------------------


Last edited by taviso on Fri Nov 28, 2003 11:32 pm; edited 2 times in total
Back to top
View user's profile Send private message
pYrania
Retired Dev
Retired Dev


Joined: 27 Oct 2002
Posts: 650
Location: Cologne - Germany

PostPosted: Tue Jul 29, 2003 9:14 pm    Post subject: Reply with quote

You should add that it determines the Pentium version (Pentium MMX (P55C), Pentium III, Pentium IV, Any) the binary can be used with, to the description.
This might not be obvious to some people ;)

Nice hack anyway.
_________________
Markus Nigbur
Back to top
View user's profile Send private message
taviso
Retired Dev
Retired Dev


Joined: 15 Apr 2003
Posts: 261
Location: United Kingdom

PostPosted: Sat Aug 09, 2003 12:35 am    Post subject: Reply with quote

Well, i was surprised to find a lot of people were interested in this script, i had some emails asking about it and some feature requests. So here is a new version, with the following new features (as requested):

  • AMD support, identify 3dnow and ext3dnow instruction sets.
  • Identify cpuid instruction, and prints out informational message.
  • Identify i486/pentium/pentiumpro instruction sets.
  • Knows about the features of more processors.

http://dev.gentoo.org/~taviso/files/analyse-x86

Some example runs:
Code:
$ ./analyse-x86 /usr/bin/mplayer
Checking vendor_id string...GenuineIntel
Disassembling /usr/bin/mplayer, please wait...
i486:   91 i586:    9 ppro:  391 mmx: 8869 sse: 1084 sse2:  406

This binary was found to contain the cpuid instruction.
It may be able to conditionally execute instructions if
they are supported on the host (i586+).

/usr/bin/mplayer will run on Pentium IV (pentium4) or higher processor.

$ ./analyse-x86 /bin/ls
Checking vendor_id string...GenuineIntel
Disassembling /bin/ls, please wait...
i486:    0 i586:    0 ppro:   15 mmx:    0 sse:    8 sse2:    0
/bin/ls will run on Pentium III (pentium3) or higher processor.

$ ./analyse-x86 /bin/true
Checking vendor_id string...GenuineIntel
Disassembling /bin/true, please wait...
i486:    0 i586:    0 ppro:    0 mmx:    0 sse:    0 sse2:    0
/bin/true will run on 80386 (i386) or higher processor.


If your an AMD user, please test this script works correctly. If your an expert on processor features, please double check my logic and check i'm reporting correct minimum processors and let me know :)

Any other suggestions/feedback/flames/patches welcome :)
_________________
--------------------------------------
Gentoo on Alpha, is your penguin 64bit?
--------------------------------------------------------
Back to top
View user's profile Send private message
taviso
Retired Dev
Retired Dev


Joined: 15 Apr 2003
Posts: 261
Location: United Kingdom

PostPosted: Fri Nov 28, 2003 11:38 pm    Post subject: Reply with quote

Experimenting with icc earlier today, its interesting how many more processor specific instructions icc crams in there.


CC="gcc"
CFLAGS="-O2 -march=pentium4 -mcpu=pentium4 -fomit-frame-pointer -pipe"

Code:
$ analyse-x86 ./fvwm
Checking vendor_id string...GenuineIntel
Disassembling ./fvwm, please wait...
i486:    0 i586:    0 ppro:   54 mmx:    0 sse:  149 sse2:   93
./fvwm will run on Pentium IV (pentium4) or higher processor.


CC="icc"
CFLAGS="-O2 -tpp7 -xW"

Code:
$ analyse-x86 ./fvwm
Checking vendor_id string...GenuineIntel
Disassembling /usr/bin/fvwm, please wait...
i486:    1 i586:    0 ppro:    1 mmx:  996 sse:  546 sse2: 3849
./fvwm will run on Pentium IV (pentium4) or higher processor.


cool eh? :)

the icc compiled binary does seem faster.
_________________
--------------------------------------
Gentoo on Alpha, is your penguin 64bit?
--------------------------------------------------------
Back to top
View user's profile Send private message
rhill
Retired Dev
Retired Dev


Joined: 22 Oct 2004
Posts: 1629
Location: sk.ca

PostPosted: Wed Mar 16, 2005 9:32 am    Post subject: Reply with quote

this is hella cool and deserving of a bump. still works perfectly after almost two years.
_________________
by design, by neglect
for a fact or just for effect
Back to top
View user's profile Send private message
Cintra
Advocate
Advocate


Joined: 03 Apr 2004
Posts: 2111
Location: Norway

PostPosted: Wed Mar 16, 2005 3:27 pm    Post subject: Reply with quote

dirtyepic wrote:
this is hella cool and deserving of a bump. still works perfectly after almost two years.

Right, and its quite some cpu test! ;-)
Mvh
_________________
"I am not bound to please thee with my answers" W.S.
Back to top
View user's profile Send private message
johngalt
Apprentice
Apprentice


Joined: 09 Sep 2004
Posts: 258
Location: 3rd Rock

PostPosted: Sat May 21, 2005 5:48 am    Post subject: Reply with quote

As there have been a few comparisons between gcc and icc, the most recent that i saw being Scott's comparison, I wonder if icc really does compile binaries with more processor-specific instructions across the board, and also if it is known to break things now like it has been purported to in the past....
_________________
desultory wrote:
If you want to retain credibility as a functional adult; when you are told that you are acting boorishly, the correct response is to consider that possibility and act accordingly to correct that behavior.


Amen.
Back to top
View user's profile Send private message
rufnut
Apprentice
Apprentice


Joined: 16 May 2005
Posts: 247

PostPosted: Thu Jan 15, 2009 8:35 am    Post subject: Reply with quote

I thought this great old thread could do with an update, so I added some of the newer CPU features found in modern CPU's

The new provided script seems to work well for Intel Chips and is interesting, but it needs some enhancement on the AMD instruction set regarding CPU ID.

Hope you find it fun to use 8)

Updated analyse-x86;
Code:
#!/bin/sh
#
# Tavis Ormandy <taviso@gentoo.org> 2003
# Improvments by Will Woods <wwoods@gentoo.org>
# More Improvements by Brett Coady <bc1968au@yahoo.com.au>
# Identify instruction set used in binary.
#
##################

# ksh massively out performs bash.
if test -x /bin/ksh -a "$BASH_VERSION"; then
   exec /bin/ksh "$0" "$@"
fi

# initialize everything to zero.
eval {i486,i586,ppro,mmx,sse,sse2,sse3,ssse3,sse41,sse42,sse4a,amd,amd2,cpuid}=0

# unfortunately there are mnemonic collissions between vendor sets
# so check vendor_id string, and enable relevant sets.
printf "Checking vendor_id string..."
if ! test "${1%=*}" == "--vendor"; then
   case "`grep -Em1 '^vendor_id.*: ' /proc/cpuinfo | cut -d\" \" -f2`" in
      *GenuineIntel*) vendor=intel; printf "GenuineIntel\n";;
      *AuthenticAMD*) vendor=amd; printf "AuthenticAMD\n";;
      *CyrixInstead*) vendor=cyrix; printf "CyrixInstead\n";;
      *GenuineTMx86*) vendor=transmeta; printf "GenuineTMx86\n";;
      *) vendor=other; printf "other\n";;
   esac
else
   # allow vendor to be overridden
   vendor=${1#*=}; shift
   printf "%s\n" $vendor
fi

# quick sanity tests.
if ! test "$1"; then
   printf "usage: %s [--vendor=intel|amd|cyrix|transmeta] /path/to/binary\n" $0 1>&2
   exit 1
elif ! test -e "$1"; then
   printf "error: %s does not exist.\n" "$1" 1>&2
   exit 1
elif ! test -r "$1"; then
   printf "error: cant read %s.\n" "$1" 1>&2
   exit 1
fi

printf "Disassembling %s, please wait...\n" $1

# initialize screen output
case "$vendor" in
   *intel*) printf "i486: %4u i586: %4u ppro: %4u mmx: %4u sse: %4u sse2: %4u sse3: %4u ssse3: %4u sse4.1: %4u sse4.2: %4u\r" \
      $i486 $i586 $ppro $mmx $sse $sse2 $sse3 $ssse3 $sse41 $sse42;;
   *amd*) printf "i486: %4u i586: %4u ppro: %4u mmx: %4u sse: %4u 3dnow: %4u sse2: %4u sse3: %4u sse4a: %4u\r" \
      $i486 $i586 $ppro $mmx $sse $(($amd+$amd2))  $sse2 $sse3 $sse4a;;
   *cyrix*) printf "i486: %4u i586: %4u mmx: %4u\r" \
      $i486 $i586 $mmx;;
   *transmeta*) printf "i486: %4u i586: %4u mmx: %4u\r" \
      $i486 $i586 $mmx;;
   *) printf "i486: %4u i586: %4u ppro: %4u mmx: %4u sse: %4u sse2: %4u\r" \
      $i486 $i586 $ppro $mmx $sse $sse2;;
esac

# do the disassembling.

# %cr{0,2,3,4} version
# objdump -d $1 | cut -f3 |
objdump -d $1 | cut -f3 | cut -d" " -f1 | (
# %cr{0,2,3,4} version
#    while read instruction operands; do
   while read instruction; do
       case "$instruction" in
         "cmpxchg"|"xadd"|"bswap"|"invd"|"wbinvd"|"invlpg") let ++i486; print=1;;
         "rdmsr"|"wrmsr"|"rdtsc"|"cmpxch8B"|"rsm") let ++i586; print=1;;
         "cmovcc"|"fcmovcc"|"fcomi"|"fcomip"|"fucomi"|"fucomip"|"rdpmc"|"ud2") let ++ppro; print=1;;
         "emms"|"movd"|"movq"|"packsswb"|"packssdw"|"packuswb"|"paddb"|"paddw"|"paddd"|"paddsb"|"paddsw"|"paddusb"| \
"paddusw"|"pand"|"pandn"|"pcmpeqb"|"pcmpeqw"|"pcmpeqd"|"pcmpgtb"|"pcmpgtw"|"pcmpgtd"|"pmaddwd"|"pmulhw"|"pmullw"|"por"| \
"psllw"|"pslld"|"psllq"|"psraw"|"psrad"|"psrlw"|"psrld"|"psrlq"|"psubb"|"psubw"|"psubd"|"psubsb"|"psubsw"|"psubusb"|"psubusw"| \
"punpckhbw"|"punpckhwd"|"punpckhdq"|"punpcklbw"|"punpcklwd"|"punpckldq"|"pxor") let ++mmx; print=1;;
         "addps"|"addss"|"andnps"|"andps"|"cmpps"|"cmpss"|"comiss"|"cvtpi2ps"|"cvtps2pi"|"cvtsi2ss"|"cvtss2si"|"cvttps2pi"|"cvttss2si"| \
"divps"|"divss"|"fxrstor"|"fxsave"|"ldmxcsr"|"maxps"|"maxss"|"minps"|"minss"|"movaps"|"movhlps"|"movhps"|"movlhps"|"movlps"| \
"movmskps"|"movss"|"movups"|"mulps"|"mulss"|"orps"|"pavgb"|"pavgw"|"psadbw"|"rcpps"|"rcpss"|"rsqrtps"|"rsqrtss"|"shufps"| \
"sqrtps"|"sqrtss"|"stmxcsr"|"subps"|"subss"|"ucomiss"|"unpckhps"|"unpcklps"|"xorps"|"pextrw"|"pinsrw"|"pmaxsw"|"pmaxub"| \
"pminsw"|"pminub"|"pmovmskb"|"pmulhuw"|"pshufw"|"maskmovq"|"movntps"|"movntq"|"prefetch"|"sfence") let ++sse; print=1;;
         "addpd"|"addsd"|"andnpd"|"andpd"|"clflush"|"cmppd"|"cmpsd"|"comisd"|"cvtdq2pd"|"cvtdq2ps"|"cvtpd2pi"|"cvtpd2pq"|"cvtpd2ps"| \
"cvtpi2pd"|"cvtps2dq"|"cvtps2pd"|"cvtsd2si"|"cvtsd2ss"|"cvtsi2sd"|"cvtss2sd"|"cvttpd2pi"|"cvttpd2dq"|"cvttps2dq"|"cvttsd2si"| \
"divpd"|"divsd"|"lfence"|"maskmovdqu"|"maxpd"|"maxsd"|"mfence"|"minpd"|"minsd"|"movapd"|"movd"|"movdq2q"|"movdqa"|"movdqu"| \
"movhpd"|"movlpd"|"movmskpd"|"movntdq"|"movnti"|"movntpd"|"movq"|"movq2dq"|"movsd"|"movupd"|"mulpd"|"mulsd"|"orpd"| \
"packsswb"|"packssdw"|"packuswb"|"paddb"|"paddw"|"paddd"|"paddq"|"paddq"|"paddsb"|"paddsw"|"paddusb"|"paddusw"|"pand"| \
"pandn"|"pause"|"pavgb"|"pavgw"|"pcmpeqb"|"pcmpeqw"|"pcmpeqd"|"pcmpgtb"|"pcmpgtw"|"pcmpgtd"|"pextrw"|"pinsrw"|"pmaddwd"| \
"pmaxsw"|"pmaxub"|"pminsw"|"pminub"|"pmovmskb"|"pmulhw"|"pmulhuw"|"pmullw"|"pmuludq"|"pmuludq"|"por"|"psadbw"|"pshufd"|" \
pshufhw"|"pshuflw"|"pslldq"|"psllw"|"pslld"|"psllq"|"psraw"|"psrad"|"psrldq"|"psrlw"|"psrld"|"psrlq"|"psubb"|"psubw"|"psubd"|"psubq"| \
"psubq"|"psubsb"|"psubsw"|"psubusb"|"psubusw"|"psubsb"|"punpckhbw"|"punpckhwd"|"punpckhdq"|"punpckhqdq"|"punpcklbw"| \
"punpcklwd"|"punpckldq"|"punpcklqdq"|"pxor"|"shufpd"|"sqrtpd"|"sqrtsd"|"subpd"|"subsd"|"ucomisd"|"unpckhpd"|"unpcklpd"|"xorpd") let ++sse2; print=1;;
         "addsubpd"|"addsubps"|"haddpd"|"haddps"|"hsubpd"|"hsubps"|"lddqu"|"movddup"|"movshdup"|"movsldup"|"fisttp"|"monitor"|"mwait") let ++sse3; print=1;;
         "psignb"|"psignw"|"psignd"|"pabsb"|"pabsw"|"pabsd"|"palignr"|"pshufb"|"pmulhrsw"|"pmaddubsw"|"phsubw"|"phsubd"|"phsubsw"| \
"phaddw"|"phaddd"|"phaddsw") let ++ssse3; print=1;;
         "mpsadbw"|"phminposuw"|"pmuldq"|"pmulld"|"dpps"|"dppd"|"blendps"|"blendpd"|"blendvps"|"blendvpd"|"pblendvb"|"pblendw"|"pminsb"| \
"pmaxsb"|"pminuw"|"pmaxuw"|"pminud"|"pmaxud"|"pminsd"|"pmaxsd"|"roundps"|"roundss"|"roundpd"|"roundsd"|"insertps"|"pinsrb"| \
"pinsrd"|"pinsrq"|"extractps"|"pextrb"|"pextrw"|"pextrd"|"pextrq"|"pmovsxbw"|"pmovzxbw"|"pmovsxbd"|"pmovzxbd"|"pmovsxbq"| \
"pmovzxbq"|"pmovsxwd"|"pmovzxwd"|"pmovsxwq"|"pmovzxwq"|"pmovsxdq"|"pmovzxdq"|"ptest"|"pcmpeqq"|"packusdw"|"movntdqa") let ++sse4.1; print=1;;
         "crc32"|"pcmpestri"|"pcmpestrm"|"pcmpistri"|"pcmpistrm"|"pcmpgtq"|"popcnt")
let ++sse4.2; print=1;;
         "lzcnt"|"popcnt"|"extrq"|"insertq"|"movntsd"|"movntss")
let ++sse4a; print=1;;
         "pavgusb"|"pfadd"|"pfsub"|"pfsubr"|"pfacc"|"pfcmpge"|"pfcmpgt"|"pfcmpeq"|"pfmin"|"pfmax"|"pi2fw"|"pi2fd"| \
"pf2iw"|"pf2id"|"pfrcp"|"pfrsqrt"|"pfmul"|"pfrcpit1"|"pfrsqit1"|"pfrcpit2"|"pmulhrw"|"pswapw"|"femms"|"prefetch") let ++amd; print=1;;
         "pf2iw"|"pfnacc"|"pfpnacc"|"pi2fw"|"pswapd"|"maskmovq"|"movntq"|"pavgb"|"pavgw"|"pextrw"|"pinsrw"|"pmaxsw"|"pmaxub"| \
"pminsw"|"pminub"|"pmovmskb"|"pmulhuw"|"prefetchnta"|"prefetcht0"|"prefetcht1"|"prefetcht2"|"psadbw"|"pshufw"|"sfence") let ++amd2; print=1;;
         "cpuid") let ++cpuid ++i586; print=1;;
# %cr{0,2,3,4} version
#         "mov") [[ "$operands" == *%cr[0234]* ]] && let ++i586; print=1;;
      esac
   # check if screen needs updating.
   if test "$print"; then
      case "$vendor" in
         *intel*) printf "i486: %4u i586: %4u ppro: %4u mmx: %4u sse: %4u sse2: %4u sse3: %4u ssse3: %4u sse4.1: %4u sse4.2: %4u\r" \
            $i486 $i586 $ppro $mmx $sse $sse2 $sse3 $ssse3 $sse41 $sse42;;
         *amd*) printf "i486: %4u i586: %4u ppro: %4u mmx: %4u sse: %4u 3dnow: %4u sse2: %4u sse3: %4u sse4a: %4u\r" \
            $i486 $i586 $ppro $mmx $sse $(($amd+$amd2)) $sse2 $sse3 $sse4a;;
         *cyrix*) printf "i486: %4u i586: %4u mmx: %4u\r" \
            $i486 $i586 $mmx;;
         *transmeta*) printf "i486: %4u i586: %4u mmx: %4u\r" \
            $i486 $i586 $mmx;;
         *) printf "i486: %4u i586: %4u ppro: %4u mmx: %4u sse: %4u sse2: %4u\r" \
            $i486 $i586 $ppro $mmx $sse $sse2;;
      esac   
      unset print
   fi
   done

# print a newline
echo

# cpuid instruction could mean the application checks to see
# if an instruction is supported before executing it. This might
# mean it will work on anything over a pentium.
if test $cpuid -gt 0; then
   printf "\nThis binary was found to contain the cpuid instruction.\n"
   printf "It may be able to conditionally execute instructions if\n"
   printf "they are supported on the host (i586+).\n\n"
fi

# print minimum required processor, if there are collissions
# use the vendor to decide what to print.
if test $sse42 -gt 0; then
   subarch="Pentium Nehalem (nehalem)"
elif test $sse41 -gt 0; then
   subarch="Pentium x8000+ (penryn)"
elif test $ssse3 -gt 0; then
   subarch="Pentium Core (core)"
elif test $sse3 -gt 0; then
   subarch="Pentium IV (prescott)"
elif test $sse2 -gt 0; then
   subarch="Pentium IV (pentium4)"
elif test $sse -gt 0; then
   if test "$vendor" == "intel"; then
      subarch="Pentium III (pentium3)"
   elif test "$vendor" == "amd"; then
      subarch="AMD Athlon 4 (athlon-4)"
   else
      subarch="Pentium III (pentium3)"
   fi
elif test "$vendor" == "amd" -a $amd2 -gt 0; then
   subarch="AMD Athlon (athlon)"
elif test "$vendor" == "amd" -a $amd -gt 0; then
   subarch="AMD K6 III (k6-3)"
elif test $mmx -gt 0; then
   if test "$vendor" == "intel"; then
      if test $ppro -gt 0; then
         subarch="Pentium II (pentium2)"
      else
         subarch="Intel Pentium MMX [P55C] (pentium-mmx)"
      fi
   elif test "$vendor" == "amd"; then
      subarch="AMD K6 (k6)"
   elif test "$vendor" == "cyrix"; then
      subarch="Cyrix 6x86MX / MII (pentium-mmx)"
   else
      subarch="Intel Pentium MMX [P55C] (pentium-mmx)"
   fi
elif test $ppro -gt 0; then
   subarch="Pentium Pro (i686 or pentiumpro)"
elif test $i586 -gt 0; then
   subarch="Pentium or compatible (i586) (i586 or pentium)"
elif test $i486 -gt 0; then
   subarch="80486 or comaptible (i486)"
else
   subarch="80386 or compatible (i386)"
fi

# print message and exit.
printf "%s will run on %s or higher processor.\n" "$1" "$subarch"; )

Dont forget to chmod 755 the above script


Now, lets teach an old Dog some new tricks

Code:

localhost / # ./analyse-x86 /usr/bin/mplayer
Checking vendor_id string...GenuineIntel
Disassembling /usr/bin/mplayer, please wait...
i486:  135 i586:   13 ppro:    3 mmx: 163948 sse: 25106 sse2: 14512 sse3:   24 ssse3:  231 sse4.1:    0 sse4.2:    0

This binary was found to contain the cpuid instruction.
It may be able to conditionally execute instructions if
they are supported on the host (i586+).

/usr/bin/mplayer will run on Pentium Core (core) or higher processor.


As you can see it does check to see if your new CPU is actually using the codes it should be.

:wink:

line breaks added by NeddySeagoon
Back to top
View user's profile Send private message
rufnut
Apprentice
Apprentice


Joined: 16 May 2005
Posts: 247

PostPosted: Sat Jan 24, 2009 12:45 pm    Post subject: Reply with quote

Nerdbert has kindly hosted the file for us :-)

http://www.nerdbert.com/gentoo/analyse-x86
Back to top
View user's profile Send private message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Thu Sep 22, 2011 6:21 pm    Post subject: Reply with quote

hi there!
out of boredom I converted the script to plain C. this was a great exercise, not the script itself
but rather the switch block generator to parse strings listed in a data file. it has still some edges
like how to handle what to print properly, i.e. sse/2 vs 3dnow instructions. ;)

I hope someone has a use for these and may help to improve.

see:
http://code.google.com/p/gekis-playground/source/browse/trunk/scripts/analyze_instruction_set.c
http://code.google.com/p/gekis-playground/source/browse/trunk/scripts/analyze_instruction_set.generated
http://code.google.com/p/gekis-playground/source/browse/trunk/scripts/analyze_instruction_set.data
http://code.google.com/p/gekis-playground/source/browse/trunk/scripts/generate_instruction_set.cxx

Quote:
die@ana:~ $ time ./analyze-x86 /usr/bin/mplayer2
your vendor: GenuineIntel
opened file to analyze: /usr/bin/mplayer2
i486: 13 i586: 8 mmx:3537 3dnow1: 1 3dnow2: 150 sse: 132 sse2:3621 ssse3: 2 cpuid: 8 unused:277151
This binary was found to contain the cpuid instruction.
It may be able to conditionally execute instructions if
they are supported on Pentium or compatible.

Interesting, there are unknown instruction sets used!

The binary will run on Pentium Core (core) or higher processor.

real 0m2.729s
user 0m1.200s
sys 0m1.060s
die@ana:~ $ time . /tmp/analyse-x86 /usr/bin/mplayer2
Checking vendor_id string...GenuineIntel
Disassembling /usr/bin/mplayer2, please wait...
i486: 13 i586: 8 ppro: 0 mmx: 3537 sse: 132 sse2: 20 sse3: 0 ssse3: 2 sse4.1: 0 sse4.2: 0

This binary was found to contain the cpuid instruction.
It may be able to conditionally execute instructions if
they are supported on the host (i586+).

/usr/bin/mplayer2 will run on Pentium Core (core) or higher processor.

real 2m1.120s
user 2m1.316s
sys 0m0.296s

edit #1
with the latest changes parsing mplayer2 took .6 seconds.
_________________
hear hear
Back to top
View user's profile Send private message
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Tue Jan 01, 2013 4:19 pm    Post subject: Reply with quote

shouldn't this be bulit-in in gcc and be part of some switch to log this stuff??

By the way I just realized how I am missing some instructions despite my cpu supporting them:

i486, ssse3, sse4.1, sse4.2

How to turn these on in make.conf??
Back to top
View user's profile Send private message
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Tue Jan 01, 2013 4:44 pm    Post subject: Reply with quote

is this normal for firefox ??

Code:
i486:    1 i586:    0 ppro:    0 mmx:  257 sse:   65 3dnow:    0 sse2:  107 sse3:    0 sse4a:   
Back to top
View user's profile Send private message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Tue Jan 01, 2013 5:03 pm    Post subject: Reply with quote

_______0 wrote:
By the way I just realized how I am missing some instructions despite my cpu supporting them:

i486, ssse3, sse4.1, sse4.2

How to turn these on in make.conf??
simply by CFLAGS="-march=native"

Code:
$ gcc -march=native -E -v - </dev/null 2>&1 | grep cc1
 /usr/libexec/gcc/x86_64-pc-linux-gnu/4.6.3/cc1 -E -quiet -v - -march=corei7-avx -mcx16 -msahf -mno-movbe -maes -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-tbm -mavx -msse4.2 -msse4.1 --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=corei7-avx
this is for a core i5
_________________
hear hear
Back to top
View user's profile Send private message
_______0
Guru
Guru


Joined: 15 Oct 2012
Posts: 521

PostPosted: Tue Jan 01, 2013 10:55 pm    Post subject: Reply with quote

so why rufnut's mplayer gets more instructions than me and taviso?

I:

Code:

i486:  155 i586:    8 ppro:    3 mmx: 4197 sse:  136 3dnow:   48 sse2:   20 sse3:    0 sse4a:    0

taviso:

Code:
./analyse-x86 /usr/bin/mplayer

i486:   91 i586:    9 ppro:  391 mmx: 8869 sse: 1084 sse2:  406


geki:

Code:
die@ana:~ $ time . /tmp/analyse-x86 /usr/bin/mplayer2

i486: 13 i586: 8 ppro: 0 mmx: 3537 sse: 132 sse2: 20 sse3: 0 ssse3: 2 sse4.1: 0 sse4.2: 0


rufnut:

Code:
 ./analyse-x86 /usr/bin/mplayer

i486:  135 i586:   13 ppro:    3 mmx: 163948 sse: 25106 sse2: 14512 sse3:   24 ssse3:  231 sse4.1:    0 sse4.2:    0



By the way I am getting this error with the updated script:

Code:
analis-x86: line 80: let: ++sse4.1: syntax error: invalid arithmetic operator (error token is ".1")


Lastly, why not make the script multi-threaded?? That way could get the job done much much faster.
Back to top
View user's profile Send private message
geki
Advocate
Advocate


Joined: 13 May 2004
Posts: 2387
Location: Germania

PostPosted: Wed Jan 02, 2013 8:52 am    Post subject: Reply with quote

you may use my c program.

Code:
$ /usr/local/bin/analyze-instruction-set /usr/bin/mplayer2
your vendor: GenuineIntel
opened file to analyze: /usr/bin/mplayer2

i486:   1 i586:   8 mmx:1299 3dnow1:   1 sse2:1295 cpuid:   8 unused:98691
i486:  46 i586:   8 mmx:3896 3dnow1:   1 3dnow2: 109 sse: 107 sse2:3984 ssse3:   2 cpuid:   8 unused:195918
i486:  59 i586:   8 mmx:4374 3dnow1:   1 3dnow2: 151 sse: 133 sse2:4457 ssse3:   2 cpuid:   8 unused:268170


This binary was found to contain the cpuid instruction.
It may be able to conditionally execute instructions if
they are supported on Pentium or compatible.

Interesting, there are unknown instruction sets used!

The binary will run on Pentium Core (core) or higher processor.

_________________
hear hear
Back to top
View user's profile Send private message
rufnut
Apprentice
Apprentice


Joined: 16 May 2005
Posts: 247

PostPosted: Fri Jan 18, 2013 2:07 pm    Post subject: Reply with quote

_______0 wrote:
so why rufnut's mplayer gets more instructions than me and taviso?


I think you will find I optimized that compile and then used ICC. (cheating :oops: )

Code:
/usr/local/bin/analyze-instruction-set /usr/bin/mplayer
your vendor: AuthenticAMD
opened file to analyze: /usr/bin/mplayer

i586:  10 mmx: 757 3dnow2: 222 sse2: 757 cpuid:  10 unused:99011
i486:  34 i586:  10 mmx:1861 3dnow2: 595 sse: 101 sse2:1917 cpuid:  10 unused:197464
i486:  37 i586:  10 ppro:   3 mmx:10082 3dnow2:2020 sse:1397 sse2:11385 ssse3:   2 sse41:  24 cpuid:  10 unused:287766
i486: 110 i586:  10 ppro:   3 mmx:12036 3dnow2:2438 sse:1397 sse2:13335 ssse3:   2 sse41:  26 cpuid:  10 unused:385319
i486: 208 i586:  10 ppro:   3 mmx:12872 3dnow2:2761 sse:1783 sse2:14170 ssse3:   2 sse41:  30 cpuid:  10 unused:483802
i486: 223 i586:  10 ppro:   3 mmx:13345 3dnow2:2836 sse:1784 sse2:14643 ssse3:   2 sse41:  30 cpuid:  10 unused:522911


This binary was found to contain the cpuid instruction.
It may be able to conditionally execute instructions if
they are supported on Pentium or compatible.

Interesting, there are unknown instruction sets used!

The binary will run on Pentium x8000+ (penryn) or higher processor.

above is my Bulldozer CPU now .........maybe all the unused instructions are looking at really low level old stuff like x86,286and 386 instructions? (we should be able to add every instruction and arrive with nothing unused.)
If we don't maybe the script/app is looking at arrays as if they were instructions?


Thanks for making this quicker and better Geki :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum