From 32dbccde78562763b6d5cc847d32c5f94fa6cab4 Mon Sep 17 00:00:00 2001 From: Joel Sing Date: Fri, 21 Feb 2020 03:03:57 +1100 Subject: [PATCH] cmd/internal/obj/riscv: add FCLASSS/FCLASSD instructions Add support for floating-point classification instructions. Change-Id: I64463d477b3db0cca16ff7bced64f154011ef4cb Reviewed-on: https://go-review.googlesource.com/c/go/+/220542 Reviewed-by: Cherry Zhang --- src/cmd/asm/internal/asm/testdata/riscvenc.s | 8 +++++++- src/cmd/internal/obj/riscv/obj.go | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/cmd/asm/internal/asm/testdata/riscvenc.s b/src/cmd/asm/internal/asm/testdata/riscvenc.s index aae862628d..06158153d8 100644 --- a/src/cmd/asm/internal/asm/testdata/riscvenc.s +++ b/src/cmd/asm/internal/asm/testdata/riscvenc.s @@ -225,6 +225,9 @@ start: FLTS F0, F1, X7 // d39300a0 FLES F0, F1, X7 // d38300a0 + // 11.9: Single-Precision Floating-Point Classify Instruction + FCLASSS F0, X5 // d31200e0 + // 12.3: Double-Precision Load and Store Instructions FLD (X5), F0 // 07b00200 FLD 4(X5), F0 // 07b04200 @@ -257,6 +260,9 @@ start: FMVXD F0, X5 // d30200e2 FMVDX X5, F0 // 538002f2 + // 12.6: Double-Precision Floating-Point Classify Instruction + FCLASSD F0, X5 // d31200e2 + // Privileged ISA // 3.2.1: Environment Call and Breakpoint @@ -302,7 +308,7 @@ start: // These jumps can get printed as jumps to 2 because they go to the // second instruction in the function (the first instruction is an // invisible stack pointer adjustment). - JMP start // JMP 2 // 6ff01fc7 + JMP start // JMP 2 // 6ff09fc6 JMP (X5) // 67800200 JMP 4(X5) // 67804200 diff --git a/src/cmd/internal/obj/riscv/obj.go b/src/cmd/internal/obj/riscv/obj.go index 698d9e51da..63b5ed6119 100644 --- a/src/cmd/internal/obj/riscv/obj.go +++ b/src/cmd/internal/obj/riscv/obj.go @@ -1651,6 +1651,9 @@ var encodings = [ALAST & obj.AMask]encoding{ AFLTS & obj.AMask: rFFIEncoding, AFLES & obj.AMask: rFFIEncoding, + // 11.9: Single-Precision Floating-Point Classify Instruction + AFCLASSS & obj.AMask: rFIEncoding, + // 12.3: Double-Precision Load and Store Instructions AFLD & obj.AMask: iFEncoding, AFSD & obj.AMask: sFEncoding, @@ -1686,6 +1689,9 @@ var encodings = [ALAST & obj.AMask]encoding{ AFLTD & obj.AMask: rFFIEncoding, AFLED & obj.AMask: rFFIEncoding, + // 12.7: Double-Precision Floating-Point Classify Instruction + AFCLASSD & obj.AMask: rFIEncoding, + // Privileged ISA // 3.2.1: Environment Call and Breakpoint -- 2.48.1