From: Dirk Grunwald <grunwald@foobar.cs.colorado.edu>
Subject: Re: unaligned access
Date: 1996/11/16 [thread overview]
Message-ID: <qxpg229rf5p.fsf@foobar.cs.colorado.edu> (raw)
In-Reply-To: 01bbd33f$b2223fd0$63531dc7@gautam
The following is an ATOM tool that will pin-point unaligned loads and
stores to the source line.
To use this tool, you'll need to have ATOM installed. This comes on
the "complimentary products" CDROM. If you don't have a copy, you can
get it from gatekeeper.dec.com -- send me email and I'll forward you
directions. This specific ATOM tool might require the more recent
version of ATOM that supports multiple object files.
Anyhoo, once you have atom installed, unshar and go to the "extras"
subdirectory and run make. Then run make in the UnalignedLoads
directory.
This will leave you with an Inst.o and Anal.o file in the
"UnalignedLoads" directory.
Now, suppose your application is named "foo".
Build an insturmented version of foo like this:
atom foo Inst.o Anal.o -o foo-unaligned
and then run "foo-unaligned" like you normally do (ideally in the same
directory, since it needs some files generated by running "atom").
This will then report the source/line locations that are causing your
unaligned loads (all of them). As a bonus it shows you where all of
your load and store instructions are being done (by procedure and
basic block). I'm attaching a sample output. Note that this will
identify problems that occur in system libraries.
This output doesn't show what you specficially had asked for - a
procedure back trace every time you get an unaligned load or store.
For the price of a case of good beer, I'll add that code to the
instrumentation output. Heck, for more beer, I'll develop the tool and
run ATOM over your (statically link) binary and ship it back to you so
you can run it and locate the bugs. This saves you the hassle of
installing ATOM. And, if you really want it, I'll install ATOM, hack
the tool and do some phone help showing you how to run it. Can you
tell that University raises stink?
Dirk "raises, what raises?" Grunwald Assoc. Prof, Univ. of Colorado
loads -> 1938303123
stores -> 918700662
unaligned_loads -> 25277
unaligned_stores -> 25277
unaligned store rate -> 0.00
unaligned load rate -> 0.00
overall unaligned rate -> 0.00
----------
Statistics for Individual Procedures
format is: proc, loads, unaligned loads, stores, unaligned stores
for_write_seq_fmt_xmit 0.0 27.9 0.0 27.9
for__open_key 0.0 0.1 0.0 0.1
for__put_sf 0.0 1.3 0.0 1.3
for__compute_filename 0.0 0.0 0.0 0.0
cvt_integer_to_text 0.0 6.3 0.0 6.3
cvt_ieee_t_to_text 0.0 14.5 0.0 14.5
cvtas_t_to_a 0.0 28.4 0.0 28.4
__setenv 0.0 0.1 0.0 0.1
memset 0.0 7.0 0.0 7.0
sprintf 0.0 0.0 0.0 0.0
fclose 0.0 0.0 0.0 0.0
fflush 0.0 0.0 0.0 0.0
memcpy 0.0 12.5 0.0 12.5
__pty_resolv 0.0 0.0 0.0 0.0
__getcwd 0.0 1.9 0.0 1.9
_doprnt 0.0 0.0 0.0 0.0
----------
Statistics for Individual Basic Blocks
format is: proc, file, line, loads, unaligned loads, stores, unaligned stores
spedup_ lfk537e.f 5780 0.0 0.0 0.0 0.0
trace_ lfk537e.f 7289 0.0 25.1 0.0 0.0
track_ lfk537e.f 7348 0.0 25.1 0.0 0.0
for_write_seq_f for_wseq_f 803 0.0 55.3 0.0 27.9
for_write_seq_f for_wseq_f 673 0.0 1.0 0.0 0.0
for_write_seq_f for_wseq_f 1221 0.0 1.7 0.0 0.0
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: UnalignedLoads/AnalUnaligned.c
# UnalignedLoads/InstUnaligned.c UnalignedLoads/Makefile
# extra/extra.c extra/Makefile
# Wrapped by grunwald@foobar.cs.colorado.edu on Sat Nov 16 12:39:07 1996
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'UnalignedLoads/AnalUnaligned.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'UnalignedLoads/AnalUnaligned.c'\"
else
echo shar: Extracting \"'UnalignedLoads/AnalUnaligned.c'\" \(5755 characters\)
sed "s/^X//" >'UnalignedLoads/AnalUnaligned.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <stdlib.h>
X#include <assert.h>
X
Xtypedef unsigned long ul;
X
Xtypedef struct {
X ul unaligned_loads;
X ul unaligned_stores;
X ul loads;
X ul stores;
X} CacheInfo;
X
XCacheInfo *ProcInfo;
XCacheInfo *BlockInfo;
XCacheInfo ProgInfo = {0,0,0,0};
X
Xint blocknum;
X
Xint num_procs;
Xint num_blocks;
X
Xchar *program = "";
X
Xvoid
XBeforeAppRuns(char *program_name, int pn, int bn)
X{
X int i,j;
X program = program_name;
X num_procs = pn;
X num_blocks = bn;
X
X fprintf(stderr,"Allocate space for %d procs and %d blocks\n", pn, bn);
X
X ProcInfo = calloc(sizeof(CacheInfo), pn);
X assert(ProcInfo != NULL);
X
X BlockInfo = calloc(sizeof(CacheInfo), bn);
X assert(BlockInfo != NULL);
X
X blocknum = 0;
X
X}
X
Xvoid
XEnterBlock(int bn, int lds, int sts)
X{
X blocknum = bn;
X BlockInfo[bn].loads += lds;
X BlockInfo[bn].stores += sts;
X}
X
Xstatic void process_load_miss(ul tag, int index)
X{
X}
X
Xvoid
XLoad4(unsigned long addr)
X{
X if ((addr & 0x3) != 0 ) {
X BlockInfo[blocknum].unaligned_loads++;
X }
X}
X
Xvoid
XLoad8(unsigned long addr)
X{
X if ((addr & 0x7) != 0 ) {
X BlockInfo[blocknum].unaligned_loads++;
X }
X}
X
Xvoid
XStore4(unsigned long addr)
X{
X if ((addr & 0x3) != 0 ) {
X BlockInfo[blocknum].unaligned_stores++;
X }
X}
X
Xvoid
XStore8(unsigned long addr)
X{
X if ((addr & 0x7) != 0 ) {
X BlockInfo[blocknum].unaligned_stores++;
X }
X}
X
X/*
X * The output routine (very long). do_one returns TRUE if the item
X * shouldn't be printed. Also returns the loads/misses/stores/misss.
X */
X
Xint
Xdo_one(CacheInfo* ci, double *l, double *lm, double *s, double *sm)
X{
X const double min = 0.1;
X double ual = ProgInfo.unaligned_loads;
X double uas = ProgInfo.unaligned_stores;
X
X *l = (ci -> loads / (double) ProgInfo.loads) * 100;
X
X if ( ual > 0 ) {
X *lm = (ci -> unaligned_loads / ual ) * 100;
X } else {
X *lm = 0;
X }
X
X *s = (ci -> stores / (double) ProgInfo.stores) * 100;
X if ( uas > 0 ) {
X *sm = (ci -> unaligned_stores / uas ) * 100;
X } else {
X *sm = 0;
X }
X
X return ( (ci -> unaligned_loads + ci -> unaligned_stores) <= 0 );
X}
X
X
Xvoid
XAfterAppRuns()
X{
X char file_name[1024];
X FILE *fd;
X FILE *stat;
X FILE *procmap;
X double smr,lmr,mr;
X ul stores;
X ul loads;
X ul unaligned_stores;
X ul unaligned_loads;
X double avgrefs = 0;
X int on, pn, bn;
X int i;
X
X sprintf(file_name, "%s.UnaignedLoads.%d", program, (int) getpid());
X fd = fopen(file_name, "w");
X
X if ( fd == NULL ) {
X perror("fopen");
X fprintf(stderr,"Can not open ATOM output file\n");
X abort();
X } else {
X fprintf(stderr,"Writing %s\n", file_name);
X }
X
X strcpy(file_name, program);
X strcat(file_name, ".static.Unaligned");
X stat = fopen(file_name, "r");
X assert(stat != NULL);
X
X /*
X * Read procedure map
X */
X strcpy(file_name, program);
X strcat(file_name, ".static.ProcMap");
X procmap = fopen(file_name, "r");
X assert(procmap != NULL);
X fscanf(procmap, "%d %d", &pn, &bn);
X assert(pn == num_procs);
X assert(bn == num_blocks);
X for (i = 0; i < num_blocks; i++ ) {
X fscanf(procmap, "%d %d\n", &pn, &on);
X
X /*
X * Reconstruct data for total program and each procedure
X */
X ProcInfo[pn].stores += BlockInfo[i].stores;
X ProcInfo[pn].unaligned_stores += BlockInfo[i].unaligned_stores;
X ProcInfo[pn].loads += BlockInfo[i].loads;
X ProcInfo[pn].unaligned_loads += BlockInfo[i].unaligned_stores;
X
X ProgInfo.stores += BlockInfo[i].stores;
X ProgInfo.unaligned_stores += BlockInfo[i].unaligned_stores;
X ProgInfo.loads += BlockInfo[i].loads;
X ProgInfo.unaligned_loads += BlockInfo[i].unaligned_stores;
X }
X fclose(procmap);
X
X stores = ProgInfo.stores;
X loads = ProgInfo.loads;
X unaligned_stores = ProgInfo.unaligned_stores;
X unaligned_loads = ProgInfo.unaligned_loads;
X
X
X fprintf(fd,"%25s -> %10lu\n", "loads", loads);
X fprintf(fd,"%25s -> %10lu\n", "stores", stores);
X fprintf(fd,"%25s -> %10lu\n", "unaligned_loads", unaligned_loads);
X fprintf(fd,"%25s -> %10lu\n", "unaligned_stores", unaligned_stores);
X smr = (unaligned_stores / (double) stores) * 100.0;
X lmr = (unaligned_loads / (double) loads) * 100.0;
X mr = ((unaligned_loads + unaligned_stores)
X / ( (double) loads + stores)) * 100.0;
X fprintf(fd,"%25s -> %10.2f\n", "unaligned store rate", smr);
X fprintf(fd,"%25s -> %10.2f\n", "unaligned load rate", lmr);
X fprintf(fd,"%25s -> %10.2f\n", "overall unaligned rate", mr);
X
X fflush(fd);
X
X if ( stat ) {
X int i;
X /*
X * Individual procedures
X */
X fprintf(fd,"\n\n\n");
X fprintf(fd,"----------\n");
X fprintf(fd,"Statistics for Individual Procedures\n");
X fprintf(fd,"format is: proc, loads, unaligned loads, stores, unaligned stores\n");
X fprintf(fd,"\n");
X
X for (i = 0; i < num_procs; i++) {
X int l;
X double pl, plm, ps, psm;
X
X fgets(file_name, 1024, stat);
X l = strlen(file_name); file_name[l-1] = 0; /* kill newline */
X
X if ( !do_one(&ProcInfo[i], &pl, &plm, &ps, &psm) ) {
X fprintf(fd, "%-30s %6.1f %6.1f %6.1f %6.1f\n",
X file_name, pl, plm, ps, psm);
X }
X }
X /*
X * Individual basic blocks
X */
X fprintf(fd,"\n\n\n");
X fprintf(fd,"----------\n");
X fprintf(fd,"Statistics for Individual Basic Blocks\n");
X fprintf(fd,"format is: proc, file, line, loads, unaligned loads, stores, unaligned stores\n");
X fprintf(fd,"\n");
X
X for (i = 0; i < num_blocks; i++) {
X int l;
X double pl, plm, ps, psm;
X fgets(file_name, 1024, stat);
X l = strlen(file_name); file_name[l-1] = 0; /* kill newline */
X
X if ( !do_one(&BlockInfo[i], &pl, &plm, &ps, &psm) ) {
X fprintf(fd, "%-30s %6.1f %6.1f %6.1f %6.1f\n",
X file_name, pl, plm, ps, psm);
X }
X }
X fclose(stat);
X }
X fclose(fd);
X}
END_OF_FILE
if test 5755 -ne `wc -c <'UnalignedLoads/AnalUnaligned.c'`; then
echo shar: \"'UnalignedLoads/AnalUnaligned.c'\" unpacked with wrong size!
fi
# end of 'UnalignedLoads/AnalUnaligned.c'
fi
if test -f 'UnalignedLoads/InstUnaligned.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'UnalignedLoads/InstUnaligned.c'\"
else
echo shar: Extracting \"'UnalignedLoads/InstUnaligned.c'\" \(3236 characters\)
sed "s/^X//" >'UnalignedLoads/InstUnaligned.c' <<'END_OF_FILE'
X#include <stdio.h>
X#include <cmplrs/atom.inst.h>
X#include <alpha/inst.h>
X#include <string.h>
X#include <stdlib.h>
X
Xint count_instructions = 0;
X
Xunsigned
XInstrumentAll(int argc, char **argv)
X{
X Obj* obj;
X Proc* proc;
X const char *program = GetAnalName();
X char file_name[1024];
X int procnum, blocknum, objnum;
X
X AddCallProto("BeforeAppRuns(char*,int,int)");
X AddCallProto("AfterAppRuns()");
X AddCallProto("EnterBlock(int, int, int)");
X AddCallProto("Load4(VALUE)");
X AddCallProto("Store4(VALUE)");
X AddCallProto("Load8(VALUE)");
X AddCallProto("Store8(VALUE)");
X
X /*
X * Build all the objects
X */
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X if ( BuildObj(obj) ) {
X fprintf(stderr,"Unable to build %s\n", GetObjName(obj));
X return 1;
X }
X }
X
X
X /*
X * Build a table listing the files and lines for each proc and block
X */
X strcpy(file_name, program);
X strcat(file_name, ".static.Unaligned");
X output_static_information(file_name);
X
X /*
X * Output the map of basic blocks to appropriate procedures
X */
X strcpy(file_name, program);
X strcat(file_name, ".static.ProcMap");
X output_procmap(file_name);
X
X /*
X * Ok, now actually insert the instrumentation, using the same
X * proc and block numbers as before
X */
X objnum = 0;
X procnum = 0;
X blocknum = 0;
X
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X for (block =GetFirstBlock(proc); block; block = GetNextBlock(block)) {
X Inst* inst;
X int loads = 0;
X int stores = 0;
X
X for (inst =GetFirstInst(block); inst; inst = GetNextInst(inst)) {
X
X union alpha_instruction foo;
X int op;
X
X foo.word = GetInstInfo(inst, InstBinary);
X op = foo.f_format.opcode;
X
X /*
X * Skip any aligned load/store operations
X */
X if ( is_unaligned_load_store(op) ) {
X break;
X }
X
X if (IsInstType(inst,InstTypeLoad)) {
X switch ( BytesInLoadStore(inst) ) {
X case 4:
X AddCallInst(inst,InstBefore,"Load4",EffAddrValue);
X break;
X case 8:
X AddCallInst(inst,InstBefore,"Load8",EffAddrValue);
X break;
X default:
X fprintf(stderr,"Bogus size of %d returned from Bytes\n",
X BytesInLoadStore(inst) );
X abort();
X }
X
X loads++;
X
X } else if (IsInstType(inst,InstTypeStore)) {
X
X switch ( BytesInLoadStore(inst) ) {
X case 4:
X AddCallInst(inst,InstBefore,"Store4",EffAddrValue);
X break;
X case 8:
X AddCallInst(inst,InstBefore,"Store8",EffAddrValue);
X break;
X default:
X fprintf(stderr,"Bogus size of %d returned from Bytes\n",
X BytesInLoadStore(inst) );
X abort();
X }
X
X stores++;
X }
X }
X
X if ( loads + stores > 0 ) {
X AddCallBlock(block, BlockBefore, "EnterBlock",
X blocknum, loads, stores);
X }
X
X blocknum++;
X
X }
X procnum++;
X }
X objnum++;
X }
X
X AddCallProgram(ProgramBefore, "BeforeAppRuns", program,
X procnum, blocknum);
X AddCallProgram(ProgramAfter, "AfterAppRuns");
X
X /*
X * Write out all objects after full instrumentation
X */
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X WriteObj(obj);
X }
X return(0);
X}
END_OF_FILE
if test 3236 -ne `wc -c <'UnalignedLoads/InstUnaligned.c'`; then
echo shar: \"'UnalignedLoads/InstUnaligned.c'\" unpacked with wrong size!
fi
# end of 'UnalignedLoads/InstUnaligned.c'
fi
if test -f 'UnalignedLoads/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'UnalignedLoads/Makefile'\"
else
echo shar: Extracting \"'UnalignedLoads/Makefile'\" \(826 characters\)
sed "s/^X//" >'UnalignedLoads/Makefile' <<'END_OF_FILE'
XCC =cc -migrate
XCFLAGS = -O5 -I/usr/lib/newatom/Atom -I/srl/ATOM/include
XATOM = atom -A1
X
X#ATOMIZE = /srl/ATOM/ATOMized/SPEC92/espress/espress.rr
X#RUN = ./run-one /srl/ATOM/ATOMized/SPEC92/espress/test/Z5xp1.in\
X# > /dev/null
X
X#ATOMIZE = /srl/ATOM/ATOMized/SPEC92/tomcatv/tomcatv.rr
X#RUN = time ./run-one
X
X#ATOMIZE =/srl/ATOM/ATOMized/SPEC92/compres/compres.rr
X#RUN = rm -f cref.in.Z ; cp -f /srl/ATOM/ATOMized/SPEC92/compres/test/ref.in cref.in; \
X# time run-one cref.in
X
XATOMIZE =/homes/grunwald/Research/ASCI/LFK/lfk537e
XRUN = echo run it elsewhere
X
XLIBS = -L/srl/ATOM/lib -lrpcc
X
Xfoo: Anal.o Inst.o
X $(ATOM) $(ATOMIZE) Inst.o Anal.o -o run-one
X $(RUN)
X
XAnal.o: AnalUnaligned.o
X ld -non_shared -r -o $@ $^ $(LIBS)
X
XInst.o: InstUnaligned.o ../extra/extra.o
X ld -non_shared -r -o $@ $^ $(LIBS)
X
Xclean:
X -rm *.o
X -rm run-one
END_OF_FILE
if test 826 -ne `wc -c <'UnalignedLoads/Makefile'`; then
echo shar: \"'UnalignedLoads/Makefile'\" unpacked with wrong size!
fi
# end of 'UnalignedLoads/Makefile'
fi
if test -f 'extra/extra.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'extra/extra.c'\"
else
echo shar: Extracting \"'extra/extra.c'\" \(7223 characters\)
sed "s/^X//" >'extra/extra.c' <<'END_OF_FILE'
X#include "extra.h"
X#include <cmplrs/atom.inst.h>
X#include <string.h>
X#include <stdlib.h>
X#include <alpha/inst.h>
X#include <stdio.h>
X
Xint total_number_procs()
X{
X Obj* obj;
X int total_procs = 0;
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X total_procs += GetObjInfo(obj, ObjNumberProcs);
X }
X return total_procs;
X}
X
Xint total_number_blocks()
X{
X Obj* obj;
X int total_blocks = 0;
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X total_blocks += GetObjInfo(obj, ObjNumberBlocks);
X }
X return total_blocks;
X}
X
Xvoid
Xoutput_static_information(char *file_name)
X{
X FILE* f = fopen(file_name,"w");
X Proc* proc;
X Obj* obj;
X
X if ( f == NULL ) {
X fprintf(stderr,"Unable to open file %s for writing\n", file_name);
X abort();
X }
X
X fprintf(stderr,"Writing %s\n", file_name);
X
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X char woof[1024];
X char *procname = ProcName(proc);
X
X if ( procname == NULL ) {
X strcpy(woof,"Unknown procedure");
X } else {
X strcpy(woof,ProcName(proc));
X }
X woof[28] = 0;
X fprintf(f, "%-30s\n", woof);
X }
X }
X
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X for (block =GetFirstBlock(proc); block; block = GetNextBlock(block)) {
X char fn[512];
X char woof[512];
X char *procname = ProcName(proc);
X char *pfn = ProcFileName(proc);
X /*
X * Library file names tend to be long and hairy. We cut them
X * down
X */
X if ( pfn == NULL ) {
X strcpy(fn, "<unknown>");
X } else {
X char *foo;
X strcpy(fn,ProcFileName(proc));
X foo = rindex(fn, '/');
X if ( foo != NULL ) {
X strcpy(fn,foo);
X }
X }
X
X if (procname == NULL) {
X strcpy(woof, "Unkown Procedure");
X } else {
X strcpy(woof,procname);
X }
X woof[15] = 0;
X fn[10] = 0;
X
X fprintf(f, "%-15s %-10s %4d\n",
X woof, fn, InstLineNo(GetFirstInst(block)) );
X }
X }
X }
X
X fclose(f);
X}
X
Xvoid
Xoutput_procmap(char *file_name)
X{
X FILE* f = fopen(file_name,"w");
X Proc* proc;
X Obj* obj;
X
X int pn = 0;
X int bn = 0;
X int on = 0;
X
X if ( f == NULL ) {
X fprintf(stderr,"Unable to open file %s for writing\n", file_name);
X abort();
X }
X
X fprintf(stderr,"Writing %s\n", file_name);
X fprintf(f, "%d\n", total_number_procs());
X fprintf(f, "%d\n", total_number_blocks());
X
X /*
X * Output correspondence of blocks to their appropriate objects and procs
X */
X for (obj = GetFirstObj(); obj != NULL; obj = GetNextObj(obj)) {
X for (proc = GetFirstObjProc(obj); proc != NULL; proc = GetNextProc(proc)) {
X Block* block;
X for (block =GetFirstBlock(proc); block; block = GetNextBlock(block)) {
X fprintf(f, "%d %d\n", pn, on);
X bn++;
X }
X pn++;
X }
X on++;
X }
X fclose(f);
X}
X
X
Xint
Xis_floating_divide(int fcn)
X{
X
X switch ( fcn ) {
X case flti_divs:
X case flti_divsc:
X case flti_divsd:
X case flti_divsm:
X case flti_divssu:
X case flti_divssuc:
X case flti_divssud:
X case flti_divssui:
X case flti_divssuic:
X case flti_divssuid:
X case flti_divssuim:
X case flti_divssum:
X case flti_divsu:
X case flti_divsuc:
X case flti_divsud:
X case flti_divsum:
X case flti_divt:
X case flti_divtc:
X case flti_divtd:
X case flti_divtm:
X case flti_divtsu:
X case flti_divtsuc:
X case flti_divtsud:
X case flti_divtsui:
X case flti_divtsuic:
X case flti_divtsuid:
X case flti_divtsuim:
X case flti_divtsum:
X case flti_divtu:
X case flti_divtuc:
X case flti_divtud:
X case flti_divtum:
X case fltv_divfs:
X case fltv_divfsc:
X case fltv_divgs:
X case fltv_divgsc:
X return 1;
X default:
X return 0;
X }
X}
X
Xint
Xis_floating_multiply(int fcn)
X{
X
X switch ( fcn ) {
X case flti_muls:
X case flti_mulsc:
X case flti_mulsd:
X case flti_mulsm:
X case flti_mulssu:
X case flti_mulssuc:
X case flti_mulssud:
X case flti_mulssui:
X case flti_mulssuic:
X case flti_mulssuid:
X case flti_mulssuim:
X case flti_mulssum:
X case flti_mulsu:
X case flti_mulsuc:
X case flti_mulsud:
X case flti_mulsum:
X case flti_mult:
X case flti_multc:
X case flti_multd:
X case flti_multm:
X case flti_multsu:
X case flti_multsuc:
X case flti_multsud:
X case flti_multsui:
X case flti_multsuic:
X case flti_multsuid:
X case flti_multsuim:
X case flti_multsum:
X case flti_multu:
X case flti_multuc:
X case flti_multud:
X case flti_multum:
X case fltv_mulfs:
X case fltv_mulfsc:
X case fltv_mulgs:
X case fltv_mulgsc:
X return 1;
X default:
X return 0;
X }
X}
X
Xint
Xis_floating_sub(int fcn)
X{
X
X switch ( fcn ) {
X case flti_subs:
X case flti_subsc:
X case flti_subsd:
X case flti_subsm:
X case flti_subssu:
X case flti_subssuc:
X case flti_subssud:
X case flti_subssui:
X case flti_subssuic:
X case flti_subssuid:
X case flti_subssuim:
X case flti_subssum:
X case flti_subsu:
X case flti_subsuc:
X case flti_subsud:
X case flti_subsum:
X case flti_subt:
X case flti_subtc:
X case flti_subtd:
X case flti_subtm:
X case flti_subtsu:
X case flti_subtsuc:
X case flti_subtsud:
X case flti_subtsui:
X case flti_subtsuic:
X case flti_subtsuid:
X case flti_subtsuim:
X case flti_subtsum:
X case flti_subtu:
X case flti_subtuc:
X case flti_subtud:
X case flti_subtum:
X case fltv_subfs:
X case fltv_subfsc:
X case fltv_subgs:
X case fltv_subgsc:
X
X return 1;
X default:
X return 0;
X }
X}
X
Xint
Xis_floating_add(int fcn)
X{
X
X switch ( fcn ) {
X case flti_adds:
X case flti_addsd:
X case flti_addssu:
X case flti_addssuc:
X case flti_addssud:
X case flti_addssui:
X case flti_addssuic:
X case flti_addssuid:
X case flti_addssuim:
X case flti_addssum:
X case flti_addsu:
X case flti_addsuc:
X case flti_addsud:
X case flti_addsum:
X case flti_addt:
X case flti_addtd:
X case flti_addtsu:
X case flti_addtsuc:
X case flti_addtsud:
X case flti_addtsui:
X case flti_addtsuic:
X case flti_addtsuid:
X case flti_addtsuim:
X case flti_addtsum:
X case flti_addtu:
X case flti_addtuc:
X case flti_addtud:
X case flti_addtum:
X case fltv_addfs:
X case fltv_addfsc:
X case fltv_addgs:
X case fltv_addgsc:
X return 1;
X default:
X return 0;
X }
X}
X
Xint
XBytesInLoadStore(Inst* inst)
X{
X union alpha_instruction bits;
X int opcode;
X unsigned long PC;
X
X PC = InstPC(inst);
X bits.word = GetInstBinary(PC);
X opcode = bits.j_format.opcode;
X
X switch( opcode ) {
X case op_ldl:
X case op_ldl_l:
X
X case op_stl:
X case op_stl_c:
X return 4;
X
X /*
X * Floating point
X * F = 4 bytes
X * S = 4 bytes
X * T = 8 bytes
X * D = 8 bytes
X * G = 8 bytes
X */
X case op_ldf:
X case op_stf:
X
X case op_lds:
X case op_sts:
X
X return 4;
X
X /*
X * eight byte load/store
X */
X case op_ldq:
X case op_ldq_l:
X case op_ldq_u:
X
X case op_stq:
X case op_stq_c:
X case op_stq_u:
X return 8;
X
X case op_ldg:
X case op_stg:
X
X case op_ldt:
X case op_stt:
X
X#if not_implemented_uses_ldg_instead
X case op_ldd:
X case op_std:
X#endif
X return 8;
X
X default:
X fprintf(stderr,"Found bogus load/store instruction\n");
X fprintf(stderr,"Opcode = 0x%x\n", opcode);
X return 0;
X }
X}
X
Xint
Xis_unaligned_load_store(int fcn)
X{
X switch (fcn) {
X case op_ldq_u:
X case op_stq_u:
X return 1;
X default:
X return 0;
X }
X}
X
END_OF_FILE
if test 7223 -ne `wc -c <'extra/extra.c'`; then
echo shar: \"'extra/extra.c'\" unpacked with wrong size!
fi
# end of 'extra/extra.c'
fi
if test -f 'extra/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'extra/Makefile'\"
else
echo shar: Extracting \"'extra/Makefile'\" \(53 characters\)
sed "s/^X//" >'extra/Makefile' <<'END_OF_FILE'
Xextra.o: extra.c extra.h
X $(CC) $(CFLAGS) -c extra.c
END_OF_FILE
if test 53 -ne `wc -c <'extra/Makefile'`; then
echo shar: \"'extra/Makefile'\" unpacked with wrong size!
fi
# end of 'extra/Makefile'
fi
echo shar: End of shell archive.
exit 0
--
next prev parent reply other threads:[~1996-11-16 5:00 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-11-15 5:00 unaligned access gautam
1996-11-16 5:00 ` Dirk Grunwald [this message]
1996-11-20 5:00 ` Jeff Denham
1996-11-22 5:00 ` Curt Smith
1996-11-21 5:00 ` Anthony Berent
-- strict thread matches above, loose matches on Subject: below --
2003-03-06 6:27 Unaligned access Emmanuel STAPF [ISE]
2000-03-31 5:00 Kraisit Vittinanon
2000-04-04 4:00 ` Oisin McGuinness
1998-03-31 5:00 Allen M. Cohen
1998-04-01 5:00 ` Joe Mario
1995-05-20 4:00 unaligned access Adrian Wenden
1995-05-22 4:00 ` Eric Osborne
1995-05-24 4:00 ` Vepa V Sirish
1995-05-25 4:00 ` John Wood
1994-02-05 21:21 Stefan Monnier
1994-02-06 9:39 ` Jarkko Hietaniemi
1993-11-30 22:25 Roland Schemers
1993-11-30 23:25 ` Matt Thomas
1993-12-01 12:06 ` Burkhard Neidecker-Lutz
1993-12-07 1:27 ` Jim Hurst
1993-02-23 15:55 Unaligned access Byron Jennings
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox