mirror of
https://github.com/vortexgpgpu/vortex.git
synced 2025-04-23 21:39:10 -04:00
First (not quite working) floating point benchmark.
This commit is contained in:
parent
89e66d64f2
commit
0e0aa64e74
6 changed files with 45 additions and 10 deletions
|
@ -159,6 +159,9 @@ void Instruction::executeOn(Core &c) {
|
|||
case SHL: reg[rdest] = reg[rsrc[0]] << reg[rsrc[1]];
|
||||
reg[rdest].trunc(wordSz);
|
||||
break;
|
||||
case SHR: reg[rdest] = reg[rsrc[0]] >> reg[rsrc[1]];
|
||||
reg[rdest].trunc(wordSz);
|
||||
break;
|
||||
case MOD: if (reg[rsrc[1]] == 0) throw DomainException();
|
||||
reg[rdest] = reg[rsrc[0]] % reg[rsrc[1]];
|
||||
break;
|
||||
|
|
|
@ -94,9 +94,9 @@ static uint64_t readParenExpression(const string &s, const map<string, Word> &d,
|
|||
exit(1);
|
||||
}
|
||||
|
||||
int lexerBits;
|
||||
int lexerBytes;
|
||||
Obj *AsmReader::read(std::istream &input) {
|
||||
lexerBits = wordSize;
|
||||
lexerBytes = wordSize;
|
||||
FlexLexer *f = new yyFlexLexer(&input);
|
||||
Obj *o = new Obj();
|
||||
std::vector<Chunk>::reverse_iterator cur;
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
#include "include/asm-tokens.h"
|
||||
#include "include/harpfloat.h"
|
||||
|
||||
extern int lexerBits;
|
||||
extern int lexerBytes;
|
||||
static int64_t read_number(const char *s) {
|
||||
while (!isdigit(*s) && *s != '-' && *s != '+') s++;
|
||||
|
||||
if (strchr(s, 'f') || strchr(s, '.')) {
|
||||
double d;
|
||||
sscanf(s, "%f", &d);
|
||||
return Harp::Word_u(Harp::Float(d, lexerBits));
|
||||
return Harp::Word_u(Harp::Float(d, lexerBytes));
|
||||
} else {
|
||||
long long u;
|
||||
sscanf(s, "%lli", &u);
|
||||
|
|
|
@ -4,11 +4,11 @@ HARPEM = ../harptool -E
|
|||
HARPDIS = ../harptool -D
|
||||
4BARCH = 4b16/16/2
|
||||
|
||||
all: simple.bin sieve.bin 2thread.bin simple.4b.bin sieve.4b.bin 2thread.4b.bin bubble.bin bubble.4b.bin
|
||||
all: simple.bin sieve.bin 2thread.bin simple.4b.bin sieve.4b.bin 2thread.4b.bin bubble.bin bubble.4b.bin dotprod.bin dotprod.4b.bin
|
||||
|
||||
run: simple.out sieve.out 2thread.out simple.4b.out sieve.4b.out 2thread.4b.out bubble.out bubble.4b.out
|
||||
run: simple.out sieve.out 2thread.out simple.4b.out sieve.4b.out 2thread.4b.out bubble.out bubble.4b.out dotprod.out dotprod.4b.out
|
||||
|
||||
disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d bubble.4b.d
|
||||
disas: simple.d sieve.d 2thread.d simple.4b.d sieve.4b.d 2thread.4b.d bubble.d bubble.4b.d dotprod.d dotprod.4b.d
|
||||
|
||||
%.4b.out : %.4b.bin
|
||||
$(HARPEM) -a $(4BARCH) -c $< > $@
|
||||
|
@ -34,12 +34,18 @@ simple.bin : boot.HOF lib.HOF simple.HOF
|
|||
sieve.bin : boot.HOF lib.HOF sieve.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
dotprod.bin : boot.HOF lib.HOF dotprod.HOF
|
||||
$(HARPLD) -o $@ $^
|
||||
|
||||
simple.4b.bin : boot.4b.HOF lib.4b.HOF simple.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
sieve.4b.bin : boot.4b.HOF lib.4b.HOF sieve.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
dotprod.4b.bin : boot.4b.HOF lib.4b.HOF sieve.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $^
|
||||
|
||||
%.4b.bin : %.4b.HOF
|
||||
$(HARPLD) --arch $(4BARCH) -o $@ $<
|
||||
|
||||
|
|
|
@ -12,7 +12,13 @@
|
|||
.perm x
|
||||
.entry
|
||||
.global
|
||||
entry: /* . . . */
|
||||
entry: ldi %r0, array_a;
|
||||
ldi %r1, array_b;
|
||||
ldi %r2, #1;
|
||||
jali %r5, dotprod
|
||||
|
||||
ori %r7, %r0, #0;
|
||||
jali %r5, printhex;
|
||||
|
||||
trap;
|
||||
|
||||
|
@ -20,14 +26,16 @@ entry: /* . . . */
|
|||
length in r2 */
|
||||
dotprod: ldi %r3, #0;
|
||||
dploop: ld %r4, %r0, #0;
|
||||
ld %r5, %r1, #0;
|
||||
ld %r6, %r1, #0;
|
||||
subi %r2, %r2, #1;
|
||||
addi %r0, %r0, __WORD;
|
||||
addi %r1, %r1, __WORD;
|
||||
rtop @p0, %r2;
|
||||
fadd %r4, %r4, %r5;
|
||||
fadd %r4, %r4, %r6;
|
||||
fadd %r3, %r3, %r4;
|
||||
@p0 ? jmpi dploop;
|
||||
ori %r0, %r3, #0;
|
||||
jmpr %r5;
|
||||
|
||||
.perm rw
|
||||
|
||||
|
|
|
@ -7,6 +7,24 @@
|
|||
*******************************************************************************/
|
||||
/* Library: print decimals and strings! */
|
||||
.perm x
|
||||
|
||||
.global
|
||||
printhex: ldi %r8, (__WORD * 8);
|
||||
ldi %r11, #1;
|
||||
shli %r11, %r11, (__WORD*8 - 1);
|
||||
printhex_l1: subi %r8, %r8, #4;
|
||||
shr %r9, %r7, %r8;
|
||||
andi %r9, %r9, #15;
|
||||
subi %r10, %r9, #9;
|
||||
isneg @p0, %r10;
|
||||
notp @p1, @p0;
|
||||
@p0 ? addi %r9, %r9, #0x30
|
||||
@p1 ? addi %r9, %r10, #0x61
|
||||
rtop @p0, %r8;
|
||||
st %r9, %r11, #0;
|
||||
@p0 ? jmpi printhex_l1;
|
||||
jmpr %r5;
|
||||
|
||||
.global
|
||||
printdec: ldi %r8, #1;
|
||||
shli %r8, %r8, (__WORD*8 - 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue