about summary refs log tree commit diff stats
path: root/apps/mu.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-05 10:16:53 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-05 10:25:25 -0700
commitf13576b5d273ef9175e938b15f55bb1ead22fb1d (patch)
treea54c4667e384a7eec44d0e5e7c2da687b670b7e9 /apps/mu.subx
parentbb3ce6cdea12ff00b998c5a1c6dbf2c83dba77c2 (diff)
downloadmu-f13576b5d273ef9175e938b15f55bb1ead22fb1d.tar.gz
6957
The final fix to the raytracing program involves rounding modes. It turns
out x86 processors round floats by default, unlike C which has trained
me to expect truncation. Rather than mess with the MXCSR register, I added
another instruction for truncation. Now milestone 3 emits perfectly correct
results.
Diffstat (limited to 'apps/mu.subx')
-rw-r--r--apps/mu.subx50
1 files changed, 50 insertions, 0 deletions
diff --git a/apps/mu.subx b/apps/mu.subx
index 18c2d2e1..075e3b7a 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -19833,6 +19833,46 @@ _Primitive-convert-xreg-to-reg:  # (payload primitive)
     1/imm32/xm32-is-first-inout
     0/imm32/no-x32
     0x11/imm32/alloc-id:fake
+    _Primitive-truncate-xmem-to-reg/imm32/next
+_Primitive-truncate-xmem-to-reg:  # (payload primitive)
+    0x11/imm32/alloc-id:fake:payload
+    # var1/reg <- truncate var2 => f3 0f 2c/truncate-to-int var2/xm32 var1/r32
+    0x11/imm32/alloc-id:fake
+    _string-truncate/imm32/name
+    0x11/imm32/alloc-id:fake
+    Single-float-var-in-mem/imm32/inouts
+    0x11/imm32/alloc-id:fake
+    Single-int-var-in-some-register/imm32/outputs
+    0x11/imm32/alloc-id:fake
+    _string_f3_0f_2c_truncate_to_int/imm32/subx-name
+    0/imm32/no-rm32
+    3/imm32/r32-is-first-output
+    0/imm32/no-imm32
+    0/imm32/no-imm8
+    0/imm32/no-disp32
+    1/imm32/xm32-is-first-inout
+    0/imm32/no-x32
+    0x11/imm32/alloc-id:fake
+    _Primitive-truncate-xreg-to-reg/imm32/next
+_Primitive-truncate-xreg-to-reg:  # (payload primitive)
+    0x11/imm32/alloc-id:fake:payload
+    # var1/reg <- truncate var2/xreg => f3 0f 2c/truncate-to-int var2/xm32 var1/r32
+    0x11/imm32/alloc-id:fake
+    _string-truncate/imm32/name
+    0x11/imm32/alloc-id:fake
+    Single-float-var-in-some-register/imm32/inouts
+    0x11/imm32/alloc-id:fake
+    Single-int-var-in-some-register/imm32/outputs
+    0x11/imm32/alloc-id:fake
+    _string_f3_0f_2c_truncate_to_int/imm32/subx-name
+    0/imm32/no-rm32
+    3/imm32/r32-is-first-output
+    0/imm32/no-imm32
+    0/imm32/no-imm8
+    0/imm32/no-disp32
+    1/imm32/xm32-is-first-inout
+    0/imm32/no-x32
+    0x11/imm32/alloc-id:fake
     _Primitive-reinterpret-xmem-as-reg/imm32/next
 # - reinterpret bytes (just for debugging)
 _Primitive-reinterpret-xmem-as-reg:  # (payload primitive)
@@ -21732,6 +21772,11 @@ _string-convert:  # (payload array byte)
     # "convert"
     0x7/imm32/size
     0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t
+_string-truncate:  # (payload array byte)
+    0x11/imm32/alloc-id:fake:payload
+    # "truncate"
+    0x8/imm32/size
+    0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e
 _string-reinterpret:  # (payload array byte)
     0x11/imm32/alloc-id:fake:payload
     # "reinterpret"
@@ -22014,6 +22059,11 @@ _string_f3_0f_2d_convert_to_int:
     # "f3 0f 2d/convert-to-int"
     0x17/imm32/size
     0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x64/d 0x2f/slash 0x63/c 0x6f/o 0x6e/n 0x76/v 0x65/e 0x72/r 0x74/t 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x69/i 0x6e/n 0x74/t
+_string_f3_0f_2c_truncate_to_int:
+    0x11/imm32/alloc-id:fake:payload
+    # "f3 0f 2c/truncate-to-int"
+    0x18/imm32/size
+    0x66/f 0x33/3 0x20/space 0x30/0 0x66/f 0x20/space 0x32/2 0x63/c 0x2f/slash 0x74/t 0x72/r 0x75/u 0x6e/n 0x63/c 0x61/a 0x74/t 0x65/e 0x2d/dash 0x74/t 0x6f/o 0x2d/dash 0x69/i 0x6e/n 0x74/t
 _string_f3_0f_58_add:
     0x11/imm32/alloc-id:fake:payload
     # "f3 0f 58/add"
a id='n276' href='#n276'>276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352