Re: [PATCH 1/2] target/sh4: add tests for sh4 fipr and ftrv instructions

Philippe Mathieu-Daudé <[email protected]> Mon, 6 Jul 2026 10:49:59 +0200
Newsgroups org.nongnu.qemu-trivial,org.nongnu.qemu-devel
Message-ID <[email protected]>
Hi,

On 29/6/26 23:49, Randy Schifflin wrote:
> Add tests for the TCG generation of the sh4-specific `fipr`
> and `ftrv` instructions.
> 
> Signed-off-by: Randy Schifflin <[email protected]>
> ---
>   tests/tcg/sh4/Makefile.target |  7 +++
>   tests/tcg/sh4/test-fpu-fipr.c | 64 ++++++++++++++++++++++++++++
>   tests/tcg/sh4/test-fpu-ftrv.c | 99 +++++++++++++++++++++++++++++++++++++++++++
>   3 files changed, 170 insertions(+)

Could you fix using the QEMU Coding Style (see docs/devel/style.rst)
and resubmit? Using ./scripts/checkpatch.pl triggers:

9/17 Checking commit 8a09e8d17f84 (target/sh4: add tests for sh4 fipr 
and ftrv instructions)
ERROR: open brace '{' following function declarations go on the next line
#32: FILE: tests/tcg/sh4/test-fpu-fipr.c:7:
+static void single_precision_mode(void) {

ERROR: do not use C99 // comments
#34: FILE: tests/tcg/sh4/test-fpu-fipr.c:9:
+    // Read FPSCR register

ERROR: do not use C99 // comments
#36: FILE: tests/tcg/sh4/test-fpu-fipr.c:11:
+    // Set precision mode to single-precision

ERROR: do not use C99 // comments
#38: FILE: tests/tcg/sh4/test-fpu-fipr.c:13:
+    // Write FPSCR register

ERROR: trailing whitespace
#39: FILE: tests/tcg/sh4/test-fpu-fipr.c:14:
+    asm volatile("lds %0, fpscr" : : "r" (fpscr)); $

ERROR: open brace '{' following function declarations go on the next line
#42: FILE: tests/tcg/sh4/test-fpu-fipr.c:17:
+static float fipr(const float v1[4], const float v2[4]) {

ERROR: do not use C99 // comments
#44: FILE: tests/tcg/sh4/test-fpu-fipr.c:19:
+    // Perform inner product of fv4 and fv8

ERROR: do not use C99 // comments
#45: FILE: tests/tcg/sh4/test-fpu-fipr.c:20:
+    // Result is stored in the last float register of the last vector 
argument

ERROR: code indent should never use tabs
#55: FILE: tests/tcg/sh4/test-fpu-fipr.c:30:
+        "fipr^Ifv4,fv8\n" // (fr4,fr5,fr6,fr7) dot (fr8,fr9,fr10,fr11)$

ERROR: do not use C99 // comments
#55: FILE: tests/tcg/sh4/test-fpu-fipr.c:30:
+        "fipr	fv4,fv8\n" // (fr4,fr5,fr6,fr7) dot (fr8,fr9,fr10,fr11)

ERROR: do not use C99 // comments
#56: FILE: tests/tcg/sh4/test-fpu-fipr.c:31:
+        "fmov fr11,%0\n"   // Result in fr11

ERROR: trailing whitespace
#57: FILE: tests/tcg/sh4/test-fpu-fipr.c:32:
+        : "=f" (fout) $

ERROR: line over 90 characters
#58: FILE: tests/tcg/sh4/test-fpu-fipr.c:33:
+        : "f" (v1[0]), "f" (v1[1]), "f" (v1[2]), "f" (v1[3]), "f" 
(v2[0]), "f" (v2[1]), "f" (v2[2]), "f" (v2[3]));

ERROR: line over 90 characters
#64: FILE: tests/tcg/sh4/test-fpu-fipr.c:39:
+    // The SH4 manual specifies `fipr` is only available when FPSCR 
register precision-mode (PR) bit is 0

ERROR: do not use C99 // comments
#64: FILE: tests/tcg/sh4/test-fpu-fipr.c:39:
+    // The SH4 manual specifies `fipr` is only available when FPSCR 
register precision-mode (PR) bit is 0

ERROR: open brace '{' following function declarations go on the next line
#101: FILE: tests/tcg/sh4/test-fpu-ftrv.c:6:
+static void single_precision_mode(void) {

ERROR: do not use C99 // comments
#103: FILE: tests/tcg/sh4/test-fpu-ftrv.c:8:
+    // Read FPSCR register

ERROR: do not use C99 // comments
#105: FILE: tests/tcg/sh4/test-fpu-ftrv.c:10:
+    // Set precision mode to single-precision

ERROR: do not use C99 // comments
#107: FILE: tests/tcg/sh4/test-fpu-ftrv.c:12:
+    // Write FPSCR register

ERROR: trailing whitespace
#108: FILE: tests/tcg/sh4/test-fpu-ftrv.c:13:
+    asm volatile("lds %0, fpscr" : : "r" (fpscr)); $

ERROR: do not use C99 // comments
#111: FILE: tests/tcg/sh4/test-fpu-ftrv.c:16:
+// Set XMTRX registers to a doubling scale matrix

ERROR: open brace '{' following function declarations go on the next line
#112: FILE: tests/tcg/sh4/test-fpu-ftrv.c:17:
+static void xmtrx_scale_2(void) {

ERROR: do not use C99 // comments
#114: FILE: tests/tcg/sh4/test-fpu-ftrv.c:19:
+        "fldi0 fr0\n" // Pair dr0 (fr0, fr1) = zero,zero

ERROR: do not use C99 // comments
#117: FILE: tests/tcg/sh4/test-fpu-ftrv.c:22:
+        "fadd fr2,fr2\n" // Pair dr2 (fr2,fr3) = two,zero

ERROR: do not use C99 // comments
#120: FILE: tests/tcg/sh4/test-fpu-ftrv.c:25:
+        "fmov fr2,fr5\n" // Pair dr4 (fr4, fr5) = zero,two

ERROR: do not use C99 // comments
#122: FILE: tests/tcg/sh4/test-fpu-ftrv.c:27:
+        // Enable pair-write

ERROR: trailing whitespace
#123: FILE: tests/tcg/sh4/test-fpu-ftrv.c:28:
+        "fschg\n" $

ERROR: do not use C99 // comments
#124: FILE: tests/tcg/sh4/test-fpu-ftrv.c:29:
+        // matrix[0][0] = 2.0

ERROR: do not use C99 // comments
#125: FILE: tests/tcg/sh4/test-fpu-ftrv.c:30:
+        // matrix[0][1] = 0.0

ERROR: trailing whitespace
#126: FILE: tests/tcg/sh4/test-fpu-ftrv.c:31:
+        "fmov dr2,xd0\n" $

ERROR: do not use C99 // comments
#127: FILE: tests/tcg/sh4/test-fpu-ftrv.c:32:
+        // matrix[0][2] = 0.0

ERROR: do not use C99 // comments
#128: FILE: tests/tcg/sh4/test-fpu-ftrv.c:33:
+        // matrix[0][3] = 0.0

ERROR: do not use C99 // comments
#130: FILE: tests/tcg/sh4/test-fpu-ftrv.c:35:
+        // matrix[1][0] = 0.0

ERROR: do not use C99 // comments
#131: FILE: tests/tcg/sh4/test-fpu-ftrv.c:36:
+        // matrix[1][1] = 2.0

ERROR: do not use C99 // comments
#133: FILE: tests/tcg/sh4/test-fpu-ftrv.c:38:
+        // matrix[1][2] = 0.0

ERROR: do not use C99 // comments
#134: FILE: tests/tcg/sh4/test-fpu-ftrv.c:39:
+        // matrix[1][3] = 0.0

ERROR: do not use C99 // comments
#136: FILE: tests/tcg/sh4/test-fpu-ftrv.c:41:
+        // matrix[2][0] = 0.0

ERROR: do not use C99 // comments
#137: FILE: tests/tcg/sh4/test-fpu-ftrv.c:42:
+        // matrix[2][1] = 0.0

ERROR: do not use C99 // comments
#139: FILE: tests/tcg/sh4/test-fpu-ftrv.c:44:
+        // matrix[2][2] = 2.0

ERROR: do not use C99 // comments
#140: FILE: tests/tcg/sh4/test-fpu-ftrv.c:45:
+        // matrix[2][3] = 0.0

ERROR: do not use C99 // comments
#142: FILE: tests/tcg/sh4/test-fpu-ftrv.c:47:
+        // matrix[3][0] = 0.0

ERROR: do not use C99 // comments
#143: FILE: tests/tcg/sh4/test-fpu-ftrv.c:48:
+        // matrix[3][1] = 0.0

ERROR: do not use C99 // comments
#145: FILE: tests/tcg/sh4/test-fpu-ftrv.c:50:
+        // matrix[3][2] = 0.0

ERROR: do not use C99 // comments
#146: FILE: tests/tcg/sh4/test-fpu-ftrv.c:51:
+        // matrix[3][3] = 2.0

ERROR: do not use C99 // comments
#148: FILE: tests/tcg/sh4/test-fpu-ftrv.c:53:
+        // Disable pair-write

ERROR: line over 90 characters
#155: FILE: tests/tcg/sh4/test-fpu-ftrv.c:60:
+// The SH4 manual specifies `ftrv` is only available when FPSCR 
register precision-mode (PR) bit is 0, aka single-precision

ERROR: do not use C99 // comments
#155: FILE: tests/tcg/sh4/test-fpu-ftrv.c:60:
+// The SH4 manual specifies `ftrv` is only available when FPSCR 
register precision-mode (PR) bit is 0, aka single-precision

ERROR: do not use C99 // comments
#156: FILE: tests/tcg/sh4/test-fpu-ftrv.c:61:
+// Transform vector vin by xmtrx; store result in vector vout

ERROR: open brace '{' following function declarations go on the next line
#157: FILE: tests/tcg/sh4/test-fpu-ftrv.c:62:
+static void ftrv(const float vin[4], float vout[4]) {

ERROR: trailing whitespace
#158: FILE: tests/tcg/sh4/test-fpu-ftrv.c:63:
+    asm volatile("fmov %4,fr0\n" $

ERROR: trailing whitespace
#159: FILE: tests/tcg/sh4/test-fpu-ftrv.c:64:
+                 "fmov %5,fr1\n" $

ERROR: trailing whitespace
#160: FILE: tests/tcg/sh4/test-fpu-ftrv.c:65:
+                 "fmov %6,fr2\n" $

ERROR: trailing whitespace
#161: FILE: tests/tcg/sh4/test-fpu-ftrv.c:66:
+                 "fmov %7,fr3\n" $

ERROR: trailing whitespace
#163: FILE: tests/tcg/sh4/test-fpu-ftrv.c:68:
+                 "fmov fr0,%0\n" $

ERROR: trailing whitespace
#164: FILE: tests/tcg/sh4/test-fpu-ftrv.c:69:
+                 "fmov fr1,%1\n" $

ERROR: trailing whitespace
#165: FILE: tests/tcg/sh4/test-fpu-ftrv.c:70:
+                 "fmov fr2,%2\n" $

ERROR: trailing whitespace
#166: FILE: tests/tcg/sh4/test-fpu-ftrv.c:71:
+                 "fmov fr3,%3" $

WARNING: line over 80 characters
#167: FILE: tests/tcg/sh4/test-fpu-ftrv.c:72:
+                 : "=f" (vout[0]), "=f" (vout[1]), "=f" (vout[2]), "=f" 
(vout[3])

WARNING: added, moved or deleted file(s), does MAINTAINERS need updating?
   tests/tcg/sh4/test-fpu-fipr.c
   tests/tcg/sh4/test-fpu-ftrv.c
total: 57 errors, 2 warnings, 173 lines checked