Skip to content

[RISCV][MC] Add Q support for Zfa #139508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: users/el-ev/riscv-q-ext
Choose a base branch
from

Conversation

el-ev
Copy link
Member

@el-ev el-ev commented May 12, 2025

Copy link
Member Author

el-ev commented May 12, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@el-ev el-ev marked this pull request as ready for review May 12, 2025 07:05
@llvmbot llvmbot added backend:RISC-V mc Machine (object) code labels May 12, 2025
@llvmbot
Copy link
Member

llvmbot commented May 12, 2025

@llvm/pr-subscribers-backend-risc-v

@llvm/pr-subscribers-mc

Author: Iris Shi (el-ev)

Changes

Patch is 25.59 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/139508.diff

5 Files Affected:

  • (modified) llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td (+29)
  • (added) llvm/test/MC/RISCV/rv64zfa-only-valid.s (+19)
  • (modified) llvm/test/MC/RISCV/zfa-invalid.s (+11-2)
  • (added) llvm/test/MC/RISCV/zfa-quad-invalid.s (+42)
  • (modified) llvm/test/MC/RISCV/zfa-valid.s (+383-8)
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td
index 8a449d32e0104..0ad654db42f5c 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZfa.td
@@ -175,6 +175,28 @@ def FLEQ_H : FPCmp_rr<0b1010010, 0b100, "fleq.h", FPR16>;
 }
 } // Predicates = [HasStdExtZfa, HasStdExtZfh]
 
+let Predicates = [HasStdExtZfa, HasStdExtQ] in {
+let isReMaterializable = 1, isAsCheapAsAMove = 1 in
+def FLI_Q : FPFLI_r<0b1111011, 0b00001, 0b000, FPR128, "fli.q">;
+
+def FMINM_Q: FPALU_rr<0b0010111, 0b010, "fminm.q", FPR128, Commutable=1>;
+def FMAXM_Q: FPALU_rr<0b0010111, 0b011, "fmaxm.q", FPR128, Commutable=1>;
+
+def FROUND_Q : FPUnaryOp_r_frm<0b0100011, 0b00100, FPR128, FPR128, "fround.q">;
+def FROUNDNX_Q : FPUnaryOp_r_frm<0b0100011, 0b00101, FPR128, FPR128, 
+                                 "froundnx.q">;
+
+def FLTQ_Q : FPCmp_rr<0b1010011, 0b101, "fltq.q", FPR128>;
+def FLEQ_Q : FPCmp_rr<0b1010011, 0b100, "fleq.q", FPR128>;
+} // Predicates = [HasStdExtZfa, HasStdExtQ]
+
+let Predicates = [HasStdExtZfa, HasStdExtQ, IsRV64] in {
+  let mayRaiseFPException = 0 in {
+    def FMVH_X_Q : FPUnaryOp_r<0b1110011, 0b00001, 0b000, GPR, FPR128, "fmvh.x.q">;
+    def FMVP_Q_X : FPBinaryOp_rr<0b1011011, 0b000, FPR128, GPR, "fmvp.q.x">;
+  }
+} // Predicates = [HasStdExtZfa, HasStdExtQ, IsRV64]
+
 //===----------------------------------------------------------------------===//
 // Pseudo-instructions and codegen patterns
 //===----------------------------------------------------------------------===//
@@ -200,6 +222,13 @@ def : InstAlias<"fgeq.h $rd, $rs, $rt",
                 (FLEQ_H GPR:$rd, FPR16:$rt, FPR16:$rs), 0>;
 }
 
+let Predicates = [HasStdExtZfa, HasStdExtQ] in {
+def : InstAlias<"fgtq.q $rd, $rs, $rt",
+                (FLTQ_Q GPR:$rd, FPR128:$rt, FPR128:$rs), 0>;
+def : InstAlias<"fgeq.q $rd, $rs, $rt",
+                (FLEQ_Q GPR:$rd, FPR128:$rt, FPR128:$rs), 0>;
+}
+
 //===----------------------------------------------------------------------===//
 // Codegen patterns
 //===----------------------------------------------------------------------===//
