[Patch] The simplest optimisation! (MOVSXD)

Original Reporter info from Mantis: CuriousKit @CuriousKit
  • Reporter name: J. Gareth Moreton

Description:

This patch, for x86_64, includes the 64-bit exclusive MOVSXD instruction, alongside MOVZX and MOVSX, for analysis through the OptPass1Movx routine.

Steps to reproduce:

Apply patch and confirm correct compilation.

Additional information:

The inclusion of the instruction improves some instruction sequences that deal with signed values in memory being sign-extended to the CPU word size (as the language is defined to do) before being stored again after some basic operation - for example:

	movslq	-360(%rbp),%rax
	addq	%rdx,%rax
	movq	%rax,-360(%rbp)

Becomes:

addq	%rdx,-360(%rbp)

And:

	movslq	-36(%rbp),%rax
	orq		$34816,%rax
	movl	%eax,-36(%rbp)

Becomes:

orl	$34816,-36(%rbp)

Mantis conversion info:

  • Mantis ID: 36700
  • OS: Microsoft Windows
  • OS Build: 10 Professional
  • Build: r44103
  • Platform: x86_64
  • Version: 3.3.1
  • Fixed in version: 3.3.1
  • Fixed in revision: 44185 (#892454ff)