From f13576b5d273ef9175e938b15f55bb1ead22fb1d Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 5 Oct 2020 10:16:53 -0700 Subject: 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. --- subx_opcodes | 1 + 1 file changed, 1 insertion(+) (limited to 'subx_opcodes') diff --git a/subx_opcodes b/subx_opcodes index 75a42e3e..fe44527b 100644 --- a/subx_opcodes +++ b/subx_opcodes @@ -115,6 +115,7 @@ Opcodes currently supported by SubX: f3 0f 10: copy xm32 to x32 (movss) f3 0f 11: copy x32 to xm32 (movss) f3 0f 2a: convert integer to floating-point (cvtsi2ss) + f3 0f 2c: truncate floating-point to int (cvttss2si) f3 0f 2d: convert floating-point to int (cvtss2si) f3 0f 51: square root of float (sqrtss) f3 0f 52: inverse square root of float (rsqrtss) -- cgit 1.4.1-2-gfad0