From 79cdfd89551dcfe9ed6f7c24bca63c5e80e3df48 Mon Sep 17 00:00:00 2001 From: Avimitin Date: Thu, 1 Aug 2024 15:49:55 +0800 Subject: [PATCH] [nix] fix codegen compile for zvbb insn Signed-off-by: Avimitin --- tests/builder.nix | 30 +++++++++++++++++++----------- tests/codegen/common.txt | 16 ---------------- tests/codegen/default.nix | 5 ++--- tests/codegen/zvbb.txt | 2 +- tests/default.nix | 5 +---- 5 files changed, 23 insertions(+), 35 deletions(-) diff --git a/tests/builder.nix b/tests/builder.nix index f250a8b13f..4730af191a 100644 --- a/tests/builder.nix +++ b/tests/builder.nix @@ -26,17 +26,25 @@ let CC = "${stdenv.targetPlatform.config}-cc"; - NIX_CFLAGS_COMPILE = [ - "-mabi=ilp32f" - "-march=${rtlDesignMetadata.march}" - "-mno-relax" - "-static" - "-mcmodel=medany" - "-fvisibility=hidden" - "-fno-PIC" - "-g" - "-O3" - ]; + NIX_CFLAGS_COMPILE = + let + march = lib.pipe rtlDesignMetadata.march [ + (lib.splitString "_") + (map (ext: if ext == "zvbb" then "zvbb1" else ext)) + (lib.concatStringsSep "_") + ]; + in + [ + "-mabi=ilp32f" + "-march=${march}" + "-mno-relax" + "-static" + "-mcmodel=medany" + "-fvisibility=hidden" + "-fno-PIC" + "-g" + "-O3" + ] ++ lib.optionals (lib.elem "zvbb" (lib.splitString "_" rtlDesignMetadata.march)) [ "-menable-experimental-extensions" ]; installPhase = '' runHook preInstall diff --git a/tests/codegen/common.txt b/tests/codegen/common.txt index 506b3a08a0..98fc1ae395 100644 --- a/tests/codegen/common.txt +++ b/tests/codegen/common.txt @@ -11,19 +11,12 @@ vadd.vx vand.vi vand.vv vand.vx -vandn.vv -vandn.vx vasub.vv vasub.vx vasubu.vv vasubu.vx -vbrev.v -vbrev8.v -vclz.v vcompress.vm vcpop.m -vcpop.v -vctz.v vdiv.vv vdiv.vx vdivu.vv @@ -249,16 +242,10 @@ vrem.vv vrem.vx vremu.vv vremu.vx -vrev8.v vrgather.vi vrgather.vv vrgather.vx vrgatherei16.vv -vrol.vv -vrol.vx -vror.vi -vror.vv -vror.vx vrsub.vi vrsub.vx vs1r.v @@ -427,9 +414,6 @@ vwmulu.vv vwmulu.vx vwredsum.vs vwredsumu.vs -vwsll.vi -vwsll.vv -vwsll.vx vwsub.vv vwsub.vx vwsub.wv diff --git a/tests/codegen/default.nix b/tests/codegen/default.nix index fd8edb6121..e4883ade6d 100644 --- a/tests/codegen/default.nix +++ b/tests/codegen/default.nix @@ -74,11 +74,10 @@ let commonTests = buildTestsFromFile ./common.txt { featuresRequired = [ ]; }; fpTests = buildTestsFromFile ./fp.txt { featuresRequired = [ "zve32f" ]; }; zvbbTests = buildTestsFromFile ./zvbb.txt { featuresRequired = [ "zvbb" ]; }; - hasFeature = feat: lib.any (f: feat == f) currentFeatures; in lib.recurseIntoAttrs ( commonTests // - lib.optionalAttrs (hasFeature "zve32f") fpTests // - lib.optionalAttrs (hasFeature "zvbb") zvbbTests + lib.optionalAttrs (lib.elem "zve32f" currentFeatures) fpTests // + lib.optionalAttrs (lib.elem "zvbb" currentFeatures) zvbbTests ) diff --git a/tests/codegen/zvbb.txt b/tests/codegen/zvbb.txt index 77ed676212..d109f55701 100644 --- a/tests/codegen/zvbb.txt +++ b/tests/codegen/zvbb.txt @@ -1,7 +1,7 @@ vandn.vv vandn.vx vbrev.v -vbreav8.v +vbrev8.v vclz.v vcpop.v vctz.v diff --git a/tests/default.nix b/tests/default.nix index 8a607d59ec..35fbc2ab8f 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -11,8 +11,6 @@ }: let - hasExt = cmp: lib.any (ext: cmp == (lib.toLower ext)) rtlDesignMetadata.extensions; - # Add an extra abstract layer between test case and RTL design, so that we can have clean and organized way # for developer to specify their required features without the need to parse ISA string themselves. currentFeatures = [ @@ -20,8 +18,7 @@ let "dlen:${rtlDesignMetadata.dlen}" "xlen:${if (lib.hasPrefix "rv32" rtlDesignMetadata.march) then "32" else "64"}" ] - ++ lib.optionals (hasExt "zve32f") [ "zve32f" ] - ++ lib.optionals (hasExt "zvbb") [ "zvbb" ]; + ++ (lib.splitString "_" rtlDesignMetadata.march); # isSubSetOf m n: n is subset of m isSubsetOf = m: n: lib.all (x: lib.elem x m) n;