64-Bit Mode Coding Guidelines; Introduction; Coding Rules Affecting 64-Bit Mode; Use Legacy 32-Bit Instructions When The Data Size Is 32 Bits - Intel ARCHITECTURE IA-32 Reference Manual

Architecture optimization
Table of Contents

Advertisement

64-bit Mode Coding
Guidelines

Introduction

This chapter describes coding guidelines for application software
written to run in 64-bit mode. These guidelines should be considered as
an addendum to the coding guidelines described in Chapter 2 through 7.
Software that runs in either compatibility mode or legacy non-64-bit
modes should follow the guidelines described in Chapter 2 through 7.

Coding Rules Affecting 64-bit Mode

Use Legacy 32-Bit Instructions When The Data Size Is 32 Bits

64-bit mode makes 16 general purpose 64-bit registers available to
applications. If application data size is 32 bits, however, there is no need
to use 64-bit registers or 64-bit arithmetic.
The default operand size for most instructions is 32 bits. The behavior
of those instructions is to make the upper 32 bits all zeros. For example,
when zeroing out a register, the following two instruction streams do the
same thing but the 32-bit version saves one instruction byte:
32-bit version
xor eax, eax
64-bit version
xor rax, rax
;Performs xor on lower
;32bits and zeros the upper 32 bits.
;Performs xor on all 64 bits.
8
8-1

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ARCHITECTURE IA-32 and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF