-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
.text | ||
.balign 16 | ||
.globl test | ||
|
||
test: | ||
la t1, test_src_start # t1 = addr | ||
la t2, test_src_end | ||
sub t2, t2, t1 # t2 = remaining length | ||
loop_start: | ||
vsetvli t0, t2, e8, m8, ta, ma # t0 = vl | ||
vle8.v v8, (t1) | ||
vadd.vx v16, v8, t2 # v8 from last vle | ||
vmul.vv v24, v16, v8 # v16 from last instr | ||
vsub.vv v8, v24, v16 # v16 from last 2 instr, v24 from last instr | ||
vse8.v v8, (t1) | ||
|
||
add t1, t1, t0 # incr addr | ||
sub t2, t2, t0 # decr length | ||
bnez t2, loop_start | ||
|
||
ret | ||
|
||
.section .vbss, "aw", @nobits | ||
.balign 64 | ||
test_src_start: | ||
.zero 8192 # 8KB | ||
test_src_end: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ lib | ||
, linkerScript | ||
, makeBuilder | ||
, findAndBuild | ||
, t1main | ||
, getTestRequiredFeatures | ||
}: | ||
|
||
let | ||
builder = makeBuilder { casePrefix = "eval"; }; | ||
build = { caseName, sourcePath }: | ||
builder { | ||
inherit caseName; | ||
|
||
src = sourcePath; | ||
|
||
passthru.featuresRequired = getTestRequiredFeatures sourcePath; | ||
isFp = lib.pathExists (lib.path.append sourcePath "isFp"); | ||
|
||
buildPhase = '' | ||
runHook preBuild | ||
$CC -T${linkerScript} \ | ||
${caseName}.S \ | ||
${t1main} \ | ||
-o $pname.elf | ||
runHook postBuild | ||
''; | ||
|
||
meta.description = "test case '${caseName}', written in C assembly"; | ||
}; | ||
in | ||
findAndBuild ./. build | ||
|