title: SSE register return with SSE disabled
body: <p>I am in the following situation:</p>
  
  <ul>
  <li>I am writing code for a kernel that does not allow SSE instructions</li>
  <li>I need to do floating-point arithmetic</li>
  <li>I'm compiling for a x86_64 platform</li>
  </ul>
  
  <p>Here is a code sample that illustrates the problem:</p>
  
  <pre><code>int
  main(int argc, char** argv)
  {
      double d = 0.0, dbase;
      uint64_t base_value = 300;
  
      d = (2200.0 - 1000.0)/(1000.0);
      dbase = d * base_value;
      printf("d = %f, dbase = %f\n", d, dbase);
      base_value = dbase;
      printf("base_value = %llu\n", (long long unsigned)base_value);
      return 0;
  }
  </code></pre>
  
  <p>And here is the relevant line from the makefile:</p>
  
  <pre><code>CFLAGS +=   -mcmodel=kernel -mno-red-zone -mfpmath=387 -mno-sse -mno-sse2 -mno-mmx -mno-3dnow \
              -msoft-float -fno-asynchronous-unwind-tables -fno-omit-frame-pointer
  </code></pre>
  
  <p>When I run a build I get this error:</p>
  
  <pre><code>SSE register return with SSE disabled
  </code></pre>
  
  <p>(The error points to the line that multiplies d and base_value)</p>
  
  <p>Any idea what I can do to fix this? Removing -mno-sse is not an option, but it seems like the compiler should be able to generate non-sse code to do the multiply.</p>
  
  <p>Thanks
  Nathan</p>