diff --git a/tests/default.nix b/tests/default.nix index c2c99072d..ef90c49da 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -89,11 +89,12 @@ let codegen = casesSelf.callPackage ./codegen { }; rvv_bench = casesSelf.callPackage ./rvv_bench { }; pytorch = casesSelf.callPackage ./pytorch { }; + eval = casesSelf.callPackage ./eval { }; })); # remove non-case attributes in scope scopeStripped = { - inherit (scope) mlir intrinsic asm perf codegen rvv_bench pytorch; + inherit (scope) mlir intrinsic asm perf codegen rvv_bench pytorch eval; }; # This derivation is for internal CI use only. diff --git a/tests/eval/chaining/chaining.S b/tests/eval/chaining/chaining.S new file mode 100644 index 000000000..0c337dbc4 --- /dev/null +++ b/tests/eval/chaining/chaining.S @@ -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: diff --git a/tests/eval/default.nix b/tests/eval/default.nix new file mode 100644 index 000000000..cfaf11aad --- /dev/null +++ b/tests/eval/default.nix @@ -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 +