diff --git a/llvm/test/MC/RISCV/rv64zfa-only-valid.s b/llvm/test/MC/RISCV/rv64zfa-only-valid.s
new file mode 100644
index 0000000000000..95fb253b145c1
--- /dev/null
+++ b/llvm/test/MC/RISCV/rv64zfa-only-valid.s
@@ -0,0 +1,19 @@
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+zfa,+q,+zfh -M no-aliases -show-encoding \
+# RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+zfa,+q,+zfh < %s \
+# RUN:     | llvm-objdump --mattr=+zfa,+q,+zfh -M no-aliases -d -r - \
+# RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
+#
+# RUN: not llvm-mc -triple riscv64 -mattr=+q,+zfh \
+# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
+# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
+
+# CHECK-ASM-AND-OBJ: fmvh.x.q a1, fs1
+# CHECK-ASM: encoding: [0xd3,0x85,0x14,0xe6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fmvh.x.q a1, fs1
+
+# CHECK-ASM-AND-OBJ: fmvp.q.x fs1, a1, a2
+# CHECK-ASM: encoding: [0xd3,0x84,0xc5,0xb6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fmvp.q.x fs1, a1, a2
diff --git a/llvm/test/MC/RISCV/zfa-invalid.s b/llvm/test/MC/RISCV/zfa-invalid.s
index c2537c3fc5102..cedc9279db3cb 100644
--- a/llvm/test/MC/RISCV/zfa-invalid.s
+++ b/llvm/test/MC/RISCV/zfa-invalid.s
@@ -1,5 +1,5 @@
-# RUN: not llvm-mc -triple riscv64 -mattr=+zfa,+d,+zfh < %s 2>&1 | FileCheck -check-prefixes=CHECK-NO-RV32 %s
-# RUN: not llvm-mc -triple riscv32 -mattr=+zfa,+d,+zfh < %s 2>&1 | FileCheck -check-prefixes=CHECK-NO-RV64 %s
+# RUN: not llvm-mc -triple riscv64 -mattr=+zfa,+q,+zfh < %s 2>&1 | FileCheck -check-prefixes=CHECK-NO-RV32 %s
+# RUN: not llvm-mc -triple riscv32 -mattr=+zfa,+q,+zfh < %s 2>&1 | FileCheck -check-prefixes=CHECK-NO-RV64 %s
 
 # Invalid rounding modes
 # CHECK-NO-RV64: error: operand must be 'rtz' floating-point rounding mode
@@ -35,6 +35,10 @@ fli.d ft1, 3.560000e+02
 # CHECK-NO-RV32: error: operand must be a valid floating-point constant
 fli.h ft1, 1.600000e+00
 
+# CHECK-NO-RV64: error: operand must be a valid floating-point constant
+# CHECK-NO-RV32: error: operand must be a valid floating-point constant
+fli.q ft1, 2.250000e+00
+
 # CHECK-NO-RV64: error: invalid floating point immediate
 # CHECK-NO-RV32: error: invalid floating point immediate
 fli.s ft1, -min
@@ -72,6 +76,11 @@ fli.d ft1, 1.1754943508222875079687365372222456778186655567720875215087517062784
 # CHECK-NO-RV32: error: operand must be a valid floating-point constant
 fli.h ft1, 1.1754943508222875079687365372222456778186655567720875215087517062784172594547271728515625e-38
 
+# Don't accept single precision minimum for quad.
+# CHECK-NO-RV64: error: operand must be a valid floating-point constant
+# CHECK-NO-RV32: error: operand must be a valid floating-point constant
+fli.q ft1, 1.1754943508222875079687365372222456778186655567720875215087517062784172594547271728515625e-38
+
 # Don't accept integers.
 # CHECK-NO-RV32: error: invalid floating point immediate
 # CHECK-NO-RV64: error: invalid floating point immediate
diff --git a/llvm/test/MC/RISCV/zfa-quad-invalid.s b/llvm/test/MC/RISCV/zfa-quad-invalid.s
new file mode 100644
index 0000000000000..3ca89c6ebe627
--- /dev/null
+++ b/llvm/test/MC/RISCV/zfa-quad-invalid.s
@@ -0,0 +1,42 @@
+# RUN: not llvm-mc -triple riscv32 -mattr=+zfa,+zfh \
+# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
+# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXTQ %s
+# RUN: not llvm-mc -triple riscv64 -mattr=+zfa,+zfh \
+# RUN:     -M no-aliases -show-encoding < %s 2>&1 \
+# RUN:     | FileCheck -check-prefixes=CHECK-NO-EXTQ %s
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fminm.q fa0, fa1, fa2
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fmaxm.q fs3, fs4, fs5
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fround.q fs1, fs2
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fround.q fs1, fs2, dyn
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fround.q fs1, fs2, rtz
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fround.q fs1, fs2, rne
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+froundnx.q fs1, fs2
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+froundnx.q fs1, fs2, dyn
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+froundnx.q fs1, fs2, rtz
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+froundnx.q fs1, fs2, rne
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fltq.q a1, fs1, fs2
+
+# CHECK-NO-EXTQ: error: instruction requires the following: 'Q' (Quad-Precision Floating-Point){{$}}
+fleq.q a1, ft1, ft2
diff --git a/llvm/test/MC/RISCV/zfa-valid.s b/llvm/test/MC/RISCV/zfa-valid.s
index 6e78a4c0f2584..edf830642c263 100644
--- a/llvm/test/MC/RISCV/zfa-valid.s
+++ b/llvm/test/MC/RISCV/zfa-valid.s
@@ -1,18 +1,18 @@
-# RUN: llvm-mc %s -triple=riscv32 -mattr=+zfa,+d,+zfh -M no-aliases -show-encoding \
+# RUN: llvm-mc %s -triple=riscv32 -mattr=+zfa,+q,+zfh -M no-aliases -show-encoding \
 # RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
