From 41115b0943afc6292b7fe0e205f79ec97e95b479 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 14 Mar 2026 11:18:38 +0100 Subject: [PATCH] explicitly mention subnormal flushing --- personal/_posts/2026-03-13-inline-asm.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/personal/_posts/2026-03-13-inline-asm.md b/personal/_posts/2026-03-13-inline-asm.md index 87a5fbf..f577a1d 100644 --- a/personal/_posts/2026-03-13-inline-asm.md +++ b/personal/_posts/2026-03-13-inline-asm.md @@ -263,7 +263,7 @@ The Abstract Machine has no floating-point status bits that the story code could This directly reflects the fact that the compiler makes no guarantees for the value that the program will observe in the status register, and since floating-point operations can be arbitrarily reordered, this should be taken quite literally. For writing the control register, there simply is no possible story: no Rust operation exists that would change the rounding mode of subsequent floating-point operations. -Any inline asm block that changes the rounding mode therefore has undefined behavior. +Any inline asm block that changes the rounding mode therefore has undefined behavior (and the same goes for other flags that change the behavior of instructions used by the Rust compiler, like flushing subnormals to zero). While this may sound bleak, it is entirely possible to write an inline asm block that changes the rounding mode, performs some floating-point operations, and then changes it back! The story code for this block can use a soft-float library to perform exactly the same floating-point operations with a non-default rounding mode. -- 2.39.5