legacy icon indicating copy to clipboard operation
legacy copied to clipboard

Illegal instruction with reals on 64-bit

Open turboencabulator opened this issue 2 years ago • 1 comments

Version

110.99.3 (Latest)

Operating System

  • [ ] Any
  • [X] Linux
  • [ ] macOS
  • [ ] Windows
  • [ ] Other Unix

OS Version

No response

Processor

  • [ ] Any
  • [ ] Arm (using Rosetta)
  • [ ] PowerPC
  • [ ] Sparc
  • [ ] x86 (32-bit)
  • [X] x86-64 (64-bit)
  • [ ] Other

System Component

Core system

Severity

Minor

Description

I have an older 64-bit machine where many operations with reals will cause it to die with an illegal instruction signal.

I've traced the problem to base/runtime/mach-dep/AMD64.prim.asm:

/* floor : real -> int
 * Return the nearest integer that is less or equal to the argument.
 * Caller's responsibility to make sure arg is in range.
 */
ALIGNED_ENTRY(floor_a)
	MOVSD		(REGIND(stdarg), XMM0)
	ROUNDSD		(RND_TO_NEGINF, XMM0, XMM0)
	CVTTSD2SI	(XMM0, stdarg)
	SAL		(IM(1),stdarg)	/* convert result to tagged representation */
	INC		(stdarg)
	CONTINUE

ROUNDSD is an SSE4.1 instruction, and this machine (a Core 2 from ~2006) is old enough that it doesn't have SSE4 support.

Transcript

Standard ML of New Jersey (64-bit) v110.99.3 [built: Mon Oct 31 23:21:28 2022]
- real 0;
val it = 0.0 : real
- real 1;
Illegal instruction

Expected Behavior

No response

Steps to Reproduce

real 1

Additional Information

No response

Email address

[email protected]

turboencabulator avatar Nov 20 '22 17:11 turboencabulator