-# RUN: llvm-mc %s -triple=riscv64 -mattr=+zfa,+d,+zfh -M no-aliases -show-encoding \
+# RUN: llvm-mc %s -triple=riscv64 -mattr=+zfa,+q,+zfh -M no-aliases -show-encoding \
 # RUN:     | FileCheck -check-prefixes=CHECK-ASM,CHECK-ASM-AND-OBJ %s
-# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+zfa,+d,+zfh < %s \
-# RUN:     | llvm-objdump --mattr=+zfa,+d,+zfh -M no-aliases -d -r - \
+# RUN: llvm-mc -filetype=obj -triple=riscv32 -mattr=+zfa,+q,+zfh < %s \
+# RUN:     | llvm-objdump --mattr=+zfa,+q,+zfh -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
-# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+zfa,+d,+zfh < %s \
-# RUN:     | llvm-objdump --mattr=+zfa,+d,+zfh -M no-aliases -d -r - \
+# RUN: llvm-mc -filetype=obj -triple=riscv64 -mattr=+zfa,+q,+zfh < %s \
+# RUN:     | llvm-objdump --mattr=+zfa,+q,+zfh -M no-aliases -d -r - \
 # RUN:     | FileCheck --check-prefix=CHECK-ASM-AND-OBJ %s
 #
-# RUN: not llvm-mc -triple riscv32 -mattr=+d,+zfh \
+# RUN: not llvm-mc -triple riscv32 -mattr=+q,+zfh \
 # RUN:     -M no-aliases -show-encoding < %s 2>&1 \
 # RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
-# RUN: not llvm-mc -triple riscv64 -mattr=+d,+zfh \
+# RUN: not llvm-mc -triple riscv64 -mattr=+q,+zfh \
 # RUN:     -M no-aliases -show-encoding < %s 2>&1 \
 # RUN:     | FileCheck -check-prefixes=CHECK-NO-EXT %s
 
@@ -933,6 +933,311 @@ fli.h ft1, INF
 # CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
 fli.h ft1, nan
 
