Module Name:    src
Committed By:   riastradh
Date:           Tue May 14 15:17:57 UTC 2024

Modified Files:
        src/sys/arch/riscv/include: sysreg.h

Log Message:
riscv: No volatile needed on asm to _read_ rounding mode, exceptions.

These instructions can be omitted if the return values are unused.
In contrast, _writes_ to the rounding mode or exceptions must not be
omitted (even if we ignore the return value, which is the old value
of the field).

I think "memory" is the wrong clobber on these asm blocks too; they
can't be reordered around _floating-point_ instructions, while
reordering around loads and stores is fine.  But I don't know how to
spell the right thing in gcclish.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/riscv/include/sysreg.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/riscv/include/sysreg.h
diff -u src/sys/arch/riscv/include/sysreg.h:1.32 src/sys/arch/riscv/include/sysreg.h:1.33
--- src/sys/arch/riscv/include/sysreg.h:1.32	Tue May 14 15:16:51 2024
+++ src/sys/arch/riscv/include/sysreg.h	Tue May 14 15:17:57 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: sysreg.h,v 1.32 2024/05/14 15:16:51 riastradh Exp $ */
+/* $NetBSD: sysreg.h,v 1.33 2024/05/14 15:17:57 riastradh Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@ static inline uint32_t
 fcsr_read(void)
 {
 	uint32_t __fcsr;
-	asm volatile("frcsr %0" : "=r"(__fcsr) :: "memory");
+	asm("frcsr %0" : "=r"(__fcsr) :: "memory");
 	return __fcsr;
 }
 
@@ -73,7 +73,7 @@ static inline uint32_t
 fcsr_fflags_read(void)
 {
 	uint32_t __old;
-	asm volatile("frflags %0" : "=r"(__old) :: "memory");
+	asm("frflags %0" : "=r"(__old) :: "memory");
 	return __old;
 }
 
@@ -89,7 +89,7 @@ static inline uint32_t
 fcsr_frm_read(void)
 {
 	uint32_t __old;
-	asm volatile("frrm\t%0" : "=r"(__old) :: "memory");
+	asm("frrm\t%0" : "=r"(__old) :: "memory");
 	return __old;
 }
 

Reply via email to