+# CHECK-ASM-AND-OBJ: fli.q ft1, -1.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x10,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, -1.000000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, -1.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x10,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, -0x1p+0
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, min
+# CHECK-ASM: encoding: [0xd3,0x80,0x10,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, min
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.52587890625e-05
+# CHECK-ASM: encoding: [0xd3,0x00,0x11,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.52587890625e-05
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.52587890625e-05
+# CHECK-ASM: encoding: [0xd3,0x00,0x11,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-16
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 3.0517578125e-05
+# CHECK-ASM: encoding: [0xd3,0x80,0x11,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 3.0517578125e-05
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 3.0517578125e-05
+# CHECK-ASM: encoding: [0xd3,0x80,0x11,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-15
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.00390625
+# CHECK-ASM: encoding: [0xd3,0x00,0x12,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 3.906250e-03
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.00390625
+# CHECK-ASM: encoding: [0xd3,0x00,0x12,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-8
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.0078125
+# CHECK-ASM: encoding: [0xd3,0x80,0x12,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 7.812500e-03
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.0078125
+# CHECK-ASM: encoding: [0xd3,0x80,0x12,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-7
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.0625
+# CHECK-ASM: encoding: [0xd3,0x00,0x13,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 6.250000e-02
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.0625
+# CHECK-ASM: encoding: [0xd3,0x00,0x13,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-4
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.125
+# CHECK-ASM: encoding: [0xd3,0x80,0x13,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.250000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.125
+# CHECK-ASM: encoding: [0xd3,0x80,0x13,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-3
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.25
+# CHECK-ASM: encoding: [0xd3,0x00,0x14,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 2.500000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.25
+# CHECK-ASM: encoding: [0xd3,0x00,0x14,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-2
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.3125
+# CHECK-ASM: encoding: [0xd3,0x80,0x14,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 3.125000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.3125
+# CHECK-ASM: encoding: [0xd3,0x80,0x14,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.4p-2
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.375
+# CHECK-ASM: encoding: [0xd3,0x00,0x15,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 3.750000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.375
+# CHECK-ASM: encoding: [0xd3,0x00,0x15,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.8p-2
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.4375
+# CHECK-ASM: encoding: [0xd3,0x80,0x15,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 4.375000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.4375
+# CHECK-ASM: encoding: [0xd3,0x80,0x15,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.cp-2
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.5
+# CHECK-ASM: encoding: [0xd3,0x00,0x16,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 5.000000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.5
+# CHECK-ASM: encoding: [0xd3,0x00,0x16,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p-1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.625
+# CHECK-ASM: encoding: [0xd3,0x80,0x16,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 6.250000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.625
+# CHECK-ASM: encoding: [0xd3,0x80,0x16,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.4p-1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.75
+# CHECK-ASM: encoding: [0xd3,0x00,0x17,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 7.500000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.75
+# CHECK-ASM: encoding: [0xd3,0x00,0x17,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.8p-1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.875
+# CHECK-ASM: encoding: [0xd3,0x80,0x17,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 8.750000e-01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 0.875
+# CHECK-ASM: encoding: [0xd3,0x80,0x17,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.cp-1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x18,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.000000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x18,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p+0
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.25
+# CHECK-ASM: encoding: [0xd3,0x80,0x18,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.250000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.25
+# CHECK-ASM: encoding: [0xd3,0x80,0x18,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.4p+0
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.5
+# CHECK-ASM: encoding: [0xd3,0x00,0x19,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.500000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.5
+# CHECK-ASM: encoding: [0xd3,0x00,0x19,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.8p+0
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.75
+# CHECK-ASM: encoding: [0xd3,0x80,0x19,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.750000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 1.75
+# CHECK-ASM: encoding: [0xd3,0x80,0x19,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.cp+0
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 2.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1a,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 2.000000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 2.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1a,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p+1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 2.5
+# CHECK-ASM: encoding: [0xd3,0x80,0x1a,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 2.500000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 2.5
+# CHECK-ASM: encoding: [0xd3,0x80,0x1a,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.4p+1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 3.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1b,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 3.000000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 3.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1b,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1.8p+1
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 4.0
+# CHECK-ASM: encoding: [0xd3,0x80,0x1b,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 4.000000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 4.0
+# CHECK-ASM: encoding: [0xd3,0x80,0x1b,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p+2
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 8.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1c,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 8.000000e+00
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 8.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1c,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p+3
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 16.0
+# CHECK-ASM: encoding: [0xd3,0x80,0x1c,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.600000e+01
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 16.0
+# CHECK-ASM: encoding: [0xd3,0x80,0x1c,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p+4
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 128.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1d,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 1.280000e+02
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 128.0
+# CHECK-ASM: encoding: [0xd3,0x00,0x1d,0xf6]
+# CHECK-NO-EXT: error: instruction requires the following: 'Zfa' (Additional Floating-Point){{$}}
+fli.q ft1, 0x1p+7
+
+# CHECK-ASM-AND-OBJ: fli.q ft1, 256.0
+# CHECK-ASM: en...
[truncated]

@el-ev el-ev requested review from asb, topperc and wangpc-pp May 12, 2025 07:08
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from cd6513e to 867ad9d Compare May 12, 2025 07:30
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from 8bcc1db to 8285d7b Compare May 12, 2025 07:30
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from 867ad9d to 537ccab Compare May 12, 2025 07:46
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from 8285d7b to fb1cd01 Compare May 12, 2025 07:46
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from 537ccab to 6f4a034 Compare May 12, 2025 08:45
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch 2 times, most recently from 5ee0513 to b09bc69 Compare May 12, 2025 09:04
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from 6f4a034 to 5e50922 Compare May 12, 2025 09:04
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from b09bc69 to d6d0f27 Compare May 12, 2025 09:05
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from 5e50922 to 6dc2767 Compare May 12, 2025 09:05
Copy link
Collaborator

@topperc topperc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from d6d0f27 to bd8666b Compare May 13, 2025 05:50
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch 2 times, most recently from 1a1cb30 to e8c188a Compare May 13, 2025 05:55
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from bd8666b to da9c246 Compare May 13, 2025 05:55
@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from e8c188a to cd36256 Compare May 13, 2025 06:39
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from da9c246 to 0403000 Compare May 13, 2025 06:39
@el-ev
Copy link
Member Author

el-ev commented May 13, 2025

Graphite is somewhat dumb here as it can't retarget one pr onto another. The scheduler definition will be added later, once either this PR or #139495 is merged.

@el-ev el-ev force-pushed the users/el-ev/05-12-_riscv_mc_add_q_support_for_zfa branch from cd36256 to 450f49c Compare May 13, 2025 08:00
@el-ev el-ev force-pushed the users/el-ev/riscv-q-ext branch from 0403000 to 41892d8 Compare May 13, 2025 08:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:RISC-V mc Machine (object) code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants