262
Advanced Micro Devices AMD64 Technology AMD64 Architecture Programmer’s Manual Volume 6: 128-Bit and 256-Bit XOP, FMA4 and CVT16 Instructions Publication No. Revision Date 43479 3.03 May 2009

AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

  • Upload
    others

  • View
    25

  • Download
    0

Embed Size (px)

Citation preview

Page 1: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Advanced Micro Devices

AMD64 Technology

AMD64 ArchitectureProgrammer’s Manual

Volume 6:128-Bit and 256-Bit

XOP, FMA4 and CVT16 Instructions

Publication No. Revision Date

43479 3.03 May 2009

Page 2: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

TrademarksAMD, the AMD Arrow logo, and combinations thereof are trademarks of Advanced Micro Devices, Inc.MMX is a trademark of Intel Corporation. Other product names used in this publication are for identification purposes only and may be trademarks of theirrespective companies.

© 2009 Advanced Micro Devices, Inc. All rights reserved.

The contents of this document are provided in connection with Advanced MicroDevices, Inc. (“AMD”) products. AMD makes no representations or warranties withrespect to the accuracy or completeness of the contents of this publication andreserves the right to make changes to specifications and product descriptions atany time without notice. The information contained herein may be of a preliminaryor advance nature and is subject to change without notice. No license, whetherexpress, implied, arising by estoppel or otherwise, to any intellectual property rightsis granted by this publication. Except as set forth in AMD’s Standard Terms andConditions of Sale, AMD assumes no liability whatsoever, and disclaims anyexpress or implied warranty, relating to its products including, but not limited to, theimplied warranty of merchantability, fitness for a particular purpose, or infringementof any intellectual property right.

AMD’s products are not designed, intended, authorized or warranted for use ascomponents in systems intended for surgical implant into the body, or in other appli-cations intended to support or sustain life, or in any other application in which thefailure of AMD’s product could create a situation where personal injury, death, orsevere property or environmental damage may occur. AMD reserves the right todiscontinue or make changes to its products at any time without notice.

Page 3: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

3

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Contents

Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .9

1 New 128-Bit and 256-Bit Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .231.1 New Instruction Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231.2 Opcode Byte . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 261.3 Destination XMM registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271.4 Four-Operand Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271.5 Three-Operand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291.6 Two Operand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 291.7 16-Bit Floating-Point Data Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 301.8 XOP Integer Multiply (Add) and Accumulate Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . 311.9 Packed Integer Horizontal Add and Subtract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341.10 Vector Conditional Moves. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351.11 Packed Integer Rotates and Shifts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 351.12 Packed Integer Comparison and Predicate Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361.13 Fraction Extract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371.14 Convert . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

2 AMD XOP, FMA4 and CVT16 Instructions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .392.1 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392.2 Operand Specification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402.3 Instruction Reference. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

VCVTPH2PS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42VCVTPS2PH. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45VFMADDPD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48VFMADDPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52VFMADDSD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56VFMADDSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59VFMADDSUBPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62VFMADDSUBPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66VFMSUBADDPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70VFMSUBADDPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74VFMSUBPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78VFMSUBPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81VFMSUBSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84VFMSUBSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87VFNMADDPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90VFNMADDPS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93VFNMADDSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96VFNMADDSS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99VFNMSUBPD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102VFNMSUBPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105VFNMSUBSD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108VFNMSUBSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111VFRCZPD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114

Page 4: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

4

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

VFRCZPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117VFRCZSD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120VFRCZSS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124VPCMOV . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128VPCOMB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131VPCOMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134VPCOMQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137VPCOMUB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140VPCOMUD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143VPCOMUQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146VPCOMUW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149VPCOMW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152VPHADDBD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155VPHADDBQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157VPHADDBW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159VPHADDDQ. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161VPHADDUBD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163VPHADDUBQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165VPHADDUBW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167VPHADDUDQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169VPHADDUWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171VPHADDUWQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173VPHADDWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175VPHADDWQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177VPHSUBBW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179VPHSUBDQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181VPHSUBWD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183VPMACSDD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185VPMACSDQH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188VPMACSDQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191VPMACSSDD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194VPMACSSDQH . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197VPMACSSDQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200VPMACSSWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203VPMACSSWW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206VPMACSWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209VPMACSWW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212VPMADCSSWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215VPMADCSWD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218VPPERM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221VPROTB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225VPROTD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228VPROTQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231VPROTW. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234VPSHAB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237VPSHAD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240VPSHAQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243

Page 5: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

5

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

VPSHAW. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246VPSHLB . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249VPSHLD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252VPSHLQ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255VPSHLW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

Page 6: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

6

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

Page 7: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

7

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Tables

Table 1-1. Operand Element Size—OES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26Table 1-2. Operand Configurations for PCMOV and PPERM Instructions . . . . . . . .27Table 1-3. Four Operand Instruction Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . .28Table 1-4. Operand Configurations for Three Operand Instructions . . . . . . . . . . . . . .29Table 1-5. Three Operand Instruction Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . .29Table 1-6. Two Operand Instruction Opcode Map . . . . . . . . . . . . . . . . . . . . . . . . . . .29Table 1-7. Supported 16-Bit Floating-Point Encodings . . . . . . . . . . . . . . . . . . . . . . . .31Table 1-8. Immediate Operand Values for Unsigned Vector Comparison Operations36Table 2-1. Denormal and Rounding Control with Immediate Byte Operand . . . . . . .42Table 2-2. Denormal and Rounding Control with Immediate Byte Operand . . . . . . .45Table 1. VPCOMB Comparison Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .130Table 2. VPCOMD Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .133Table 3. VPCOMQ Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .136Table 4. VPCOMUB Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . .139Table 5. VPCOMUD Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . .142Table 6. VPCOMUQ Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . .145Table 7. VPCOMUW Comparison Operations. . . . . . . . . . . . . . . . . . . . . . . . . . . .148Table 8. VPCOMW Comparison Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . .151Table 2-3. VPPERM Control Byte. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .221

Page 8: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

8

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

Page 9: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

9

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Preface

About This Book

The instructions described in this book are part of a multivolume work entitled the AMD64Architecture Programmer’s Manual. The following table lists each volume and its order number.

Audience

This document is intended for all programmers writing application or system software for a processorthat implements the AMD64 architecture.

Organization

Volumes 3 through 6 describe the AMD64 architecture’s instruction set in detail. Together, they covereach instruction’s mnemonic syntax, opcodes, functions, affected flags, and possible exceptions.

The AMD64 instruction set is divided into seven subsets:

• General-purpose instructions

• System instructions

• 128-bit media instructions

• 64-bit media instructions

• x87 floating-point instructions

• 128-bit and 256-bit XOP media instructions

Several instructions belong to—and are described identically in—multiple instruction subsets.

Title Order No.

Volume 1: Application Programming 24592

Volume 2: System Programming 24593

Volume 3: General-Purpose and System Instructions 24594

Volume 4: 128-Bit Media Instructions 26568

Volume 5: 64-Bit Media and x87 Floating-Point Instructions 26569

Volume 6: 128-Bit and 256-Bit XOP, FMA4 and CVT16 Instructions

43479

Page 10: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

10

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

This volume describes the 128-bit and 256-bit XOP, FMA4 and CVT16 instruction extensions. Theindex at the end cross-references topics within this volume. For other topics relating to the AMD64architecture, and for information on instructions in other subsets, see the tables of contents and indexesof the other volumes.

Definitions

Many of the following definitions assume an in-depth knowledge of the legacy x86 architecture. See “Related Documents” on page 20 for descriptions of the legacy x86 architecture.

Terms and Notation

In addition to the notation described below, “Opcode-Syntax Notation” in Volume 3 describes notation relating specifically to opcodes.

1011bA binary value—in this example, a 4-bit value.

F0EAhA hexadecimal value—in this example a 2-byte value.

[1,2)A range that includes the left-most value (in this case, 1) but excludes the right-most value (in this case, 2).

7–4A bit range, from bit 7 to 4, inclusive. The high-order bit is shown first.

128-bit media instructionsInstructions that use the 128-bit XMM registers. These are a combination of the SSE and SSE2 instruction sets.

64-bit media instructionsInstructions that use the 64-bit MMX registers. These are primarily a combination of MMX™ and 3DNow!™ instruction sets, with some additional instructions from the SSE and SSE2 instruction sets.

16-bit modeLegacy mode or compatibility mode in which a 16-bit address size is active. See legacy mode and compatibility mode.

32-bit modeLegacy mode or compatibility mode in which a 32-bit address size is active. See legacy mode and compatibility mode.

Page 11: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

11

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

64-bit modeA submode of long mode. In 64-bit mode, the default address size is 64 bits and new features, such as register extensions, are supported for system and application software.

#GP(0)Notation indicating a general-protection exception (#GP) with error code of 0.

absoluteSaid of a displacement that references the base of a code segment rather than an instruction pointer. Contrast with relative.

ASIDAddress space identifier.

biased exponentThe sum of a floating-point value’s exponent and a constant bias for a particular floating-point data type. The bias makes the range of the biased exponent always positive, which allows reciprocation without overflow.

byteEight bits.

clearTo write a bit value of 0. Compare set.

compatibility modeA submode of long mode. In compatibility mode, the default address size is 32 bits, and legacy 16-bit and 32-bit applications run without modification.

commitTo irreversibly write, in program order, an instruction’s result to software-visible storage, such as a register (including flags), the data cache, an internal write buffer, or memory.

CPLCurrent privilege level.

CR0–CR4A register range, from register CR0 through CR4, inclusive, with the low-order register first.

CR0.PE = 1Notation indicating that the PE bit of the CR0 register has a value of 1.

directReferencing a memory location whose address is included in the instruction’s syntax as an immediate operand. The address may be an absolute or relative address. Compare indirect.

Page 12: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

12

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

dirty dataData held in the processor’s caches or internal buffers that is more recent than the copy held in main memory.

displacementA signed value that is added to the base of a segment (absolute addressing) or an instruction pointer (relative addressing). Same as offset.

doublewordTwo words, or four bytes, or 32 bits.

double quadwordEight words, or 16 bytes, or 128 bits. Also called octword.

DS:rSIThe contents of a memory location whose segment address is in the DS register and whose offset relative to that segment is in the rSI register.

EFER.LME = 0Notation indicating that the LME bit of the EFER register has a value of 0.

effective address sizeThe address size for the current instruction after accounting for the default address size and any address-size override prefix.

effective operand sizeThe operand size for the current instruction after accounting for the default operand size and any operand-size override prefix.

elementSee vector.

exceptionAn abnormal condition that occurs as the result of executing an instruction. The processor’s response to an exception depends on the type of the exception. For all exceptions except 128-bit media SIMD floating-point exceptions and x87 floating-point exceptions, control is transferred to the handler (or service routine) for that exception, as defined by the exception’s vector. For floating-point exceptions defined by the IEEE 754 standard, there are both masked and unmasked responses. When unmasked, the exception handler is called, and when masked, a default response is provided instead of calling the handler.

FF /0Notation indicating that FF is the first byte of an opcode, and a subfield in the second byte has a value of 0.

Page 13: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

13

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

flushAn often ambiguous term meaning (1) writeback, if modified, and invalidate, as in “flush the cache line,” or (2) invalidate, as in “flush the pipeline,” or (3) change a value, as in “flush to zero.”

GDTGlobal descriptor table.

GIFGlobal interrupt flag.

IDTInterrupt descriptor table.

IGNIgnore. Field is ignored.

indirectReferencing a memory location whose address is in a register or other memory location. The address may be an absolute or relative address. Compare direct.

IRBThe virtual-8086 mode interrupt-redirection bitmap.

ISTThe long-mode interrupt-stack table.

IVTThe real-address mode interrupt-vector table.

LDTLocal descriptor table.

legacy x86The legacy x86 architecture. See “Related Documents” on page 20 for descriptions of the legacy x86 architecture.

legacy modeAn operating mode of the AMD64 architecture in which existing 16-bit and 32-bit applications and operating systems run without modification. A processor implementation of the AMD64 architecture can run in either long mode or legacy mode. Legacy mode has three submodes, real mode, protected mode, and virtual-8086 mode.

long modeAn operating mode unique to the AMD64 architecture. A processor implementation of the AMD64 architecture can run in either long mode or legacy mode. Long mode has two submodes, 64-bit mode and compatibility mode.

Page 14: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

14

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

lsbLeast-significant bit.

LSBLeast-significant byte.

main memoryPhysical memory, such as RAM and ROM (but not cache memory) that is installed in a particular computer system.

mask(1) A control bit that prevents the occurrence of a floating-point exception from invoking an exception-handling routine. (2) A field of bits used for a control purpose.

MBZMust be zero. If software attempts to set an MBZ bit to 1, a general-protection exception (#GP) occurs.

memoryUnless otherwise specified, main memory.

ModRMA byte following an instruction opcode that specifies address calculation based on mode (Mod), register (R), and memory (M) variables.

moffsetA 16, 32, or 64-bit offset that specifies a memory operand directly, without using a ModRM or SIB byte.

msbMost-significant bit.

MSBMost-significant byte.

multimedia instructionsA combination of 128-bit media instructions and 64-bit media instructions.

octwordSame as double quadword.

offsetSame as displacement.

Page 15: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

15

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

overflowThe condition in which a floating-point number is larger in magnitude than the largest, finite, positive or negative number that can be represented in the data-type format being used.

packedSee vector.

PAEPhysical-address extensions.

physical memoryActual memory, consisting of main memory and cache.

probeA check for an address in a processor’s caches or internal buffers. External probes originate outside the processor, and internal probes originate within the processor.

protected modeA submode of legacy mode.

quadwordFour words, or eight bytes, or 64 bits.

reservedFields marked as reserved may be used at some future time.

To preserve compatibility with future processors, reserved fields require special handling when read or written by software.

Reserved fields may be further qualified as MBZ, RAZ, SBZ or IGN (see definitions).

Software must not depend on the state of a reserved field, nor upon the ability of such fields to return to a previously written state.

If a reserved field is not marked with one of the above qualifiers, software must not change the state of that field; it must reload that field with the same values returned from a prior read.

RAZRead as zero (0), regardless of what is written.

real-address modeA submode of legacy mode with 16-bit addressing and operand size and a simple form of segmentation, lacking the segment and privilege protection mechanisms of protected mode. See real mode.

real modeA short name for real-address mode, a submode of legacy mode.

Page 16: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

16

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

relativeReferencing with a displacement (also called offset) from an instruction pointer rather than the base of a code segment. Contrast with absolute.

REXAn instruction prefix that specifies a 64-bit operand size and provides access to additional registers.

RIP-relative addressingAddressing relative to the 64-bit RIP instruction pointer.

setTo write a bit value of 1. Compare clear.

SIBA byte following an instruction opcode that specifies address calculation based on scale (S), index (I), and base (B).

SIMDSingle instruction, multiple data. See vector.

SSEn and SSSEn

Various extensions to the SSE instruction set. See 128-bit media instructions and 64-bit media instructions.

sticky bitA bit that is set or cleared by hardware and that remains in that state until explicitly changed by software.

TOPThe x87 top-of-stack pointer.

TSSTask-state segment.

underflowThe condition in which a floating-point number is smaller in magnitude than the smallest nonzero, positive or negative number that can be represented in the data-type format being used.

vector(1) A set of integer or floating-point values, called elements, that are packed into a single operand. Most of the 128-bit and 64-bit media instructions use vectors as operands. Vectors are also called packed or SIMD (single-instruction multiple-data) operands.

(2) An index into an interrupt descriptor table (IDT), used to access exception handlers. Compare exception.

Page 17: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

17

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

virtual-8086 modeA submode of legacy mode.

VMCBVirtual machine control block.

VMMVirtual machine monitor.

wordTwo bytes, or 16 bits.

x86See legacy x86.

Registers

In the following list of registers, the names are used to refer either to a given register or to the contents of that register:

AH–DHThe high 8-bit AH, BH, CH, and DH registers. Compare AL–DL.

AL–DLThe low 8-bit AL, BL, CL, and DL registers. Compare AH–DH.

AL–r15BThe low 8-bit AL, BL, CL, DL, SIL, DIL, BPL, SPL, and R8B–R15B registers, available in 64-bit mode.

BPBase pointer register.

CRnControl register number n.

CSCode segment register.

eAX–eSPThe 16-bit AX, BX, CX, DX, DI, SI, BP, and SP registers or the 32-bit EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP registers. Compare rAX–rSP.

EBPExtended base pointer register.

Page 18: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

18

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

EFERExtended features enable register.

eFLAGS16-bit or 32-bit flags register. Compare rFLAGS.

EFLAGS32-bit (extended) flags register.

eIP16-bit or 32-bit instruction-pointer register. Compare rIP.

EIP32-bit (extended) instruction-pointer register.

FLAGS16-bit flags register.

GDTRGlobal descriptor table register.

GPRsGeneral-purpose registers. For the 16-bit data size, these are AX, BX, CX, DX, DI, SI, BP, and SP. For the 32-bit data size, these are EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP. For the 64-bit data size, these include RAX, RBX, RCX, RDX, RDI, RSI, RBP, RSP, and R8–R15.

IDTRInterrupt descriptor table register.

IP16-bit instruction-pointer register.

LDTRLocal descriptor table register.

MSRModel-specific register.

r8–r15The 8-bit R8B–R15B registers, or the 16-bit R8W–R15W registers, or the 32-bit R8D–R15D registers, or the 64-bit R8–R15 registers.

rAX–rSPThe 16-bit AX, BX, CX, DX, DI, SI, BP, and SP registers, or the 32-bit EAX, EBX, ECX, EDX, EDI, ESI, EBP, and ESP registers, or the 64-bit RAX, RBX, RCX, RDX, RDI, RSI, RBP, and RSP

Page 19: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

19

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

registers. Replace the placeholder r with nothing for 16-bit size, “E” for 32-bit size, or “R” for 64-bit size.

RAX64-bit version of the EAX register.

RBP64-bit version of the EBP register.

RBX64-bit version of the EBX register.

RCX64-bit version of the ECX register.

RDI64-bit version of the EDI register.

RDX64-bit version of the EDX register.

rFLAGS16-bit, 32-bit, or 64-bit flags register. Compare RFLAGS.

RFLAGS64-bit flags register. Compare rFLAGS.

rIP16-bit, 32-bit, or 64-bit instruction-pointer register. Compare RIP.

RIP64-bit instruction-pointer register.

RSI64-bit version of the ESI register.

RSP64-bit version of the ESP register.

SPStack pointer register.

SSStack segment register.

Page 20: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

20

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

TPRTask priority register (CR8), a new register introduced in the AMD64 architecture to speed interrupt management.

TRTask register.

XMM0–XMM15The 128-bit XMM registers; each is the lower half of a corresponding 256-bit YMM register.

YMM0–YMM15The 256-bit YMM registers; the lower half of each of these is the corresponding 128-bit XMMregister.

Endian Order

The x86 and AMD64 architectures address memory using little-endian byte-ordering. Multibyte values are stored with their least-significant byte at the lowest byte address, and they are illustrated with their least significant byte at the right side. Strings are illustrated in reverse order, because the addresses of their bytes increase from right to left.

Related Documents• Peter Abel, IBM PC Assembly Language and Programming, Prentice-Hall, Englewood Cliffs, NJ,

1995.

• Rakesh Agarwal, 80x86 Architecture & Programming: Volume II, Prentice-Hall, Englewood Cliffs, NJ, 1991.

• AMD, AMD-K6™ MMX™ Enhanced Processor Multimedia Technology, Sunnyvale, CA, 2000.

• AMD, 3DNow!™ Technology Manual, Sunnyvale, CA, 2000.

• AMD, AMD Extensions to the 3DNow!™ and MMX™ Instruction Sets, Sunnyvale, CA, 2000.

• Don Anderson and Tom Shanley, Pentium Processor System Architecture, Addison-Wesley, New York, 1995.

• Nabajyoti Barkakati and Randall Hyde, Microsoft Macro Assembler Bible, Sams, Carmel, Indiana, 1992.

• Barry B. Brey, 8086/8088, 80286, 80386, and 80486 Assembly Language Programming, Macmillan Publishing Co., New York, 1994.

• Barry B. Brey, Programming the 80286, 80386, 80486, and Pentium Based Personal Computer, Prentice-Hall, Englewood Cliffs, NJ, 1995.

• Ralf Brown and Jim Kyle, PC Interrupts, Addison-Wesley, New York, 1994.

• Penn Brumm and Don Brumm, 80386/80486 Assembly Language Programming, Windcrest McGraw-Hill, 1993.

• Geoff Chappell, DOS Internals, Addison-Wesley, New York, 1994.

Page 21: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

21

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

• Chips and Technologies, Inc. Super386 DX Programmer’s Reference Manual, Chips and Technologies, Inc., San Jose, 1992.

• John Crawford and Patrick Gelsinger, Programming the 80386, Sybex, San Francisco, 1987.

• Cyrix Corporation, 5x86 Processor BIOS Writer's Guide, Cyrix Corporation, Richardson, TX, 1995.

• Cyrix Corporation, M1 Processor Data Book, Cyrix Corporation, Richardson, TX, 1996.

• Cyrix Corporation, MX Processor MMX Extension Opcode Table, Cyrix Corporation, Richardson, TX, 1996.

• Cyrix Corporation, MX Processor Data Book, Cyrix Corporation, Richardson, TX, 1997.

• Ray Duncan, Extending DOS: A Programmer's Guide to Protected-Mode DOS, Addison Wesley, NY, 1991.

• William B. Giles, Assembly Language Programming for the Intel 80xxx Family, Macmillan, New York, 1991.

• Frank van Gilluwe, The Undocumented PC, Addison-Wesley, New York, 1994.

• John L. Hennessy and David A. Patterson, Computer Architecture, Morgan Kaufmann Publishers, San Mateo, CA, 1996.

• Thom Hogan, The Programmer’s PC Sourcebook, Microsoft Press, Redmond, WA, 1991.

• Hal Katircioglu, Inside the 486, Pentium, and Pentium Pro, Peer-to-Peer Communications, Menlo Park, CA, 1997.

• IBM Corporation, 486SLC Microprocessor Data Sheet, IBM Corporation, Essex Junction, VT, 1993.

• IBM Corporation, 486SLC2 Microprocessor Data Sheet, IBM Corporation, Essex Junction, VT, 1993.

• IBM Corporation, 80486DX2 Processor Floating Point Instructions, IBM Corporation, Essex Junction, VT, 1995.

• IBM Corporation, 80486DX2 Processor BIOS Writer's Guide, IBM Corporation, Essex Junction, VT, 1995.

• IBM Corporation, Blue Lightning 486DX2 Data Book, IBM Corporation, Essex Junction, VT, 1994.

• Institute of Electrical and Electronics Engineers, IEEE Standard for Binary Floating-Point Arithmetic, ANSI/IEEE Std 754-1985.

• Institute of Electrical and Electronics Engineers, IEEE Standard for Radix-Independent Floating-Point Arithmetic, ANSI/IEEE Std 854-1987.

• Muhammad Ali Mazidi and Janice Gillispie Mazidi, 80X86 IBM PC and Compatible Computers, Prentice-Hall, Englewood Cliffs, NJ, 1997.

• Hans-Peter Messmer, The Indispensable Pentium Book, Addison-Wesley, New York, 1995.

• Karen Miller, An Assembly Language Introduction to Computer Architecture: Using the Intel Pentium, Oxford University Press, New York, 1999.

Page 22: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

22

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

• Stephen Morse, Eric Isaacson, and Douglas Albert, The 80386/387 Architecture, John Wiley & Sons, New York, 1987.

• NexGen Inc., Nx586 Processor Data Book, NexGen Inc., Milpitas, CA, 1993.

• NexGen Inc., Nx686 Processor Data Book, NexGen Inc., Milpitas, CA, 1994.

• Bipin Patwardhan, Introduction to the Streaming SIMD Extensions in the Pentium III, www.x86.org/articles/sse_pt1/ simd1.htm, June, 2000.

• Peter Norton, Peter Aitken, and Richard Wilton, PC Programmer’s Bible, Microsoft Press, Redmond, WA, 1993.

• PharLap 386|ASM Reference Manual, Pharlap, Cambridge MA, 1993.

• PharLap TNT DOS-Extender Reference Manual, Pharlap, Cambridge MA, 1995.

• Sen-Cuo Ro and Sheau-Chuen Her, i386/i486 Advanced Programming, Van Nostrand Reinhold, New York, 1993.

• Jeffrey P. Royer, Introduction to Protected Mode Programming, course materials for an onsite class, 1992.

• Tom Shanley, Protected Mode System Architecture, Addison Wesley, NY, 1996.

• SGS-Thomson Corporation, 80486DX Processor SMM Programming Manual, SGS-Thomson Corporation, 1995.

• Walter A. Triebel, The 80386DX Microprocessor, Prentice-Hall, Englewood Cliffs, NJ, 1992.

• John Wharton, The Complete x86, MicroDesign Resources, Sebastopol, California, 1994.

• Web sites and newsgroups:

- www.amd.com

- news.comp.arch

- news.comp.lang.asm.x86

- news.intel.microprocessors

- news.microsoft

Page 23: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 23

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

1 New 128-Bit and 256-Bit Instructions

This release of the AMD64 architecture introduces the XOP, CVT16, and FMA4 instruction setextensions. These 128-bit and 256-bit instructions complement the AMD64 128-bit media instructionsdeescribed in detail in the AMD64 Architecture Programmer’s Manual Volume 4: 128-Bit MediaInstructions, order# 26568. This document describes new instructions that are designed to:

• Improve performance by increasing the work per instruction and

• reduce the need to copy and move around register operands.

These instruction set extensions include:

• Floating-point multiply accumulate instructions

• Floating-point fraction extract and half-precision conversion instructions

• Integer horizontal add instructions

• Integer multiply accumulate instructions

• Byte permutation and bit granularity conditional move instructions

• Packed integer compare and individual-partition shift/rotate instructions

These instructions all use the new XOP instruction format, which takes advantage of the three- andfour-operand non-destructive capability, 256-bit operand size, and instruction length efficiencyprovided by this encoding. These instructions operate on either the lower 128- or full 256-bits of thenew YMM registers. Context handling of the YMM register set is supported by the newXSAVE/XRSTOR instructions in conjunction with the XSETBV and XGETBV instructions. Supportfor YMM context handling must be provided by the operating system and must be indicated by settingCR4.OSXSAVE to 1.

Support for the new instructions is indicated by use of the CPUID instruction:

• XOP—ECX bit 11 as returned by CPUID function 8000_0001h.

• FMA4—ECX bit 16 as returned by CPUID function 8000_0001h.

• CVT16—ECX bit 18 as returned by CPUID function 8000_0001h

Attempting to execute these instructions causes a #UD exception either if they are not present in thehardware or if operating system support for YMM context switching is not indicated by settingCR4.OSXSAVE to 1.

1.1 New Instruction Format

The XOP and CVT16 instructions utilize a new three-byte XOP prefix preceding the opcode byte.This prefix replaces the use of the 0F, 66, F2 and F3 prefix bytes and the REX prefix and encodesadditional information as well. The FMA4 instructions utilize the new AVX VEX prefix whichprovides similar encoding capabilities.

Page 24: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

24 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

Figure 1-1 shows the byte order of the instruction format.

Figure 1-1. Instruction Byte-Order

1.1.1 Legacy Prefix

The optional legacy prefixes include operand-size override, address-size override, segment override,Lock and REP prefixes. For additional information, see section 1.2, “Instruction Prefixes” in theAMD64 Architecture Programmer’s Manual Volume 3: General Purpose and System Instructions,order#24594.

1.1.2 Three-byte Prefix Format

The format of the three-byte form of the XOP, FMA4 and CVT16 instruction prefixes is shown inFigure 1-2. A description of the fields is provided in Table 1-2 below.

XOP Prefix( 3 byte) Opcode ModRM SIB

xxyyzz

Displacement1, 2, or 4 Bytes

Immediate1 Byte Legacy

[Prefix]

Page 25: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 25

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Figure 1-2. Three-byte XOP Format

Prefix Byte 0

Byte 0 of the XOP prefix is set to 8Fh. This signifies an XOP prefix only in conjunction with themmmmm field of the following byte being greater than or equal to 8; if the mmmmm field is less than8 then these two bytes are a form of the POP instruction rather than an XOP prefix.

Prefix Byte 1

Byte 1 of the XOP prefix has four fields.

R Bit (Prefix Byte 1, Bit 7). This bit provides a one bit extension of the ModRM.reg field in 64-bitmode, permitting access to all 16 YMM/XMM and GPR registers. In 32-bit protected andcompatibility modes, this bit must be set to 1. This bit is the bit-inverted equivalent of the REX.R bit.

X Bit (Prefix Byte 1, Bit 6). This bit provides a one bit extension of the SIB.index field in 64-bitmode, permitting access to 16 YMM/XMM and GPR registers. In 32-bit protected and compatibilitymodes, this bit must be set to 1. This bit is the bit-inverted equivalent of the REX.X bit.

B Bit (Prefix Byte 1, Bit 5). This bit provides a one-bit extension of either the ModRM.r/m field tospecify a GPR or XMM register or to the SIB base field to specify a GPR. This permits access to 16

Byte 0 Byte 1 Byte 27 0 7 5 4 0 7 6 3 2 1 0

8F R X B mmmmm W vvvv L pp

Bit Mnemonic Description

Byt

e 0

7–0 8Fh XOP Prefix Byte for 3-byte XOP Prefix

Byt

e 1

7 R Inverted one bit extension to ModRM.reg field

6 X Inverted one bit extension of the SIB index field

5 BInverted one bit extension of the ModRM r/m field or the SIB base field

4–0 mmmmmXOP opcode map select: 08h—instructions with immediate byte;09h—instructions with no immediate;

Byt

e 2

7 W

Default operand size override for a general pur-pose register to 64-bit size in 64-bit mode; oper-and configuration specifier for certain XMM/YMM-based operations.

6–3 vvvv Source or destination register specifier

2 L Vector length for XMM/YMM-based operations.

1–0 ppSpecifies whether there's an implied 66, F2, or F3 opcode extension

Page 26: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

26 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

registers. In 32-bit protected and compatibility modes, this bit is ignored. This bit is the bit-invertedequivalent of the REX.B bit and is available only in the 3-byte prefix format.

Prefix Byte 2

Byte 2 of the three-byte prefix has four fields.

W Bit (Prefix Byte 2, Bit 7). The meaning of the W bit is opcode specific. This bit toggles sourceoperand order or is ignored, depending upon the opcode.

vvvv (Prefix Byte 2, Bits 6–3). Encodes a source XMM or YMM register in inverted 1s complementform.

L (Prefix Byte 2, Bit 2). If L is 0, encodes a vector length of 128-bits or indicates scalar operands; if Lis 1, the vector length is 256-bits. The register operands for a given instruction are either all 128-bitXMM registers or all 256-bit YMM registers.

pp (Prefix Byte 2, Bits 1–0). The pp field in the XOP prefix is reserved for future use.

1.2 Opcode Byte

The format of the opcode byte is shown in Figure 1-3. For most instructions, the operand element size(OES) is specified by the two least-significant opcode bits, as shown in Table 1-1.

Figure 1-3. Opcode Byte Format

1.3 Destination XMM registers

The destination of XOP, FMA4 and CVT16 instructions may be a 128-bit XMM register or a 256-bitYMM register. When a 128-bit result is written to a destination XMM register, the upper 128-bit of thecorresponding YMM register are cleared.

7 2 1 0Opcode OES

Table 1-1. Operand Element Size—OES

Opcode.OES Integer OperationFloating-Point

Operation

00 Byte PS

01 Word PD

10 Doubleword SS

11 Quadword SD

Page 27: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 27

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

1.4 Four-Operand Instructions

Some new instructions require three input operands and one destination register. This is accomplishedby using the Prefix.vvvv field and Imm8[7:4] along with the MODRM.reg and MODRM.r/m fields.

VPCMOV is an example of a four operand instruction:

VPCMOV dest, src1, src2, src3; dest = (src1 & src3) | (src2 & ~src3)

The first operand is the destination operand and is an XMM or YMM register addressed by theModRM.reg field.

The second, third and fourth operands are sources. The first source operand is an XMM registerspecified by the vvvv field. The second and third source operands are specified by the MODRM.r/mand Imm8[7:4] fields, respectively, when VEX.W is set to 0. The FMA4, VPCMOV and VPPERMinstructions provide the option of swapping the second and third source operands by setting W to 1, asshown in Table 1-2. This allows either the second data operand or the control operand to be memorybased.

The XOP four operand instructions have opcodes in the XOP 08h opcode page and FMA4 instructionshave opcodes in the VEX C4h opcode page, as shown Table 1-3 and Table 1-4, respectively.

Table 1-2. Operand Configurations for FMA4, PCMOV and PPERM Instructions

XOP.W dest src1 src2 src3

0 ModRM.reg VEX/XOP.vvvv modrm.r/m imm8[7:4]

1 ModRM.reg VEX/XOP.vvvv imm8[7:4] ModRM.r/m

Table 1-3. Four Operand XOP Instruction Opcode Map

Operation Opcode XOP.mmmmmOpcode[1:0]

OES Operand Size

VPCMOV A2h 01000b 10b 128/256

VPPERM A3h 01000b 11b 128

VPMACSSWW 85h 01000b 01b 128

VPMACSWW 95h 01000b 01b 128

VPMACSSWD 86h 01000b 10b 128

VPMACSWD 96h 01000b 10b 128

VPMACSSDD 8Eh 01000b 10b 128

VPMACSDD 9Eh 01000b 10b 128

VPMACSSDQL 87h 01000b 11b 128

VPMACSDQL 97h 01000b 11b 128

VPMACSSDQH 8Fh 01000b 11b 128

Page 28: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

28 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

1.5 Three-Operand Instructions

Some instructions have two source operands and a destination operand.

VPROTB is an example of a three operand instruction:

VPROTB dest, src, count dest = src <</>> count

VPMACSDQH 9Fh 01000b 11b 128

VPMADCSSWD A6h 01000b 10b 128

VPMADCSWD B6h 01000b 10b 128

Table 1-4. Four Operand FMA4 Instruction Opcode Map

Operation Opcode VEX.mmmmmOpcode[1:0]

OES Operand Size

VFMADDPD 69h 00011b 01b 128/256

VFMADDPS 68h 00011b 00b 128/256

VFMADDSD 6Bh 00011b 11b 128

VFMADDSS 6Ah 00011b 10b 128

VFMADDSUBPD 5Dh 00011b 01b 128/256

VFMADDSUBPS 5Ch 00011b 00b 128/256

VFMSUBADDPD 5Fh 00011b 01b 128/256

VFMSUBADDPS 5Eh 00011b 00b 128/256

VFMSUBPD 6Dh 00011b 01b 128/256

VFMSUBPS 6Ch 00011b 00b 128/256

VFMSUBSD 6Fh 00011b 11b 128

VFMSUBSS 6Eh 00011b 10b 128

VFNMADDPD 79h 00011b 01b 128/256

FNMADDPS 78h 00011b 00b 128/256

VFNMADDSD 7Bh 00011b 11b 128

VFNMADDSS 7Ah 00011b 10b 128

VFNMSUBPD 7Dh 00011b 01b 128/256

VFNMSUBPS 7Ch 00011b 00b 128/256

VFNMSUBSD 7Fh 00011b 11b 128

VFNMSUBSS 7Eh 00011b 10b 128

Table 1-3. Four Operand XOP Instruction Opcode Map (continued)

Operation Opcode XOP.mmmmmOpcode[1:0]

OES Operand Size

Page 29: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 29

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

The first operand is the destination operand, and is an XMM or YMM register addressed by theModRM.reg field. The second and third operands are source operands. One source operand is anXMM or YMM register addressed by the XOP.vvvv field, the other source operand is an XMM orYMM register or memory operand addressed by the ModRM.r/m field.

For certain instructions, in the three-operand format the XOP.W bit determines which source operandis specified by which operand field, as shown in Table 1-5.

Table 1-5. Operand Configurations for Three Operand Instructions

The three operand instructions have opcodes in the mmmmm 08h or 09h page. See Table 1-6.

Table 1-6. Three Operand Instruction Opcode Map

1.6 Two Operand Instructions

Two-operand instructions use the normal ModRM-based operand assignment. For most instructions,the first operand is the destination, addressed by the ModRM.reg field and the second operand is eitheranXMM or YMM register or a memory operand, as determined by the ModRM.mod field. For theVCVTPS2PH instruction, the destination operand (which may be memory-based) is specified by theMODRM.r/m field and the source register is specified by the MODRM.reg field. For all of theseinstructions, the XOP.vvvv field is not applicable and must be set to 1111b.

VCVTPH2PS is an example of a two operand instruction.

VCVTPH2PS xmm1, xmm2/mem64

All new two-operand instructions are assigned to the XOP.mmmmm 09h page except for VPROTx,VCVTPS2PH and VCVTPH2PS, which are assigned to the XOP.mmmmm 08h page. See Table 1-7,below.

VEX.W dest src count

0 ModRM.reg ModRM.r/m VEX.vvvv

1 ModRM.reg VEX.vvvv ModRM.r/m

Operation Opcode XOP.mmmmmOpcode[1:0]

OESOperand Size

VPCOMa

a. Indicates four instruction variants (B, _D, _W and _Q) specified by the operand element size field.

CC-CFh 00001b OES 128

VPCOMUa EC-EFh 00001b OES 128

VPROTa 90-93h 01001b OES 128

VPSHLa 94-97h 01001b OES 128

VPSHAa 98-9Bh 01001b OES 128

Page 30: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

30 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

1.7 16-Bit Floating-Point Data Type

CVT16 instruction extensions introduce a new 16-bit floating-point data type and two instructions(VCVTPS2PH and VCVTPH2PS) to convert 16-bit floating-point values to and from single-precisionformat.

The 16-bit floating-point data type, shown in Figure 1-4 on page 31, includes a 1-bit sign, a 5-bitexponent with a bias of 15 and a 10-bit significand. The integer bit is implied, making a total of 11 bitsin the significand. The value of the integer bit can be inferred from the number encoding. Table 1-8 onpage 31 shows the floating-point encodings of supported numbers and non-numbers.

Table 1-7. Two Operand Instruction Opcode Map

Operation Opcode XOP.mmmmmOpcode[1:0]

OESOperand Size

VFRCZb 80-83h 01001b OES 128/256

VCVTPH2PS A0h 01000b 00b 128/256VCVTPS2PH A1h 01000b 01b 128/256VPHADDBW C1h 01001b 01b 128

VPHADDBD C2h 01001b 10b 128

VPHADDBQ C3h 01001b 11b 128

VPHADDWD C6h 01001b 10b 128

VPHADDWQ C7h 01001b 11b 128

VPHADDDQ CBh 01001b 11b 128b

VPHADDUBW D1h 01001b 01b 128

VPHADDUBD D2h 01001b 10b 128

VPHADDUBQ D3h 01001b 11b 128

VPHADDUWD D6h 01001b 10b 128

VPHADDUWQ D7h 01001b 11b 128

VPHADDUDQ DBh 01001b 11b 128

VPHSUBBW E1h 01001b 01b 128

VPHSUBWD E2h 01001b 10b 128

VPHSUBDQ E3h 01001b 11b 128

VPROTa

a. Indicates four instruction variants (_B, _W, _D and _Q) specified by the OPS field.b. Indicates four instruction variants (_PS, _PD, _SS and _SD) specified by the OPS field.

C0-C3h 01000b OES 128

Page 31: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 31

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Figure 1-4. 16-Bit Floating-Point Data Type

Table 1-8. Supported 16-Bit Floating-Point Encodings

1.8 XOP Integer Multiply (Add) and Accumulate Instructions

The multiply and accumulate and multiply, add and accumulate instructions operate on and producepacked signed integer values. These instructions allow the accumulation of results from (possibly)

SignBias

Exponent Significanda

a. The “1.” and “0.” prefixes represent the implicit integer bit.

Classification

0 1 1111 1.00 0000 0000

Positive Floating-Point Numbers

Positive Infinity

01 1110

to0 0001

1.11 1111 1111to

1.00 0000 0000Positive Normal

0 0 00000.11 1111 1111

to0.00 0000 0001

Positive Denormal

0 0 0000 0.00 0000 0000 Positive Zero

1 0 0000 0.00 0000 0000

Positive Floating-Point Numbers

Negative Zero

1 0 00000.00 0000 0001

to0.11 1111 1111

Negative Denormal

10 0001

to1 1110

1.00 0000 0000to

1.11 1111 1111Negative Normal

1 1 1111 1.00 0000 0000 Negative Infinity

X 1 11111.00 0000 0001

to1.01 1111 1111

Non-Number

SNaN

X 1 11111.10 0000 0001

to1.11 1111 1111

QNaN

S Biased Exponent Significand

09101415

Page 32: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

32 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

many iterations of similar operations without a separate intermediate addition operation to update theaccumulator register.

1.8.1 Saturation

Some instructions limit the result of an operation to the maximum or minimum value representable bythe data type of the destination—an operation known as saturation. Many of the integer multiply andaccumulate instructions saturate the cumulative results of the multiplication and addition(accumulation) operations before writing the final results to the destination (accumulator) register.

Note, however, that not all multiply and accumulate instructions saturate results. (For furtherdiscussion of saturation, see the AMD64 Architecture Programmer’s Manual Volume 1: ApplicationProgramming, order# 24592.)

1.8.2 Multiply and Accumulate Instructions

The operation of a typical XOP integer multiply and accumulate instruction is shown in Figure 1-5 onpage 33.

The multiply and accumulate instructions operate on and produce packed signed integer values. Theseinstructions first multiply the value in the first source operand by the corresponding value in the secondsource operand. Each signed integer product is then added to the corresponding value in the thirdsource operand, which is the accumulator and is identical to the destination operand. The results mayor may not be saturated prior to being written to the destination register, depending on the instruction.

Page 33: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 33

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Figure 1-5. Operation of Multiply and Accumulate Instructions

The XOP instruction extensions provide the following integer multiply and accumulate instructions.

• VPMACSSWW—Packed Multiply Accumulate Signed Word to Signed Word with Saturation

• VPMACSWW—Packed Multiply Accumulate Signed Word to Signed Word

• VPMACSSWD—Packed Multiply Accumulate Signed Word to Signed Doubleword withSaturation

• VPMACSWD—Packed Multiply Accumulate Signed Word to Signed Doubleword

• VPMACSSDD—Packed Multiply Accumulate Signed Doubleword to Signed Doubleword withSaturation

• VPMACSDD—Packed Multiply Accumulate Signed Doubleword to Signed Doubleword

• VPMACSSDQL—Packed Multiply Accumulate Signed Low Doubleword to Signed Quadwordwith Saturation

• VPMACSSDQH—Packed Multiply Accumulate Signed High Doubleword to Signed Quadwordwith Saturation

• VPMACSDQL—Packed Multiply Accumulate Signed Low Doubleword to Signed Quadword

• VPMACSDQH—Packed Multiply Accumulate Signed High Doubleword to Signed Quadword

src1

127 96 95 64 63 32 31 0

src2

src3127 96 95 64 63 32 31 0

(saturate)

dest127 96 95 64 63 32 31 0

multiply

add

multiply

add

(saturate)

multiplymultiply

add

add(accumulate)(accumulate)

(accumulate)(accumulate)

(saturate) (saturate)

127 96 95 64 63 32 31 0

Page 34: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

34 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

1.8.3 Integer Multiply, Add and Accumulate Instructions

The operation of the multiply, add and accumulate instructions is illustrated in Figure 1-6.

The multiply, add and accumulate instructions first multiply each packed signed integer value in thefirst source operand by the corresponding packed signed integer value in the second source operand.The odd and even adjacent resulting products are then added. Each resulting sum is then added to thecorresponding packed signed integer value in the third source operand.

Figure 1-6. Operation of Multiply, Add and Accumulate Instructions

The XOP instruction set provides the following integer multiply, add and accumulate instructions.

• VPMADCSSWD—Packed Multiply Add and Accumulate Signed Word to Signed Doublewordwith Saturation

• VPMADCSWD—Packed Multiply Add and Accumulate Signed Word to Signed Doubleword

1.9 Packed Integer Horizontal Add and Subtract

The packed horizontal add and subtract signed byte instructions successively add adjacent pairs ofsigned integer values from the source XMM register or 128-bit memory operand and pack the (sign-extended) integer result of each addition in the destination.

• VPHADDBW—Packed Horizontal Add Signed Byte to Signed Word

127 112 111 96 95 80 79 64 63 48 47 32 31 16 15 0 src2

127 112 111 96 95 80 79 64 63 48 47 32 31 16 15 0

src3127 96 95 64 63 32 31 0

multiplymultiply

multiplymultiply

multiply multiply

multiplymultiply

add

add

dest127 96 95 64 63 32 31 0

(saturate)

add add

add

(saturate)

add

(saturate)

add

(saturate)

add

[accumulate][accumulate]

[accumulate][accumulate]

src1

Page 35: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 35

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

• VPHADDBD—Packed Horizontal Add Signed Byte to Signed Doubleword

• VPHADDBQ—Packed Horizontal Add Signed Byte to Signed Quadword

• VPHADDDQ—Packed Horizontal Add Signed Doubleword to Signed Quadword

• VPHADDUBW—Packed Horizontal Add Unsigned Byte to Word

• VPHADDUBD—Packed Horizontal Add Unsigned Byte to Doubleword

• VPHADDUBQ—Packed Horizontal Add Unsigned Byte to Quadword

• VPHADDUWD—Packed Horizontal Add Unsigned Word to Doubleword

• VPHADDUWQ—Packed Horizontal Add Unsigned Word to Quadword

• VPHADDUDQ—Packed Horizontal Add Unsigned Doubleword to Quadword

• VPHADDWD—Packed Horizontal Add Signed Word to Signed Doubleword

• VPHADDWQ—Packed Horizontal Add Signed Word to Signed Quadword

• VPHSUBBW—Packed Horizontal Subtract Signed Byte to Signed Word

• VPHSUBWD—Packed Horizontal Subtract Signed Word to Signed Doubleword

• VPHSUBDQ—Packed Horizontal Subtract Signed Doubleword to Signed Quadword

1.10 Vector Conditional Moves

XOP instructions include vector conditional move instructions:

• VPCMOV—Vector Conditional Moves

• VPPERM—Packed Permute Bytes

The VPCMOV instruction implements the C/C++ language ternary ‘?’ operator a bit level. Thisinstruction operates on individual bits and requires a bitwise predicate in one XMM or YMM registerand the two source operands in two more XMM or YMM registers.

The VPPERM instruction performs vector permutation on a packed array of 32 bytes composed of two16-byte input operands. The VPPERM instruction replaces each destination byte with 00h, FFh, or oneof the 32 bytes of the packed array. A byte selected from the array may have an additional operationsuch as NOT or bit reversal applied to it, before it is written to the destination. The action for eachdestination byte is determined by a corresponding control byte. The VPPERM instruction allowseither the second 16-byte input array or the control array to be memory based, per the XOP.W bit.

1.11 Packed Integer Rotates and Shifts

These instructions rotate/shift the elements of the vector in the first source YMM or 128-bit memoryoperand by the amount specified by a control byte. The rotates and shifts differ in the way they handlethe control byte.

Page 36: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

36 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

1.11.1 Packed Integer Shifts

The packed integer shift instructions shift each element of the vector in the first source XMM or 128-bit memory operand by the amount specified by a control byte contained in the least significant byte ofthe corresponding element of the second source operand. The result of each shift operation is returnedin the destination XMM register. This allows load-and-shift from memory operations, with either thesource operand or the shift-count operand being memory-based, as indicated by the XOP.W bit. TheXOP instruction set provides the following packed integer shift instructions:

• VPSHLB—Packed Shift Logical Bytes

• VPSHLW—Packed Shift Logical Words

• VPSHLD—Packed Shift Logical Doublewords

• VPSHLQ—Packed Shift Logical Quadwords

• VPSHAB—Packed Shift Arithmetic Bytes

• VPSHAW—Packed Shift Arithmetic Words

• VPSHAD—Packed Shift Arithmetic Doublewords

• VPSHAQ—Packed Shift Arithmetic Quadwords

1.11.2 Packed Integer Rotate

There are two variants of the packed integer rotate instructions. The first is identical to that describedabove (see “Packed Integer Shifts”). In the second variant, the control byte is supplied as an 8-bitimmediate operand that specifies a single rotate amount for every element in the first source operand.The XOP instruction set provides the following packed integer rotate instructions:

• VPROTB—Packed Rotate Bytes

• VPROTW—Packed Rotate Words

• VPROTD—Packed Rotate Doublewords

• VPROTQ—Packed Rotate Quadwords

1.12 Packed Integer Comparison and Predicate Generation

The XOP comparison instructions compare packed integer values in the first source XMM registerwith corresponding packed integer values in the second source XMM register or 128-bit memory. Thetype of comparison is specified by the immediate-byte operand. The resulting predicate is placed in thedestination XMM register. If the condition is true, all bits in the corresponding field in the destinationregister are set to 1s; otherwise all bits in the field are set to 0s.

Page 37: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

New 128-Bit and 256-Bit Instructions 37

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Table 1-9. Immediate Operand Values for Unsigned Vector Comparison Operations

The integer comparison and predicate generation instructions compare corresponding packed signedor unsigned bytes in the first and second source operands and write the result of each comparison in thecorresponding element of the destination. The result of each comparison is a value of all 1s (TRUE) orall 0s (FALSE). The type of comparison is specified by the three low-order bits of the immediate-byteoperand. The XOP instruction set provides the following integer comparison instructions.

• VPCOMUB—Compare Vector Unsigned Bytes

• VPCOMUW—Compare Vector Unsigned Words

• VPCOMUD—Compare Vector Unsigned Doublewords

• VPCOMUQ—Compare Vector Unsigned Quadwords

• VPCOMB—Compare Vector Signed Bytes

• VPCOMW—Compare Vector Signed Words

• VPCOMD—Compare Vector Signed Doublewords

• VPCOMQ—Compare Vector Signed Quadwords

1.13 Fraction Extract

The fraction extract instructions isolate the fractional portions of vector or scalar floating pointoperands. The result of _PD and _PS instructions is a vector of integer numbers. The result of _SD and_SS instructions is always a scalar integer number. XOP provides the following fraction extractinstructions:

• VFRCZPD—Extract Fraction Packed Double-Precision Floating-Point

• VFRCZPS—Extract Fraction Packed Single-Precision Floating-Point

• VFRCZSD— Extract Fraction Scalar Double-Precision Floating-Point

• VFRCZSS— Extract Fraction Scalar Single-Precision Floating Point

Immediate Operand Byte Comparison Operation

Bits 7:3 Bits 2:0

00000b

000b Less Than

001b Less Than or Equal

010b Greater Than

011b Greater Than or Equal

100b Equal

101b Not Equal

110b False

111b True

Page 38: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

38 New 128-Bit and 256-Bit Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

The VFRCZPD and VFRCZPS instructions extract the fractional portions of a vector of double-/single-precision floating-point values in an XMM or YMM register or a 128- or 256-bit memorylocation and write the results in the corresponding field in the destination register.

The VFRCZSS and VFRCZSD instructions extract the fractional portion of the single-/double-precision scalar floating-point value in an XMM register or 32- or 64-bit memory location and writesthe result in the lower element of the destination register. The upper elements of the destination XMMregister are unaffected by the operation, while the upper 128 bits of the corresponding YMM registerare cleared to zeros.

1.14 Convert

The two CVT16 instructions are provided to move data from/to memory and convert a single-precisionfloating point operand to a half-precision floating-point operand or vice versa in one instruction. (SeeSection 1.7, “16-Bit Floating-Point Data Type,” on page 30.) These instructions allow floating pointdata to be maintained in memory in half-precision format, conserving memory space.

• VCVTPH2PS—Convert Half-Precision Floating-Point to Single-Precision Floating Point

• VCVTPS2PH—Convert Single-Precision Floating-Point to Half-Precision Floating Point

Page 39: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference 39

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

2 AMD XOP, FMA4 and CVT16 Instructions

The following section describes the complete set of XOP 128-media instructions. Instructions arelisted alphabetically by mnemonic.

2.1 Notation

The notation used to denote the size and type of source and destination operands in both mnemonicsand opcodes is discussed in detail in Section 2.5, “Notation,” on page 37 in the AMD64 ArchitectureProgrammer’s Manual Volume 3: General Purpose and System Instructions. Mnemonic conventionsthat are idiosyncratic to the XOP instruction set have been included in Chapter 1, “New 128-BitInstructions”, in this document.

2.1.1 Opcode Syntax

Opcode specification for the XOP, FMA4, and CVT16 instruction sets, with their two, three and four operand syntax, requires a slightly different approach from that used to specify the opcodes for previous generation 64- and 128-bit instructions (documented in the AMD64 Architecture Programmer’s Manual Volume 4: 128-Bit Media Instructions, order# 26568, and AMD64 Architecture Programmer’s Manual Volume 5: 64-Bit Media and x87 Floating-Point Instructions, order# 26569). In the following pages, opcodes are specified using the order of fields and bits as they occur in a complete opcode specification as outlined in Section 1.1, “New Instruction Format,” on page 23. The following opcode specification is typical:

Most of the terms and symbols used in the following pages are defined in Section 1.1, “NewInstruction Format,” on page 23. The following notations and convention are used in this volume, inaddition to the opcode notational conventions specified in Section 2.5.2, “Opcode Syntax,” on page 39

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.src1.1.01 69 /r /is4

assembly language representation

VEXprefix

3-bit field representing R, X, B bit values

W bit

vvvv field

L bitpp field

opcode

register/memory type specifier

immediate operand

Page 40: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

40 Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

in the AMD64 Architecture Programmer’s Manual Volume 3: General Purpose and SystemInstructions:

cntrControl bits (for comparison instructions); immediate byte bits 3–0.

is4Destination register specifier; immediate byte bits 7:4.

RXB

Bit field specifying the R, X and B bit values. Specified in one’s complement form.

VEX.WThe meaning of the W bit is opcode specific. This bit toggles source operand order or is ignored,depending upon the opcode.

VEX.LVector length specifier

VEX.vvvv

Additional operand register specifier.

XOPIndicates the XOP prefix byte (8Fh).

2.2 Operand Specification

The packed values in a operand are numbered starting with 0, which is considered to be even-numbered.

Page 41: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference 41

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

2.3 Instruction Reference

Page 42: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

42 VCVTPH2PS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Converts packed 16-bit floating point values to single-precision floating point values. Roundingperformed as specified by settings in an immediate 8-bit operand.

The 128-bit version converts four 16-bit floating-point values in the low-order 64 bits of an XMMregister or 64-bit memory location to four packed single-precision floating-point values and writes theconverted values to the destination XMM register. When the result operand is written to the destinationregister, the upper 128 bits of the corresponding YMM register are zeroed.

The 256-bit version converts eight packed 16-bit floating-point values in the low-order 128 bits of aYMM register or 128-bit memory location to eight packed single-precision floating-point values andwrites the converted values to a destination YMM register.

The handling of denormals and rounding is controlled by fields in the immediate byte, as shown inTable 2-1.

The format of a 16-bit floating-point value is described in Section 1.5, “16-Bit Floating-Point DataType,” on page 8.

The VCVTPH2PS instruction is a CVT16 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VCVTPH2PS Convert Packed 16-Bit Floating-Point to Single-Precision Floating-Point

Table 2-1. Denormal and Rounding Control with Immediate Byte Operand

Mnemonic DAZ FTZ#PE

detectedRC

Bit 7 6 Method 5 4 Method 3 Method 2 1 0 Method

Valu

e

0 0 Denormal 0 0 Denormal 0 #PE if inexact 0 0 0 Nearest

0 1 DAZ 0 1 FTZ 1 No #PE 1 0 1 Down

1 x MXCSR.DAZ 1 x MXCSR.FTZ 1 0 Up

1 1 Truncate

1 x x MXCSR.RC

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VCVTPH2PS xmm1, xmm2/mem64, imm8 8F RXB.08 0.1111.0.00 A0 /r /imm8

VCVTPH2PS ymm1, xmm2/mem128, imm8 8F RXB.08 0.1111.1.00 A0 /r /imm8

Page 43: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VCVTPH2PS 43

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VCVTPS2PH

rFLAGS Affected

None

MXCSR Flags Affected

None

dest = xmm1

src = xmm2/mem64

095 63127 64 313296

063 16 15313248 47127 64

VCVTPH2PS128-Bit

095 63127 64 313296128223 191255 192 159160224

0111 95 63127 16 1564 313248 4780 7996112

src = xmm2/

dest = ymm1

mem128

VCVTPH2PS256-Bit

1282550s

convert convert convert convert

convert convert convert convert convert convert convert convert

Page 44: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

44 VCVTPH2PS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X CVT16 instructions are only recognized in protected mode.

XThe CVT16 instructions are not supported, as indicated by ECX bit 18 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X VPX.W was set to 1.

X VPX.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 45: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VCVTPS2PH 45

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Converts packed single-precision floating-point values to packed 16-bit floating-point values andwrites the converted values to the destination register or to memory. Rounding performed as specifiedby settings in an immediate 8-bit operand.

The 128-bit version converts four packed single-precision floating-point values in an XMM register tofour packed 16-bit floating-point values and writes the converted values to the low-order 64 bits of thedestination XMM register or to a 64-bit memory location. When the result is written to the destinationXMM register, the high-order 64 bits in the destination XMM register and the upper 128 bits of thecorresponding YMM register are cleared to 0s.

The 256-bit version converts eight packed single-precision floating-point values in a YMM register toeight packed 16-bit floating-point values and writes the converted values to the low-order 128 bits ofanother YMM register or to a 128-bit memory location. When the result is written to the destinationYMM register, the high-order 128 bits in the register are cleared to 0s.

Table 1-10 on page 8 shows the floating-point encodings of supported numbers and non-numbers.

The format of a 16-bit floating-point value is described in Section 1.5, “16-Bit Floating-Point DataType,” on page 7.

The handling of denormals and rounding is controlled by fields in the immediate byte, as shown inTable 2-2.

The format of a 16-bit floating-point value is described in Section 1.5, “16-Bit Floating-Point DataType,” on page 8.

The VCVTPS2PH instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VCVTPS2PH Convert Packed Single-Precision Floating-Pointto 16-Bit Floating-Point

Table 2-2. Denormal and Rounding Control with Immediate Byte Operand

Mnemonic DAZ FTZ#PE

detectedRC

Bit 7 6 Method 5 4 Method 3 Method 2 1 0 Method

Valu

e

0 0 Denormal 0 0 Denormal 0 #PE if inexact 0 0 0 Nearest

0 1 DAZ 0 1 FTZ 1 No #PE 1 0 1 Down

1 x MXCSR.DAZ 1 x MXCSR.FTZ 1 0 Up

1 1 Truncate

1 x x MXCSR.RC

Page 46: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

46 VCVTPS2PH Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VCVTPH2PS

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VCVTPS2PH xmm1/mem64, xmm2, imm8 8F RXB.08 0.1111.0.00 A1 /r /imm8

VCVTPS2PH xmm1/mem128, ymm2, imm8 8F RXB.08 0.1111.1.00 A1 /r /imm8

src = xmm2095 63127 64 313296

063 16 15313248 47127 640

convert convert convert convertdest = xmm1/mem64

VCVTPS2PH128-Bit

src = ymm2095 63127 64 313296128223 191255 192 159160224

0111 95 63127 161564 313248 4780 7996112128255

0s

VCVTPS2PH

convert convertconvertconvert convert convertconvertconvert

xmm1/mem128

1282550s

256-Bit

Page 47: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VCVTPS2PH 47

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

rFLAGS Affected

None

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X CVT16 instructions are only recognized in protected mode.

XThe CVT16 instructions are not supported, as indicated by ECX bit 18 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP

X A memory address exceeded a data segment limit or was non-canonical.

X A null data segment was used to reference memory.

X The destination operand was in a non-writable segment.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exceptions

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 48: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

48 VFMADDPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed double-precision floating-point value in the first source by the correspondingpacked double-precision floating-point value in the second source, then adds each product to thecorresponding packed double-precision floating-point value in the third source and writes the roundedresults to the destination register.

The VFMADDPD instruction requires four operands:

VFMADDPD dest, src1, src2, src3 dest = (src1* src2) + src3

The 128-bit version multiplies each of the two double-precision values in the first source XMMregister by its corresponding double-precision value in the second source. It then adds eachintermediate product to the corresponding double-precision value in the third source and places theresult in the destination XMM register.

The 256-bit version multiplies each of the four double-precision values in the first source YMMregister by its corresponding double-precision value in the second source. It then adds each product tothe corresponding double-precision value in the third source and places the results in the destinationYMM register.

If VEX.W is 0, the second source is either a register or memory and the third source is a register. IfVEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the addition are rounded, as specified by the rounding mode in MXCSR.

The VFMADDPD instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMADDPD Multiply and Add Packed Double-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDPD xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 69 /r /is4

VFMADDPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 69 /r /is4

VFMADDPD xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 69 /r /is4

VFMADDPD ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 69 /r /is4

Page 49: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDPD 49

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDPS, VFMADDSD, VFMADDSS

rFLAGS Affected

None

127 64 63 0

255 192 191 128

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

127 64 63 0

255 192 191 128

VEX.L=1

0s

VEX.L=1

mul mul

mul mul

VEX.L=1

add add

add add

rnd rnd rnd rnd

VEX.L=1

dest = xmm1 | ymm1

src1 = xmm2 | ymm2 src2 = xmm3/mem128 | ymm/mem256

VFMADDPD

src3 = xmm4/mem128 | ymm4/mem256

Page 50: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

50 VFMADDPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Page 51: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDPD 51

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Exception RealVirtual8086 Protected Cause of Exception

Page 52: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

52 VFMADDPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed single-precision floating-point value in the first source by the correspondingsingle-precision floating-point value in the second source, then adds each product to the correspondingpacked single-precision floating-point value in the third source and writes the rounded results to thedestination register.

The VFMADDPS instruction requires four operands:

VFMADDPS dest, src1, src2, src3 dest = src1* src2 + src3

The 128-bit version multiplies each of the four single-precision values in the first source XMMregister by its corresponding single-precision value in the second source. It then adds each product tothe corresponding single-precision value in the third source and places the results in the destinationXMM register.

The 256-bit version multiplies each of the eight single-precision values in the first source YMMregister by its corresponding double-precision value in the second source. It then adds each product tothe corresponding double-precision value in the third source and places the results in the destinationYMM register.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the addition are rounded, as specified by the rounding mode in MXCSR.

The VFMADDPS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMADDPS Multiply and Add Packed Single-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDPS xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 68 /r /is4

VFMADDPS ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 68 /r /is4

VFMADDPS xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 68 /r /is4

VFMADDPS ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 68 /r /is4

Page 53: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDPS 53

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDPD, VFMADDSD, VFMADDSS

rFLAGS Affected

None

127 6463 0

255 192191 128

255 128VEX.L=0

VEX.L=1

0s

VEX.L=1

mul

VEX.L=1

add

rnd rndrnd

VEX.L=1

dest = xmm1 | ymm1

src1 = xmm2 | ymm2 src2 = xmm3/mem128 | ymm4/mem256

VFMADDPS

31329596

159160223224

add

rnd

mul

rnd

mul

add

mul

add

rnd

add

rnd

mul

addrnd

255 192191 128159160223224255 192191 128159160223224

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

255 192191 128159160223224

mul mul

add

mul

add

src3 = xmm4/mem128 | ymm4/mem256

Page 54: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

54 VFMADDPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Page 55: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDPS 55

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Exception RealVirtual8086 Protected Cause of Exception

Page 56: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

56 VFMADDSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies the double-precision floating-point value in the low-order quadword of the first source bythe double-precision floating-point value in the low-order quadword of the second source, then addsthe product to the double-precision floating-point value in the low-order quadword of the third source.The low-order quadword result is written to the destination.

The VFMADDSD instruction requires four operands:

VFMADDSD dest, src1, src2, src3 dest = src1* src2 + src3

If VEX.W is 0, the second source is either a register or 64-bit memory location and the third source isa register. If VEX.W is 1, the second source is a a register and the third source is a register or 64-bitmemory location.

The destination is an XMM register. When the result is written to the destination XMM register, theupper quadword of the destination register (bits 64–127) and the upper 128-bits of the correspondingYMM register are cleared to zeros.

The intermediate product is not rounded; the infinitely precise product is used in the addition. Theresult of the addition is rounded, as specified by the rounding mode in MXCSR.

The VFMADDSD instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMADDSD Multiply and Add ScalarDouble-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDSD xmm1, xmm2, xmm3/mem64, xmm4 C4 RXB.03 0.xsrc1.0.01 6B /r /is4

VFMADDSD xmm1, xmm2, xmm3, xmm4/mem64 C4 RXB.03 1.xsrc1.0.01 6B /r /is4

Page 57: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSD 57

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDPD, VFMADDPS, VFMADDSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

127 64 63 0

127 64 63 0

255 128

127 64 63 0

0s

mul

add

rnd

dest = xmm1

src1 = xmm2 src2 = xmm3/mem64

src3 = xmm4/mem64

VFMADDSD

0s

Page 58: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

58 VFMADDSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 59: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSS 59

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the single-precision floating-point value in the low-order doubleword of the first source bythe low-order single-precision floating-point value in the second source, then adds the product to thelow-order single-precision floating-point value in the third source. The low-order doubleword result iswritten to the destination.

The VFMADDSS instruction requires four operands:

VFMADDSS dest, src1, src2, src3 dest = src1* src2 + src3

If VEX.W is 0, the second source is either a register or 32-bit memory location and the third source isa register. If VEX.W is 1, the second source is a a register and the third source is a register or 32-bitmemory location.

The destination is an XMM register. When the result is written to the destination XMM register, theupper three doublewords of the destination register (bits 32–127) and the upper 128-bits of thecorresponding YMM register are cleared to zeros.

The intermediate product is not rounded; the infinitely precise product is used in the addition. Theresult of the addition is rounded, as specified by the rounding mode in MXCSR.

The VFMADDSS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMADDSS Multiply and Add Scalar Single-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDSS xmm1, xmm2, xmm3/mem32, xmm4 C4 RXB.03 0.xsrc1.0.01 6A /r /is4

VFMADDSS xmm1, xmm2, xmm3, xmm4/mem32 C4 RXB.03 1.xsrc1.0.01 6A /r /is4

Page 60: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

60 VFMADDSS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFMADDPD, VFMADDPS, VFMADDSD

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 128

0sdest = xmm1

src1 = xmm2 src2 = xmm3/mem32

src3 = xmm4/mem32

VFMADDSS

31329596

mul

rnd

127 6463 031329596

127 6463 031329596

add

127 6463 031329596

0s0s0s

Page 61: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSS 61

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 62: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

62 VFMADDSUBPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed double-precision floating-point value in the first source by the correspondingpacked double-precision floating-point value in the second source. Adds each odd-numbered double-precision floating-point value in the third source to the corresponding infinite-precision intermediateproduct; subtracts each even-numbered double-precision floating-point value in the third source fromits corresponding product. Finally, writes the results to the destination.

The 128-bit version multiplies each of the two double-precision floating-point values in the first sourceby its corresponding value in the second source. The low-order double-precision floating-point valuein the third source is subtracted from its corresponding infinite-precision product and the high-orderdouble-precision floating-point value in the third source is added to its corresponding product. Theresults of these operations are placed in their corresponding positions in the destination.

The 256-bit version multiplies each of the four double-precision floating-point values in first source byits corresponding double-precision value in the second source. The even-numbered double-precisionvalues in the third source are subtracted from their corresponding infinite-precision intermediateproducts and the odd-numbered double-precision values in the third source are added to theircorresponding infinite precision intermediate products. The results of these operations are placed intheir corresponding positions in the destination.

The first source is an XMM register or a YMM register, depending on the vector size, as determined byVEX.L.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When writing to a 128-bit XMM destination register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the final additionand subtraction operation(s). The results of the addition and subtraction operations are rounded, asspecified by the rounding mode in MXCSR.

The VFMADDSUBPD instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMADDSUBPD Multiply with Alternating Add/Subtract ofPacked Double-Precision Floating-Point

Page 63: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSUBPD 63

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDSUBPD, VFMSUBADDPD, VFMSUBADDPS

rFLAGS Affected

None

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDSUBPD xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 5D /r /is4

VFMADDSUBPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 5D /r /is4

VFMADDSUBPD xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 5D /r /is4

VFMADDSUBPD ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 5D /r /is4

127 64 63 0

255 192 191 128

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

127 64 63 0

255 192 191 128

VEX.L=1

0s

VEX.L=1

mul mul

mul mul

VEX.L=1

add

add

rnd rnd rnd rnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFMADDSUBPD

sub

sub

Page 64: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

64 VFMADDSUBPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

Page 65: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSUBPD 65

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/–zero was multiplied by +/–infinity

X +infinity was added to –infinity

X +infinity was subtracted from +infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Exception RealVirtual8086 Protected Cause of Exception

Page 66: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

66 VFMADDSUBPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed single-precision floating-point value in the first source by the correspondingpacked single-precision floating-point value in the second source. Adds each odd-numbered single-precision floating-point value in the third source to the corresponding infinite-precision intermediateproduct; subtracts each even-numbered single-precision floating-point value in the third source fromits corresponding product. Finally, writes the results to the destination.

The 128-bit version multiplies each of the four single-precision floating-point values in first source byits corresponding single-precision value in the second source. The even-numbered single-precisionvalues in the third source are subtracted from their corresponding infinite-precision intermediateproducts and the odd-numbered single-precision values in the third source are added to theircorresponding infinite precision intermediate products. The results of these operations are placed intheir corresponding positions in the destination.

The 256-bit version multiplies each of the eight single-precision floating-point values in first source byits corresponding single-precision value in the second source. The even-numbered single-precisionvalues in the third source are subtracted from their corresponding infinite-precision intermediateproducts and the odd-numbered single-precision values in the third source are added to theircorresponding infinite precision intermediate products. The results of these operations are placed intheir corresponding positions in the destination.

The first source is either an XMM register or a YMM register, depending on the vector size, asdetermined by VEX.L.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When writing to a 128-bit XMM destination register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise intermediate products are used in theaddition and subtraction operations. The results of the addition and subtraction operations are rounded,as specified by the rounding mode in MXCSR.

The VFMADDSUBPS instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMADDSUBPS Multiply with Alternating Add/Subtract ofPacked Single-Precision Floating-Point

Page 67: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSUBPS 67

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDSUBPD, VFMSUBADDPD, VFMSUBADDPS

rFLAGS Affected

None

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMADDSUBPS xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 5C /r /is4

VFMADDSUBPS ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 5C /r /is4

VFMADDSUBPS xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 5C /r /is4

VFMADDSUBPS ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 5C /r /is4

127 6463 0

255 192191 128

255 128VEX.L=0

VEX.L=1

0s

VEX.L=1

mul

VEX.L=1

rnd rndrnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFMADDSUBPS

31329596

159160223224

sub

rnd

mul

rnd

mul

add

mul

rnd

add

rnd

mul

subrnd

255 192191 128159160223224

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

255 192191 128159160223224

mul mul

add

mul

add

sub sub

127 6463 031329596

Page 68: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

68 VFMADDSUBPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

Page 69: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMADDSUBPS 69

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/–zero was multiplied by +/–infinity

X +infinity was added to –infinity

X +infinity was subtracted from +infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Exception RealVirtual8086 Protected Cause of Exception

Page 70: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

70 VFMSUBADDPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed double-precision floating-point value in the first source by the correspondingpacked double-precision floating-point value in the second source. Adds each even-numbered double-precision floating-point value in the third source to the corresponding infinite-precision intermediateproduct; subtracts each odd-numbered double-precision floating-point value in the third source fromits corresponding product. Finally, writes the results to the destination.

The 128-bit version multiplies each of the two double-precision floating-point values in the first sourceby its corresponding value in the second source. The high-order double-precision floating-point valuein the third source is subtracted from its corresponding infinite-precision product and the low-orderdouble-precision floating-point value in the third source is added to its corresponding product. Theresults of these operations are placed in their corresponding positions in the destination.

The 256-bit version multiplies each of the four double-precision floating-point values in first source byits corresponding double-precision value in the second source. The odd-numbered double-precisionvalues in the third source are subtracted from their corresponding infinite-precision intermediateproducts and the even-numbered double-precision values in the third source are added to theircorresponding infinite precision intermediate products. The results of these operations are placed intheir corresponding positions in the destination.

The first source is either an XMM register or a YMM register, depending on the vector size, asdetermined by VEX.L.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source operand is a register ormemory location.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When writing to a 128-bit XMM destination register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the two infinitely precise intermediate products are used inthe addition. The results of the addition and subtraction operations are rounded, as specified by therounding mode in MXCSR.

The VFMSUBADDPD instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMSUBADDPD Multiply with Alternating Subtract/Add ofPacked Double-Precision Floating-Point

Page 71: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBADDPD 71

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDSUBPD, VFMADDSUBPS, VFMSUBADDPS

rFLAGS Affected

None

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMSUBADDPD xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 5F /r /is4

VFMSUBADDPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 5F /r /is4

VFMSUBADDPD xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 5F /r /is4

VFMSUBADDPD ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 5F /r /is4

127 64 63 0

255 192 191 128

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

127 64 63 0

255 192 191 128

VEX.L=1

0s

VEX.L=1

mul mul

mul mul

VEX.L=1

add

add

rnd rnd rnd rnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFMSUBADDPD

sub

sub

Page 72: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

72 VFMSUBADDPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

Page 73: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBADDPD 73

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

X +infinity was subtracted from +infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Exception RealVirtual8086 Protected Cause of Exception

Page 74: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

74 VFMSUBADDPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed single-precision floating-point value in the first source by the correspondingpacked single-precision floating-point value in the second source. Adds each even-numbered single-precision floating-point value in the third source to the corresponding infinite-precision intermediateproduct; subtracts each odd-numbered single-precision floating-point value in the third source from itscorresponding product. Finally, writes the results to the destination.

The 128-bit version multiplies each of the four single-precision floating-point values in first source byits corresponding single-precision value in the second source. The odd-numbered single-precisionvalues in the third source are subtracted from their corresponding infinite-precision intermediateproducts and the even-numbered single-precision values in the third source are added to theircorresponding infinite precision intermediate products. The results of these operations are placed intheir corresponding positions in the destination.

The 256-bit version multiplies each of the eight single-precision floating-point values in first source byits corresponding single-precision value in the second source. The odd-numbered single-precisionvalues in the third source are subtracted from their corresponding infinite-precision intermediateproducts and the even-numbered single-precision values in the third source are added to theircorresponding infinite precision intermediate products. The results of these operations are placed intheir corresponding positions in the destination.

The first source is either an XMM register or a YMM register, depending on the vector size, asdetermined by VEX.L.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When writing to a 128-bit XMM destination register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the additions and subtracts are rounded, as specified by the rounding mode in MXCSR.

The VFMSUBADDPS instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMSUBADDPS Multiply with Alternating Subtract/Add ofPacked Single-Precision Floating-Point

Page 75: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBADDPS 75

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMADDSUBPD, VFMADDSUBPS, VFMSUBADDPD, VFMSUBADDPS

rFLAGS Affected

None

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMSUBADDPS xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 5E /r /is4

VFMSUBADDPS ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 5E /r /is4

VFMSUBADDPS xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 5E /r /is4

VFMSUBADDPS ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 5E /r /is4

127 6463 0

255 192191 128

255 128VEX.L=0

VEX.L=1

0s

VEX.L=1

mul

VEX.L=1

rnd rndrnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFMSUBADDPS

31329596

159160223224

sub

rnd

mul

rnd

mul

add

mul

rnd add

rnd

mul

sub

rnd255 192191 128159160223224

255 192191 128159160223224

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

255 192191 128159160223224

mul mul

add

mul

add

sub sub

Page 76: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

76 VFMSUBADDPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

Page 77: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBADDPS 77

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

X +infinity was subtracted from +infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Exception RealVirtual8086 Protected Cause of Exception

Page 78: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

78 VFMSUBPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each of the packed double-precision floating-point values in the first source by itscorresponding packed double-precision floating-point value in the second source, then subtracts thecorresponding packed double-precision floating-point values in the third source from the intermediateproducts of the multiplication. The results are written to the destination register.

The VFMSUBPD instruction requires four operands:

VFMSUBPD dest, src1, src2, src3 dest = src1* src2 - src3

The 128-bit version multiplies two packed double-precision floating-point values in the first source, bytheir corresponding packed double-precision floating point values in the second source, producing twointermediate products. The two double precision floating-point values in the third source aresubtracted from the intermediate products of the multiplication and the remainders are placed in thedestination XMM register.

The 256-bit version multiplies four packed double-precision floating-point values in the first source bytheir corresponding packed double-precision floating point values in the second source, producingfour intermediate products. The four double-precision floating-point values in the third source aresubtracted from the intermediate products of the multiplication and the remainders are placed in thedestination YMM register.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When writing to a 128-bit XMM destination register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the two infinitely precise products are used in thesubtraction. The results of the subtraction are rounded, as specified by the rounding mode in MXCSR.

The VFMSUBPD instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMSUBPD Multiply and Subtract Packed Double-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMSUBPD xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 6D /r /is4

VFMSUBPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 6D /r /is4

VFMSUBPD xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 6D /r /is4

VFMSUBPD ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 6D /r /is4

Page 79: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBPD 79

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMSUBPS, VFMSUBSD, VFMSUBSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

255 192 191 128

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

127 64 63 0

255 192 191 128

VEX.L=1

0s

VEX.L=1

mul mul

mul mul

VEX.L=1

sub sub

sub sub

rnd rnd rnd rnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFMSUBPD

Page 80: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

80 VFMSUBPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

X -infinity was subtracted from -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 81: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBPS 81

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies each of the packed single-precision floating-point values in the first source by itscorresponding packed single-precision floating-point value in the second source, then subtracts thecorresponding packed single-precision floating-point values in the third source from the products. Thefour results are written to the destination register.

The VFMSUBPS instruction requires four operands:

VFMSUBPS dest, src1, src2, src3 dest = src1* src2 - src3

The 128-bit version multiplies four packed single-precision floating-point values in the first source bytheir corresponding packed single-precision floating point values in the second source, producing fourintermediate products. The four single-precision floating-point values in the third source aresubtracted from the intermediate products of the multiplication and the remainders are placed in thedestination XMM register.

The 256-bit version multiplies eight packed single-precision floating-point values in the first source bytheir corresponding packed single-precision floating point values in the second source, producingeight intermediate products. The eight single-precision floating-point values in the third source aresubtracted from the intermediate products of the multiplication and the remainders are placed in thedestination YMM register.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When writing to a 128-bit XMM destination register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the two infinitely precise products are used in thesubtraction. The results of the subtraction are rounded, as specified by the rounding mode in MXCSR.

The VFMSUBPS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMSUBPS Multiply and Subtract Packed Single-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMSUBPS xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 6C /r /is4

VFMSUBPS ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 6C /r /is4

VFMSUBPS xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 6C /r /is4

VFMSUBPS ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 6C /r /is4

Page 82: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

82 VFMSUBPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFMSUBPD, VFMSUBSD, VFMSUBSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 192191 128

255 128

VEX.L=0

VEX.L=1

0s

VEX.L=1

mul

VEX.L=1

sub

rnd rndrnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFMSUBPS

31329596

159160223224

sub

rnd

mul

rnd

mul

sub

mul

rnd

sub

rnd

mul

subrnd

255 192191 128159160223224

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

255 192191 128159160223224

mul mul

sub

mul

sub

127 6463 031329596

sub

Page 83: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBPS 83

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

X -infinity was subtracted from -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 84: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

84 VFMSUBSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies the double-precision floating-point value in the low-order quadword of the first source bythe double-precision floating-point value in the low-order quadword of the second source, thensubtracts the double-precision floating-point value in the low-order quadword of the third source fromthe intermediate product. The low-order quadword result is written to the destination.

The VFMSUBSD instruction requires four operands:

VFMSUBSD dest, src1, src2, src3 dest = src1* src2 - src3

If VEX.W is 0, the second source is either a register or 64-bit memory location and the third source isa register. If VEX.W is 1, the second source is a register and the third source is a register or 64-bitmemory location.

The destination is an XMM register. When the result is written to the destination XMM register, theupper quadword of the destination register (bits 64–127) and the upper 128-bits of the correspondingYMM register are cleared to zeros.

The intermediate product is not rounded; the infinitely precise product is used in the subtraction. Theresult of the subtraction is rounded, as specified by the rounding mode in MXCSR.

The VFMSUBSD instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMSUBSD Multiply and Subtract Scalar Double-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMSUBSD xmm1, xmm2, xmm3/mem64, xmm4 C4 RXB.03 0.xsrc1.0.01 6F /r /is4

VFMSUBSD xmm1, xmm2, xmm3, xmm4/mem64 C4 RXB.03 1.xsrc1.0.01 6F /r /is4

Page 85: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBSD 85

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFMSUBPD, VFMSUBPS, VFMSUBSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

127 64 63 0

127 64 63 0

255 128

127 64 63 0

0s

mul

sub

rnd

dest = xmm

src1 = xmm src2 = xmm | mem64

src3 = mem64 | xmm

VFMSUBSD

0s

Page 86: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

86 VFMSUBSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

X -infinity was subtracted from -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 87: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBSS 87

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the single-precision floating-point value in the low-order doubleword of the first source bythe single-precision floating-point value in the low-order doubleword of the second source, thensubtracts the single-precision floating-point value in the low-order doubleword of the third sourcefrom the product. The low-order doubleword result is written to the destination.

The VFMSUBSS instruction requires four operands:

VFMSUBSS dest, src1, src2, src3 dest = src1* src2 - src3

If VEX.W is 0, the second source is either a register or 32-bit memory location and the third source isa register. If VEX.W is 1, the second source is a register and the third source is a register or 32-bitmemory location.

The destination is an XMM register. When the result is written to the destination XMM register, theupper three doublewords of the destination register (bits 32–127) and the upper 128-bits of thecorresponding YMM register are cleared to zeros.

The intermediate product is not rounded; the infinitely precise product is used in the subtraction. Theresult of the subtraction is rounded, as specified by the rounding mode in MXCSR.

The VFMSUBSS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFMSUBSS Multiply and Subtract Scalar Single-PrecisionFloating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFMSUBSS xmm1, xmm2, xmm3/mem32, xmm4 C4 RXB.03 0.xsrc1.0.01 6E /r /is4

VFMSUBSS xmm1, xmm2, xmm3, xmm4/mem32 C4 RXB.03 1.xsrc1.0.01 6E /r /is4

Page 88: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

88 VFMSUBSS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFMSUBPD, VFMSUBPS, VFMSUBSD

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 128

0sdest = xmm

src1 = xmm src2 = xmm | mem32

src3 = mem32 | xmm

VFMSUBSS

31329596

mul

rnd

127 6463 031329596

127 6463 031329596

sub

127 6463 031329596

0s0s0s

Page 89: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFMSUBSS 89

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/–zero was multiplied by +/– infinity

X +infinity was added to –infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 90: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

90 FNMADDPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each of the packed double-precision floating-point values in the first source by thecorresponding packed double-precision floating-point values in the second source, then negates theproducts and adds them to the corresponding packed double-precision floating-point values in the thirdsource. The results are written to the destination register.

The VFNMADDPD instruction requires four operands:

VFNMADDPD dest, src1, src2, src3 dest = – (src1* src2) + src3

The 128-bit version multiplies the two double-precision values in the first source XMM register by thecorresponding double-precision values in the second source, which can be either an XMM register or a128-bit memory location. It then negates each product and adds it to the corresponding double-precision value in the third source. The results are then placed in the destination XMM register.

The 256-bit version multiplies the four double-precision values in the first source YMM register by thefour double-precision values in the second source, which can be either a YMM register or a 256-bitmemory location. It then negates each product and adds it to the corresponding double-precision valuein the third source. The results are then placed in the destination YMM register.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the addition are rounded, as specified by the rounding mode in MXCSR.

The VFNMADDPD instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMADDPD Negative Multiply and Add PackedDouble-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMADDPD xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 79 /r /is4

VFNMADDPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 01.ysrc1.1.01 79 /r /is4

VFNMADDPD xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 79 /r /is4

VFNMADDPD ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 79 /r /is4

Page 91: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference FNMADDPD 91

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFNMADDPS, VFNMADDSD, VFNMADDSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

255 192 191 128

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

127 64 63 0

255 192 191 128

VEX.L=1

0s

VEX.L=1

mul mul

mul mul

VEX.L=1

add add

add add

rnd rnd rnd rnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFNMADDPD

neg neg neg neg

Page 92: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

92 FNMADDPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 93: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference FNMADDPS 93

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies each of the packed single-precision floating-point values in first source by thecorresponding packed single-precision floating-point value in the second source, then negates theproducts and adds them to the corresponding packed single-precision floating-point values in the thirdsource. The results are written to the destination register.

The VFNMADDPS instruction requires four operands:

VFNMADDPS dest, src1, src2, src3 dest = – (src1* src2) + src3

The 128-bit version multiplies the four single-precision values in the first source XMM register by thecorresponding single-precision values in the second source, which can be either an XMM register or a128-bit memory location. It then negates each product and adds it to the corresponding single-precision value in the third source. The results are then placed in the destination XMM register.

The 256-bit version multiplies the eight single-precision values in the first source YMM register by theeight single-precision values in the second source, which can be either a YMM register or a 256-bitmemory location. It then negates each product and adds it to the corresponding single-precision valuein the third source. The result is then placed in the destination YMM register.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the addition are rounded, as specified by the rounding mode in MXCSR.

The FNMADDPS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMADDPS Negative Multiply and Add PackedSingle-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMADDPS xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 78 /r /is4

VFNMADDPS ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 78 /r /is4

VFNMADDPS xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 78 /r /is4

VFNMADDPS ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 78 /r /is4

Page 94: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

94 FNMADDPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFNMADDPD, VFNMADDSD, VFNMADDSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 192191 128

255 128

VEX.L=0

VEX.L=1

0s

VEX.L=1

mul

VEX.L=1

add

rnd rndrnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFNMADDPS

31329596

159160223224

add

rnd

mul

rnd

mul

add

mul

add

rnd

add

rnd

mul

addrnd

255 192191 128159160223224

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

255 192191 128159160223224

mul mul

add

mul

add

neg neg

neg neg

neg neg

neg neg

127 6463 031329596

Page 95: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference FNMADDPS 95

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 96: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

96 VFNMADDSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies the double-precision floating-point value in the low-order quadword of the first source bythe double-precision floating-point value in the low-order quadword of the second source, then negatesthe product and adds it to the double-precision floating-point value in the low-order quadword of thethird source. The low-order quadword result is written to the destination register.

The VFNMADDSD instruction requires four operands:

VFNMADDSD dest, src1, src2, src3 dest = – (src1* src2) + src)

The first source is an XMM register indicated by VEX.vvvv.

If VEX.W is 0, the second source is either a register or 64-bit memory location and the third source isa register. If VEX.W is 1, the second source is a register and the third source is a register or 64-bitmemory location.

The destination is always an XMM register. When the result is written to the destination XMMregister, the high quadword of the destination register (bits 64–127) and the upper 128-bits of thecorresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the addition are rounded, as specified by the rounding mode in MXCSR.

The VFNMADDSD instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMADDSD Negative Multiply and Add ScalarDouble-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMADDSD xmm1, xmm2, xmm3/mem64, xmm4 C4 RXB.03 0.xsrc1.0.01 7B /r /is4

VFNMADDSD xmm1, xmm2, xmm3, xmm4/mem64 C4 RXB.03 1.xsrc1.0.01 7B /r /is4

Page 97: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMADDSD 97

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFNMADDPD, VFNMADDPS, VFNMADDSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

127 64 63 0

127 64 63 0

255 128

127 64 63 0

0s

mul

add

rnd

dest = xmm

src1 = xmm src2 = xmm | mem64

src3 = mem64 | xmm

VFNMADDSD

0s

neg

Page 98: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

98 VFNMADDSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 99: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMADDSS 99

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the single-precision floating-point value in the low-order doubleword of the first source bythe single-precision floating-point value in the low-order doubleword of the second source, thennegates the product and adds it to the single-precision floating-point value in the low-orderdoubleword of the third source. The low-order doubleword result is written to the destination.

The VFNMADDSS instruction requires four operands:

VFNMADDSS dest, src1, src2, src3 dest = - (src1* src2) + src3

If VEX.W is 0, the second source is either a register or 32-bit memory location and the third source isa register. If VEX.W is 1, the second source is a register and the third source is a register or 32-bitmemory location.

The destination is always an XMM register. When the result is written to the destination XMMregister, the upper three doublewords of the destination register (bits 32–127) and the upper 128-bits ofthe corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the addition. Theresults of the addition are rounded, as specified by the rounding mode in MXCSR.

The VFNMADDSS instruction is an FMA4 instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMADDSS Negative Multiply and Add ScalarSingle-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMADDSS xmm1, xmm2, xmm3/mem32, xmm4 C4 RXB.03 0.xsrc1.0.01 7A /r /is4

VFNMADDSS xmm1, xmm2, xmm3, xmm4/mem32 C4 RXB.03 1.xsrc1.0.01 7A /r /is4

Page 100: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

100 VFNMADDSS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFNMADDPD, VFNMADDPS, VFNMADDSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 128

0sdest = xmm

src1 = xmm src2 = xmm | mem32

src3 = mem32 | xmm

VFNMADDSS

31329596

mul

rnd

127 6463 031329596

127 6463 031329596

add

127 6463 031329596

0s0s0s

neg

Page 101: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMADDSS 101

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 102: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

102 VFNMSUBPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each of the packed double-precision floating-point values in the first source by thecorresponding packed double-precision floating-point value in the second source, then subtracts thecorresponding packed double-precision floating-point value in the third source from the negatedinterim products.The results are written to the destination register.

The VFNMSUBPD instruction requires four operands:

VFNMSUBPD dest, src1, src2, src3 dest = – (src1* src2) - src3

The 128-bit version multiplies each of the two double-precision values in the first source XMMregister by its corresponding double-precision value in the second source, which can be either anXMM register or a 128-bit memory location. It then subtracts the corresponding double-precisionvalue in the third source from the negated interim product. The results are then placed in thedestination XMM register.

The 256-bit version multiplies each of the four double-precision values in the first source YMMregister by its corresponding double-precision value in the second source, which can be either a YMMregister or a 256-bit memory location. It then subtracts the corresponding double-precision value in thethird source from the negated interim product. The results are then placed in the destination YMMregister.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the subtraction.The results of the subtraction are rounded, as specified by the rounding mode in MXCSR.

The VFNMSUBPD instruction is an FMA4 instruction. The presence of this instruction set is indicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMSUBPD Negative Multiply and Subtract PackedDouble-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMSUBPD xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 7D /r /is4

VFNMSUBPD ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 7D /r /is4

VFNMSUBPD xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 7D /r /is4

VFNMSUBPD ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 7D /r /is4

Page 103: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMSUBPD 103

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFNMSUBPS, VFNMSUBSD, VFNMSUBSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

255 192 191 128

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

127 64 63 0

255 192 191 128

VEX.L=1

0s

VEX.L=1

mul mul

mul mul

VEX.L=1

sub sub

sub sub

rnd rnd rnd rnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFNMSUBPD

neg neg neg neg

Page 104: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

104 VFNMSUBPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/–zero was multiplied by +/–infinity

X +infinity was added to –infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 105: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMSUBPS 105

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies each of the packed single-precision floating-point values in the first source by thecorresponding packed single-precision floating-point value in the second source, then subtracts thecorresponding packed single-precision floating-point values in the third source from the negatedproducts. The results are written to the destination register.

The VFNMSUBPS instruction requires four operands:

VFNMSUBPS dest, src1, src2, src3 dest = – (src1* src2) – src3

The 128-bit version multiplies each of the four single-precision values in the first source XMMregister by its corresponding single-precision value in the second source, which can be either an XMMregister or a 128-bit memory location. It then subtracts the corresponding single-precision value in thethird source from the negated interim product. The results are then placed in the destination XMMregister.

The 256-bit version multiplies each of the eight single-precision values in the first source YMMregister by its corresponding single-precision value in the second source, which can be either a YMMregister or a 256-bit memory location. It then subtracts the corresponding single-precision value in thethird source from the negated interim product. The results are then placed in the destination YMMregister.

If VEX.W is 0, the second source is either a register or memory location and the third source is aregister. If VEX.W is 1, the second source is a register and the third source is a register or memorylocation.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the subtraction.The results of the subtraction are rounded, as specified by the rounding mode in MXCSR.

The VFNMSUBPS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMSUBPS Negative Multiply and Subtract PackedSingle-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMSUBPS xmm1, xmm2, xmm3/mem128, xmm4 C4 RXB.03 0.xsrc1.0.01 7C /r /is4

VFNMSUBPS ymm1, ymm2, ymm3/mem256, ymm4 C4 RXB.03 0.ysrc1.1.01 7C /r /is4

VFNMSUBPS xmm1, xmm2, xmm3, xmm4/mem128 C4 RXB.03 1.xsrc1.0.01 7C /r /is4

VFNMSUBPS ymm1, ymm2, ymm3, ymm4/mem256 C4 RXB.03 1.ysrc1.1.01 7C /r /is4

Page 106: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

106 VFNMSUBPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFNMSUBPD, VFNMSUBSD, VFNMSUBSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 192191 128

255 128

VEX.L=0

VEX.L=1

0s

VEX.L=1

mul

VEX.L=1

sub

rnd rndrnd

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/ymm/mem

src3 = mem/xmm/ymm

VFNMSUBPS

31329596

159160223224

sub

rnd

mul

rnd

mul

sub

mul

sub

rnd

sub

rnd

mul

subrnd

255 192191 128159160223224

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

255 192191 128159160223224

mul mul

sub

mul

sub

neg neg neg neg neg neg neg neg

127 6463 031329596

Page 107: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMSUBPS 107

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/–zero was multiplied by +/–infinity

X +infinity was added to –infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 108: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

108 VFNMSUBSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies the double-precision floating-point value in the low-order quadword of the first source bythe double-precision floating-point value in the low-order quadword of the second source, thensubtracts the double-precision floating-point value in the low-order quadword of the third source fromthe negated interim product.The low-order quadword result is written to the destination.

The VFNMSUBSD instruction requires four operands:

VFNMSUBSD dest, src1, src2, src3 dest = – (src1* src2) – src3

The first source is an XMM register.

If VEX.W is 0, the second source is either a register or 64-bit memory location and the third source isa register. If VEX.W is 1, the second source is a register and the third source is a register or 64-bitmemory location.

The destination is always an XMM register indicated by VEX.vvvv. All unaffected bits of thedestination XMM register (bits 64–127) and its corresponding YMM register (bits 128–255) arecleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the subtraction.The results of the subtraction are rounded, as specified by the rounding mode in MXCSR.

The VFNMSUBSD instruction is an FMA4 instruction. The presence of this instruction set is indicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMSUBSD Negative Multiply and Subtract ScalarDouble-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMSUBSD xmm1, xmm2, xmm3/mem64, xmm4 C4 RXB.03 0.xsrc1.0.01 7F /r /is4

VFNMSUBSD xmm1, xmm2, xmm3, xmm4/mem64 C4 RXB.03 1.xsrc1.0.01 7F /r /is4

Page 109: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMSUBSD 109

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VFNMSUBPD, VFNMSUBPS, VFNMSUBSS

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

127 64 63 0

127 64 63 0

255 128

127 64 63 0

0s

mul

sub

rnd

dest = xmm

src1 = xmm src2 = xmm | mem64

src3 = mem64 | xmm

VFNMSUBSD

0s

neg

Page 110: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

110 VFNMSUBSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/-zero was multiplied by +/- infinity

X +infinity was added to -infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 111: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMSUBSS 111

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the single-precision floating-point value in the low-order doubleword of the first source bythe single-precision floating-point value in the low-order doubleword of the second source, thensubtracts the single-precision floating-point value in the low-order doubleword of the third sourcefrom the negated product. The low-order doubleword result is written to the destination.

The VFNMSUBSS instruction requires four operands:

VFNMSUBSS dest, src1, src2, src3 dest = - (src1* src2) - src3

If VEX.W is 0, the second source is either a register or 32-bit memory location and the third source isa register. If VEX.W is 1, the second source is a register and the third source is a register or 32-bitmemory location.

The destination is always a XMM register indicated by VEX.vvvv. All unaffected bits of thedestination XMM register (bits 32–127) and its corresponding YMM register (bits 128–255) arecleared to zeros.

The intermediate products are not rounded; the infinitely precise products are used in the subtraction.The results of the subtraction are rounded, as specified by the rounding mode in MXCSR.

The VFNMSUBSS instruction is an FMA4 instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VFNMSUBSS Negative Multiply and Subtract ScalarSingle-Precision Floating-Point

Mnemonic Encoding

VEX RXB.mmmmm W.vvvv.L.pp Opcode

VFNMSUBSS xmm1, xmm2, xmm3/mem32, xmm4 C4 RXB.03 0.xsrc1.0.01 7E /r /is4

VFNMSUBSS xmm1, xmm2, xmm3, xmm4/mem32 C4 RXB.03 1.xsrc1.0.01 7E /r /is4

Page 112: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

112 VFNMSUBSS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VFNMSUBPD, VFNMSUBPS, VFNMSUBSD

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 128

0sdest = ymm

src1 = xmm src2 = xmm | mem32

src3 = mem32 | xmm

VFNMSUBSS

31329596

mul

rnd

127 6463 031329596

127 6463 031329596

sub

127 6463 031329596

0s0s0s

neg

Page 113: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFNMSUBSS 113

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X FMA4 instructions are only recognized in protected mode.

XThe FMA4 instructions are not supported, as indicated by ECX bit 16 of CPUID function 8000_0001h.

XThe operating-system XSAVE support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits (YMM and XMM) of XFEATURE_ENABLED_MASK were not both set.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE)

X A source operand was an SNaN value.

X +/–zero was multiplied by +/–infinity

X +infinity was added to –infinity

X –infinity was subtracted from –infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Overflow exception (OE) X A rounded result was too large to fit into the format of the destination operand.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Precision exception (PE) X A result could not be represented exactly in the

destination format.

Page 114: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

114 VFRCZPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Extracts the fractional portion of each double-precision floating-point value in a source register ormemory location and writes the resulting values in the corresponding elements of the destinationregister. The fractional results are precise.

If XOP.L is 0, the source is an XMM register or 128-bit memory location; If XOP.L is 1, the source is aYMM register or 256-bit memory location.

The destination is always either an XMM register or a YMM register, depending on the vector size, asdetermined by the value of XOP.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The rounding mode indicated in the MXCSR is ignored unless the input is an integer, a zero, or adenormal value that is coerced to zero by MXCSR.DAZ, in which case the sign of the resultant zero isa function of MXCSR.RC:

If the source value is QNaN, it is written to the destination with no exception generated. If the sourcevalue is infinity, the instruction returns an indefinite value when the invalid-operation exception (IE) ismasked. If the source value is an integer, the instruction returns zero. The sign of the instruction resultis the same as the input.

The VFRCZPD instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VFRCZPD Extract Fraction Packed Double-PrecisionFloating-Point

MXCSR.RC Result

Round down -0

Round to nearest +0

Round up +0

Round toward zero +0

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VFRCZPD xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 81 /r

VFRCZPD ymm1, ymm2/mem256 8F RXB.09 0.1111.1.00 81 /r

Page 115: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZPD 115

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

ROUNDPD, ROUNDPS, ROUNDSD, ROUNDSS, VFRCZPS, VFRCZSS, VFRCZSD

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 64 63 0

255 192 191 128

127 64 63 0255 128

255

192 191

128

VEX.L=0

VEX.L=1

0s

VEX.L=1

dest = xmm/ymm

src1 = xmm/mem128 | ymm/mem256

VFRCZPD

extract extract extract extract

Page 116: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

116 VFRCZPD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

X VEX.W was set to 1.

X VEX.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE) X A source operand was an SNaN value or infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Page 117: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZPS 117

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Extracts the fractional portion of each of the single-precision floating-point values in a source registeror memory location and writes the resulting values to the corresponding elements of the destinationregister. The fractional results are exact.

IfXOP.L is 0, the source is an XMM register or 128-bit memory location; If XOP.L is 1, the source is aYMM register or 256-bit memory location.

The destination is always an XMM register or a YMM register, depending on the vector size, asdetermined by the value of XOP.L. When the destination is a 128-bit XMM register, the upper 128 bitsof the corresponding YMM register are cleared to zeros.

The rounding mode indicated in the MXCSR is ignored unless the input is an integer, a zero, or adenormal value that is coerced to zero by MXCSR.DAZ, in which case the sign of the resultant zero isa function of MXCSR.RC:

If the source value is QNaN, it is written to the destination with no exception generated. If the sourcevalue is infinity, the instruction returns an indefinite value when the invalid-operation exception (IE) ismasked. If the source value is an integer, the instruction returns zero. The sign of the instruction resultis the same as the input.

The VFRCZPS instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VFRCZPS Extract Fraction Packed Single-PrecisionFloating-Point

MXCSR.RC Result

Round down -0

Round to nearest +0

Round up +0

Round toward zero +0

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VFRCZPS xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 80 /r

VFRCZPS ymm1, ymm2/mem256 8F RXB.09 0.1111.1.00 80 /r

Page 118: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

118 VFRCZPS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

ROUNDPD, ROUNDPS, ROUNDSD, ROUNDSS, VFRCZPD, VFRCZSS, VFRCZSD

rFLAGS Affected

None

MXCSR Flags Affected

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

127 6463 0

255 192191 128

255 128VEX.L=0

VEX.L=1

0s

VEX.L=1

dest = xmm | ymm

src1 = xmm/mem128 | ymm/mem256

VFRCZPS

31329596

159160223224

255 192191 128159160223224

extract extract

extract extract extract

extract extract

extract

127 6463 031329596

Page 119: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZPS 119

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

X VEX.W was set to 1.

X VEX.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE) X A source operand was an SNaN value or infinity

Denormalized-operand exception (DE) X A source operand was a denormal value.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Page 120: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

120 VFRCZSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Extracts the fractional portion of the double-precision floating-point value in the low-order quadwordof a XMM register or 64-bit memory location and writes the result in the low-order quadword of thedestination XMM register. The fractional results are precise.

When the result is written to the destination XMM register, the upper quadword of the destinationregister and the upper 128-bits of the corresponding YMM register are cleared to zeros.

The rounding mode indicated in the MXCSR is ignored unless the input is an integer, a zero, or adenormal value that is coerced to zero by MXCSR.DAZ, in which case the sign of the resultant zero isa function of MXCSR.RC:

If the source value is QNaN, it is written to the destination with no exception generated. If the sourcevalue is infinity, the instruction returns an indefinite value when the invalid-operation exception (IE) ismasked. If the source value is an integer, the instruction returns zero. The sign of the instruction resultis the same as the input.

The VFRCZSD instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VFRCZSD Extract Fraction Scalar Double-PrecisionFloating-Point

MXCSR.RC Result

Round down -0

Round to nearest +0

Round up +0

Round toward zero +0

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VFRCZSD xmm1, xmm2/mem64 8F RXB.09 0.1111.0.00 83 /r

Page 121: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZSD 121

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

ROUNDPD, ROUNDPS, ROUNDSD, ROUNDSS, VFRCZPS, VFRCZPD, VFRCZSS

rFLAGS Affected

None

127 64 63 0

127 64 63 0

255 128

0sdest = xmm

src1 = xmm | mem64

VFRCZSD

0s

extract

Page 122: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

122 VFRCZSD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

X VEX.W was set to 1.

X VEX.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE) X A source operand was an SNaN value or infinity

Page 123: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZSD 123

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Denormalized-operand exception (DE) X A source operand was a denormal value.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Exception RealVirtual8086 Protected Cause of Exception

Page 124: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

124 VFRCZSS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Extracts the fractional portion of the single-precision floating-point value in the low-order doublewordof an XMM register or 32-bit memory location and writes the result in the low-order doubleword in thedestination XMM register. The fractional results are precise.

When the result is written to the destination XMM register, the upper three doublewords of thedestination register and the upper 128-bits of the corresponding YMM register are cleared to zeros.

The upper 224 bits of the YMM destination register are cleared to zeros.

The rounding mode indicated in the MXCSR is ignored unless the input is an integer, a zero, or adenormal value that is coerced to zero by MXCSR.DAZ, in which case the sign of the resultant zero isa function of MXCSR.RC:

If the source value is QNaN, it is written to the destination with no exception generated. If the sourcevalue is infinity, the instruction returns an indefinite value when the invalid-operation exception (IE) ismasked. If the source value is an integer, the instruction returns zero. The sign of the instruction resultis the same as the input.

The VFRCZSS instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VFRCZSS Extract Fraction Scalar Single-PrecisionFloating Point

MXCSR.RC Result

Round down -0

Round to nearest +0

Round up +0

Round toward zero +0

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VFRCZSS xmm1, xmm2/mem32 8F RXB.09 0.1111.0.00 82 /r

Page 125: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZSS 125

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

ROUNDPD, ROUNDPS, ROUNDSD, ROUNDSS, VFRCZPS, VFRCZPD, VFRCZSD

rFLAGS Affected

None

127 6463 0

255 1280s

dest = xmm

src1 = xmm/mem32

VFRCZSS

31329596

extract

0s 0s 0s127 6463 031329596

Page 126: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

126 VFRCZSS Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

Exceptions

MM FZ RC PM UM OM ZM DM IM DAZ PE UE OE ZE DE IE

M M M

17 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Note: A flag that may be set to one or cleared to zero is M (modified). Unaffected flags are blank.

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT = 0.See SIMD Floating-Point Exceptions, below, for details.

X VEX.W was set to 1.

X VEX.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

SIMD Floating-Point Exception, #XF X

There was an unmasked SIMD floating-point exception while CR4.OSXMMEXCPT=1.See SIMD Floating-Point Exceptions, below, for details.

SIMD Floating-Point Exceptions

Invalid-operation exception (IE) X A source operand was an SNaN value or infinity

Page 127: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VFRCZSS 127

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Denormalized-operand exception (DE) X A source operand was a denormal value.

Underflow exception (UE) X A rounded result was too small to fit into the format of

the destination operand.

Exception RealVirtual8086 Protected Cause of Exception

Page 128: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

128 VPCMOV Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Moves bits of either the first source or the second source into their corresponding positions in thedestination, depending on the value of the corresponding selector bit in the selector. If the selector bitis set to 1, the corresponding bit in the first source is moved to the destination; otherwise, thecorresponding bit from the second source is moved to the destination.

This instruction directly implements the C-language ternary “?” operation on each of the source bits.

Arbitrary bit-granular predicates can be constructed by any number of methods, or loaded as constantsfrom memory. The VPCMOV instruction may use the results of any SSE instructions as the predicatein the selector. VPCMPEQB (VPCMPGTB), VPCMPEQW (VPCMPGTW), VPCMPEQD(VPCMPGTD) and VPCMPEQQ (VPCMPGTQ) compare bytes, words, doublewords, quadwordsand integers, respectively, and set the predicate in the destination register to masks of 1s and 0saccordingly. VCMPPS (VCMPSS) and VCMPPD (VCMPSD) compare word and doublewordfloating-point source values, respectively, and provide the predicate for the floating-point instructions.

The VPCMOV instruction requires four operands:

VPCMOV dest, src1, src2, selector

The vector size is determined by the value of VEX.L. All moves are 128 bits in length if XOP.L iscleared to 0 and 256 bits in length if XOP.L is set to 1. The sources are the same size as the destination.

The first source (src1) is always an XMM or YMM register specified by XOP.vvvv.

This instruction supports operand configuration using XOP.W. When XOP.W is 0, the second source(src2) is an XMM or YMM register or 128- or 256-bit memory location specified by MODRM.rm andthe selector is an XMM or YMM register specified by imm8[7:4]. When XOP.W is 1, the secondsource (src2) is an XMM or YMM register specified by imm8[7:4] and selector is an XMM or YMMregister or 128- or 256-bit memory location specified by MODRM.rm.

The destination (dest) is always either an XMM register or a YMM register, depending on the vectorsize, as determined by the value of VEX.L. When the destination is a 128-bit XMM register, the upper128 bits of the corresponding YMM register are cleared to zeros.

The VPCMOV instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCMOV Vector Conditional Moves

Page 129: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCMOV 129

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

)

Related Instructions

VPCOMUB, VPCOMUD, VPCOMUQ, VPCOMUW, VCMPPD, VCMPPS

rFLAGS Affected

None

MXCSR Flags Affected

None

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCMOV xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 A2 /r imm[7:4]

VPCMOV ymm1, ymm2, ymm3/mem256, ymm4 8F RXB.08 0.src1.1.00 A2 /r imm[7:4]

VPCMOV xmm1, xmm2, xmm3, xmm4/mem128 8F RXB.08 1.src1.0.00 A2 /r imm[7:4]

VPCMOV ymm1, ymm2, ymm3, ymm4/mem256 8F RXB.08 1.src1.1.00 A2 /r imm[7:4]

127 0

255 128

127 0

255 128

127 0255 128

255 128

VEX.L=0

127 0

255 128

VEX.L=1

0s

VEX.L=1 VEX.L=1

VEX.L=1

dest = xmm/ymm

src1 = xmm/ymm src2 = xmm/mem128 | ymm/mem256

src3 = mem/xmm/ymm

VPCMOV

select select

select select

selectorsselectors

Page 130: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

130 VPCMOV Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 131: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMB 131

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Compares corresponding packed signed bytes in the first and second sources and writes the result ofeach comparison in the corresponding byte of the destination. The result of each comparison is an 8-bitvalue of all 1s (TRUE) or all 0s (FALSE).

The VPCOMB instruction requires four operands:

VPCOMB dest, src1, src2, comp

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the comparisonresults are written to the destination XMM register, the upper 128 bits of the corresponding YMMregister are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv field and the second source(src2) is an XMM register or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as shown in Table 1. TheVPCOMPB instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMB instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMB Compare Vector Signed Bytes

Table 1. VPCOMB Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTB 0 Less Than

VPCOMLEB 1 Less Than or Equal

VPCOMGTB 2 Greater Than

VPCOMGEB 3 Greater Than or Equal

VPCOMNEQB 4 Equal

VPCOMNEQB 5 Not Equal

VPCOMFALSEB 6 False

VPCOMTRUEB 7 True

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMB xmm1, xmm2, xmm3/mem128, imm8 8F RXB.8 0.src1.0.00 CCh /r /imm8

Page 132: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

132 VPCOMB Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPCOMUB, VPCOMUW, VPCOMUD, VPCOMUQ, VPCOMW, VPCOMD, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

07153147 23637995

128255

39557187103111119127

0s

07153147 23637995 39557187103111119127

07153147 23637995 39557187103111119127

compare

compare

02

cond

VPCOMB

16 groups of all zeros or all ones

16 Comparisons

imm8

src1 = xmm2

src2 = xmm3/mem128

dest = xmm1

Page 133: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMB 133

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 134: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

134 VPCOMD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Compares corresponding packed signed doublewords in the first and second sources and writes theresult of each comparison in the corresponding doubleword of the destination. The result of eachcomparison is a 32-bit value of all 1s (TRUE) or all 0s (FALSE).

The VPCOMD instruction requires four operands:

VPCOMD dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the results of thecomparisons are written to the destination XMM register, the upper 128 bits of the correspondingYMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv field and the second source(src2) is an XMM register or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as shown in Table 2. TheVPCOMD instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMD instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMD Compare Vector Signed Doublewords

Table 2. VPCOMD Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTD 0 Less Than

VPCOMLED 1 Less Than or Equal

VPCOMGTD 2 Greater Than

VPCOMGED 3 Greater Than or Equal

VPCOMNEQD 4 Equal

VPCOMNEQD 5 Not Equal

VPCOMFALSED 6 False

VPCOMTRUED 7 True

Page 135: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMD 135

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPCOMUB, VPCOMUW, VPCOMUD, VPCOMUQ, VPCOMB, VPCOMW, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMD xmm1, xmm2, xmm3/mem128, imm8 8F RXB.8 0.src1.0.00 CE /r /imm8

031326395

128255

6496127

0s

0316395 326496127

0316395 3264127

compare

02

cond

VPCOMD

four groups of all zeros or all ones

compare

96

Four Comparisons

src1 = xmm2

dest = xmm1

imm8

src2 = xmm3/mem128

Page 136: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

136 VPCOMD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 137: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMQ 137

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Compares corresponding packed signed quadwords in the first and second sources and writes theresult of each comparison in the corresponding quadword of the destination. The result of eachcomparison is a 64-bit value of all 1s (TRUE) or all 0s (FALSE).

The VPCOMQ instruction requires four operands:

VPCOMQ dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the result is written tothe destination XMM register, the upper 128 bits of the corresponding YMM register are cleared tozeros.

The first source is an XMM register specified by the XOP.vvvv field and the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as shown in Table 3. TheVPCOMQ instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMQ instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMQ Compare Vector Signed Quadwords

Table 3. VPCOMQ Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTQ 0 Less Than

VPCOMLEQ 1 Less Than or Equal

VPCOMGTQ 2 Greater Than

VPCOMGEQ 3 Greater Than or Equal

VPCOMNEQQ 4 Equal

VPCOMNEQQ 5 Not Equal

VPCOMFALSEQ 6 False

VPCOMTRUEQ 7 True

Page 138: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

138 VPCOMQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPCOMUB, VPCOMUW, VPCOMUD, VPCOMUQ, VPCOMB, VPCOMW, VPCOMD

rFLAGS Affected

None

MXCSR Flags Affected

None

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMQ xmm1, xmm2/mem128, imm8 8F RXB.8 0.src1.0.00 CF /r imm8

63

12825564127

0s

06364127

6364127

compare

02

cond

VPCOMQ

two groups of all zeros or all ones

compare

src1 = xmm2

dest = xmm1

src2 = xmm3/mem128

imm8

0

all zeros or all ones all zeros or all ones0

Page 139: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMQ 139

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 140: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

140 VPCOMUB Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Compares corresponding packed unsigned bytes in the first and second sources and writes the result ofeach comparison in the corresponding byte of the destination. The result of each comparison is an 8-bitvalue of all 1s (TRUE) or all 0s (FALSE).

The VPCOMUB instruction requires four operands:

VPCOMUB dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the result is written tothe destination XMM register, the upper 128 bits of the corresponding YMM register are cleared tozeros.

The first source is an XMM register specified by the XOP.vvvv field and the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as shown in Table 4. TheVPCOMUB instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMUB instruction is an XOP instruction. The presence of this instruction set is indicated bya CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMUB Compare Vector Unsigned Bytes

Table 4. VPCOMUB Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTUB 0 Less Than

VPCOMLEUB 1 Less Than or Equal

VPCOMGTUB 2 Greater Than

VPCOMGEUB 3 Greater Than or Equal

VPCOMNEQUB 4 Equal

VPCOMNEQUB 5 Not Equal

VPCOMFALSEUB 6 False

VPCOMTRUEUB 7 True

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMUB xmm1, xmm2/mem128, imm8 8F RXB.8 0.src1.0.00 EC /r imm8

Page 141: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMUB 141

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPCOMUW, VPCOMUD, VPCOMUQ, VPCOMB, VPCOMW, VPCOMD, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

07153147 23637995

128255

39557187103111119127

0s

07153147 23637995 39557187103111119127

07153147 23637995 39557187103111119127

compare

compare

02

cond

VPCOMUB

16 groups of all zeros or all ones

16 Comparisons

imm8

src1 = xmm2

src2 = xmm3/mem128

dest = xmm1

Page 142: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

142 VPCOMUB Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 143: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMUD 143

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Compares corresponding packed unsigned doublewords in the first and second sources and writes theresult of each comparison in the corresponding doubleword of the destination. The result of eachcomparison is a 32-bit value of all 1s (TRUE) or all 0s (FALSE).

The VPCOMUD instruction requires four operands:

VPCOMUD dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the results are writtento the destination XMM register, the upper 128 bits of the corresponding YMM register are cleared tozeros.

The first source is an XMM register specified by the XOP.vvvv field and the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as shown Table 5. TheVPCOMUD instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMUD instruction is an XOP instruction. The presence of this instruction set is indicated bya CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMUD Compare Vector Unsigned Doublewords

Table 5. VPCOMUD Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTUD 0 Less Than

VPCOMLEUD 1 Less Than or Equal

VPCOMGTUD 2 Greater Than

VPCOMGEUD 3 Greater Than or Equal

VPCOMNEQUD 4 Equal

VPCOMNEQUD 5 Not Equal

VPCOMFALSEUD 6 False

VPCOMTRUEUD 7 True

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMUD xmm1, xmm2/mem128, imm8 8F RXB.8 0.src1.0.00 EEh /r imm8

Page 144: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

144 VPCOMUD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPCOMUB, VPCOMUW, VPCOMUQ, VPCOMB, VPCOMW, VPCOMD, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

031326395

128255

6496127

0s

0316395 326496127

0316395 3264127

compare

02

cond

VPCOMUD

four groups of all zeros or all ones

compare

96

Four Comparisons

scr1 = xmm2

dest = xmm1

src2 = xmm3/mem128

imm8

Page 145: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMUD 145

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 146: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

146 VPCOMUQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Compares corresponding packed unsigned quadwords in the first and second sources and writes theresult of each comparison in the corresponding quadword of the destination. The result of eachcomparison is a 64-bit value of all 1s (TRUE) or all 0s (FALSE).

The VPCOMUQ instruction requires four operands:

VPCOMUQ dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the results are writtento the destination XMM register, the upper 128 bits of the corresponding YMM register are cleared tozeros.

The first source is an XMM register specified by the XOP.vvvv field and the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as shown in Table 6. TheVPCOMUQ instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMUQ instruction is an XOP instruction. The presence of this instruction set is indicated bya CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMUQ Compare Vector Unsigned Quadwords

Table 6. VPCOMUQ Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTUQ 0 Less Than

VPCOMLEUQ 1 Less Than or Equal

VPCOMGTUQ 2 Greater Than

VPCOMGEUQ 3 Greater Than or Equal

VPCOMNEQUQ 4 Equal

VPCOMNEQUQ 5 Not Equal

VPCOMFALSEUQ 6 False

VPCOMTRUEUQ 7 True

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMUQ xmm1, xmm2/mem128, imm8 8F RXB.8 0.src1.0.00 EF /r imm8

Page 147: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMUQ 147

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPCOMUB, VPCOMUW, VPCOMUD, VPCOMB, VPCOMW, VPCOMD, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

63

128255

64127

0s

06364127

6364127

compare

02

cond

VPCOMUQ

two groups of all zeros or all ones

compare

src1 = xmm2

dest = xmm1

src2 = xmm3/mem128

imm8

0

all zeros or all ones all zeros or all ones0

Page 148: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

148 VPCOMUQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 149: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMUW 149

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Compares corresponding packed unsigned words in the first and second sources and writes the resultof each comparison in the corresponding word of the destination. The result of each comparison is a16-bit value of all 1s (TRUE) or all 0s (FALSE).

The VPCOMUW instruction requires four operands:

VPCOMUW dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the results are writtento the destination XMM register, the upper 128 bits of the corresponding YMM register are cleared tozeros.

The first source is an XMM register specified by the XOP.vvvv field and the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as defined in Table 7. TheVPCOMUW instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMUW instruction is an XOP instruction. The presence of this instruction set is indicated bya CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMUW Compare Vector Unsigned Words

Table 7. VPCOMUW Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTUW 0 Less Than

VPCOMLEUW 1 Less Than or Equal

VPCOMGTUW 2 Greater Than

VPCOMGEUW 3 Greater Than or Equal

VPCOMNEQUW 4 Equal

VPCOMNEQUW 5 Not Equal

VPCOMFALSEUW 6 False

VPCOMTRUEUW 7 True

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMB xmm1, xmm2/mem128, imm8 8F RXB.8 0.src1.0.00 ED /r imm8

Page 150: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

150 VPCOMUW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPCOMUB, VPCOMUD, VPCOMUQ, VPCOMB, VPCOMW, VPCOMD, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

0153147 16637995

128255

3248648096111112127

0s

015316395 32648096111112127

0153147 16637995 3248648096111112127

compare

02

cond

VPCOMUW

8 groups of all zeros or all ones

8 Comparisons

imm8

src1 = xmm2

src2 = xmm3/mem128

dest = xmm1

474879 16

compare

Page 151: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMUW 151

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 152: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

152 VPCOMW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Compares corresponding packed signed words in the first and second sources and writes the result ofeach comparison in the corresponding word of the destination. The result of each comparison is a 16-bit value of all 1s (TRUE) or all 0s (FALSE).

The VPCOMW instruction requires four operands:

VPCOMW dest, src1, src2, comp

The destination is an XMM register addressed by the MODRM.reg field. When the results are writtento the destination XMM register, the upper 128 bits of the corresponding YMM register are cleared tozeros.

The first source is an XMM register specified by XOP.vvvv and second source is an XMM register or128-bit memory location specified by the MODRM.rm field.

The comp type is specified by the three low-order bits of an immediate-byte, as defined in Table 8. TheVPCOMW instruction with an appropriate value of imm8 is aliased to the following mnemonics tofacilitate coding.

The VPCOMW instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPCOMW Compare Vector Signed Words

Table 8. VPCOMW Comparison Operations

Mnemonic Implied Value of imm8Comparison

Operation

VPCOMLTW 0 Less Than

VPCOMLEW 1 Less Than or Equal

VPCOMGTW 2 Greater Than

VPCOMGEW 3 Greater Than or Equal

VPCOMNEQW 4 Equal

VPCOMNEQW 5 Not Equal

VPCOMFALSEW 6 False

VPCOMTRUEW 7 True

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPCOMW xmm1, xmm2/mem128, imm8 8F RXB.8 0.src1.0.00 CD /r imm8

Page 153: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPCOMW 153

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPCOMUB, VPCOMUW, VPCOMUD, VPCOMUQ, VPCOMB, VPCOMD, VPCOMQ

rFLAGS Affected

None

MXCSR Flags Affected

None

0153147 16637995 3248648096111112127

015316395 32648096111112127

0153147 16637995 3248648096111112127

compare

02

cond

VPCOMW

8 groups of all zeros or all ones

8 Comparisons

imm8

src1 = xmm2

src2 = xmm3/mem128

dest = xmm1

474879 16

compare

1282550s

Page 154: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

154 VPCOMW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 155: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDBD 155

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds four successive 8-bit signed integer values from the source and packs the sign-extended results ofthe additions in the corresponding doubleword in the destination.

This instruction takes two operands:

VPHADDBD dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHADDBD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDBW, VPHADDBQ, VPHADDWD, VPHADDWQ, VPHADDDQ

rFLAGS Affected

None

VPHADDBD Packed Horizontal Add Signed Byte to SignedDoubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDBD xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 C2 /r

07153147 23637995 39557187103111119127

0316395

128255

127

0’s

add add

src = xmm2mem128

dest = xmm1

VPHADDBD

add

96 64 32

add add

add

add add

add

add add

add

Page 156: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

156 VPHADDBD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 157: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDBQ 157

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds eight successive 8-bit signed integer values from the source and packs the sign-extended resultsof the additions in the corresponding quadword in the destination.

This instruction takes two operands:

VPHADDBQ dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHADDBQ instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

Related Instructions

VPHADDBW, VPHADDBD, VPHADDWD, VPHADDWQ, VPHADDDQ

VPHADDBQ Packed Horizontal Add Signed Byte to SignedQuadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDBQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 C3 /r

07153147 23637995 39557187103111119127

063

128255

127

0’s

add add

src = xmm2/mem128

dest = xmm1

VPHADDBQ

add

64

add add

add

add

add add

add

add add

add

add

Page 158: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

158 VPHADDBQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

rFLAGS Affected

None

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 159: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDBW 159

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds each adjacent pair of 8-bit signed integer values from the source and packs the sign-extended 16-bit integer result of each addition in the corrresponding word element of the destination.

This instruction takes two operands:

VPHADDBW dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination XMM register is written, the upper 128 bits are cleared to zeros.

The PHADDBW instruction is an XOP instruction. The presence of this instruction set is indicated bya CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDBD, VPHADDBQ, VPHADDWD, VPHADDWQ, VPHADDDQ

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHADDBW Packed Horizontal Add Signed Byte to SignedWord

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDBW xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 C1 /r

VPHADDBW

add

07153147 23637995128 39557187103111119127

0153147637995

128255

111127

0s

add add add add add add add

dest = xmm1

src = xmm2mem128

Page 160: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

160 VPHADDBW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 161: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDDQ 161

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds each adjacent pair of signed doubleword integer values in the source and packs the sign-extendedsums of each additions in the corresponding quadword in the destination register.

This instruction takes two operands:

VPHADDDQ dest, src

The source is an XMM register or 128-bit memory location and the destination is an XMM register. .When the destination XMM register is written, the upper 128 bits of the corresponding YMM registerare cleared to zeros.

The VPHADDDQ instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDBW, VPHADDBD, VPHADDBQ, VPHADDWD, VPHADDWQ

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHADDDQ Packed Horizontal Add Signed Doubleword toSigned Quadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDDQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 CB /r

095 63127 64 313296

063127 64

128255

add add

0s

src = xmm2/mem128

dest = xmm1

VPHADDDQ

Page 162: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

162 VPHADDDQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 163: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDUBD 163

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds four successive 8-bit unsigned integer values from the source and packs the results of theadditions in the corresponding doubleword in the destination.

This instruction takes two operands:

VPHADDUBD dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHADDUBD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDUBW, VPHADDUBQ, VPHADDUWD, VPHADDUWQ, VPHADDUDQ

rFLAGS Affected

None

VPHADDUBD Packed Horizontal Add Unsigned Byte toDoubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDUBD ymm1, ymm2/mem128 8F RXB.09 0.1111.0.00 D2 /r

VPHADDUBD

07153147 23637995 39557187103111119127

0316395

128255

127

0s

add add

src = xmm2/mem128

dest = xmm1

add

96 64 32

add add

add

add add

add

add add

add

Page 164: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

164 VPHADDUBD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 165: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDUBQ 165

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds eight successive 8-bit unsigned integer values from the second source and packs the results of theadditions in the corresponding quadword in the destination.

This instruction takes two operands:

VPHADDUBQ dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination XMM register is written, the upper 128 bits of the corresponding YMM registerare cleared to zeros.

The PHADDUBQ instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDUBW, VPHADDUBD, VPHADDUWD, VPHADDUWQ, VPHADDUDQ

VPHADDUBQ Packed Horizontal Add Unsigned Byte toQuadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDUBQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 D3 /r

PHADDUBQ

07153147 23637995 39557187103111119127

063

128255

127

0s

add add

src = xmm2/mem128

dest = xmm1

add

64

add add

add

add

add add

add

add add

add

add

Page 166: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

166 VPHADDUBQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

rFLAGS Affected

None

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 167: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDUBW 167

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds each adjacent pair of 8-bit unsigned integer values from the source and packs the 16-bit integerresults of each addition in the corresponding word in the destination.

This instruction takes two operands:

VPHADDUBW dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination XMM register is written, the upper 128 bits of the corresponding YMM registerare cleared to zeros.

The VPHADDUBW instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDUBD, VPHADDUBQ, VPHADDUWD, VPHADDUWQ, VPHADDUDQ

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHADDUBW Packed Horizontal Add Unsigned Byte to Word

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDUBWD xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 D1 /r

VPHADDUBW

add

07153147 23637995 39557187103111119127

0153147637995

128255

111127

0s

add add add add add add add

dest = xmm1

src = xmm2/mem128

Page 168: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

168 VPHADDUBW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 169: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDUDQ 169

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds each adjacent pair of 32-bit unsigned integer values from the source and packs the results of eachaddition in the corresponding quadword in the destination.

This instruction takes two operands:

VPHADDUDQ dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHADDUDQ instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDUBW, VPHADDUBD, VPHADDUBQ, VPHADDUWD, VPHADDUWQ

rFLAGS Affected

None

VPHADDUDQ Packed Horizontal Add Unsigned Doubleword toQuadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDUDQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 D8 /r

VPHADDDQ095 63127 64 313296

063127 64

128255

add add

0s

src = xmm2/mem128

dest = xmm1

Page 170: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

170 VPHADDUDQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 171: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDUWD 171

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds each adjacent pair of 16-bit unsigned integer values from the source and packs the results of eachaddition in the corresponding doubleword in the destination.

This instruction takes two operands:

VPHADDUWD dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHADDUWD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

Related Instructions

VPHADDUBW, VPHADDUBD, VPHADDUBQ, VPHADDUWQ, VPHADDUDQ

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHADDUWD Packed Horizontal Add Unsigned Word toDoubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDUWD xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 D6 /r

PHADDUWD

0111 95 63127 161564 3132484780 7996112

128255095 63127 64 313296

add add add add

src = xmm2/mem128

dest = xmm10s

Page 172: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

172 VPHADDUWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 173: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDUWQ 173

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds four successive 16-bit unsigned integer values from the source and packs the results of theadditions in the corresponding quadword element in the destination.

This instruction takes two operands:

VPHADDUWQ dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHADDUWQ instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDUBW, VPHADDUBD, VPHADDUBQ, VPHADDUWD, VPHADDUDQ

rFLAGS Affected

None

VPHADDUWQ Packed Horizontal Add Unsigned Word toQuadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDUWQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 D7 /r

095 63127 64 313296

063127 64128255

add add

0s

dest = xmm2/mem128

dest = xmm1

VPHADDDQ

Page 174: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

174 VPHADDUWQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 175: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDWD 175

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds each adjacent pair of 16-bit signed integer values from the source and packs the sign-extendedresults of the addition in the corresponding doubleword in the destination).

This instruction takes two operands:

VPHADDWD dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination XMM register is written, the upper 128 bits or the corresponding YMM registerare cleared to zeros.

The VPHADDWD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDBW, VPHADDBD, VPHADDBQ, VPHADDWQ, VPHADDDQ

rFLAGS Affected

None

VPHADDWD Packed Horizontal Add Signed Word to SignedDoubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDWD ymm1, ymm2/mem128 8F RXB.09 0.1111.0.00 C6 /r

0111 95 63127 161564 3132484780 7996112

128255095 63127 64 313296

add add add add

src = xmm2/mem128

dest = xmm1

PHADDWD

0s

Page 176: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

176 VPHADDWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 177: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHADDWQ 177

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Adds four successive 16-bit signed integer values from the second source and packs the sign-extendedresults of each addition in the corresponding quadword in the destination.

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination XMM register is written, the upper 128 bits of the corresponding YMM registerare cleared to zeroes.

The VPHADDWQ instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

Related Instructions

VPHADDBW, VPHADDBD, VPHADDBQ, VPHADDWD, VPHADDDQ

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHADDWQ Packed Horizontal Add Signed Word to SignedQuadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHADDWQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 D7 /r

0111 95 63127 161564 3132484780 7996112

128255 063127

add

src = xmm2/mem128

dest = xmm1

64

add

add add

add

add

VPHADDWD

0s

Page 178: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

178 VPHADDWQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 179: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHSUBBW 179

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Subtracts the most significant signed integer byte from the least significant signed integer byte of eachword element in the source and packs the sign-extended 16-bit integer results of each subtraction in thedestination.

This instruction takes two operands:

VPHSUBBW dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHSUBBW instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

Related Instructions

VPHSUBWD, VPHSUBDQ

rFLAGS Affected

None

VPHSUBBW Packed Horizontal Subtract Signed Byte toSigned Word

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHSUBBW xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 E1 /r

VPHSUBBW

subtract

07153147 23637995 39557187103111119127

0153147637995128255

111127

0s

src = xmm2/mem128

dest = xmm1

subtract subtract subtract

subtract subtract

subtract subtract

Page 180: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

180 VPHSUBBW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR FLAGS Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 181: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHSUBDQ 181

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Subtracts the most significant signed integer doubleword from the least significant signed integerdoubleword of each quadword in the source and packs the sign-extended 64-bit integer result of eachsubtraction in the corresonding quadword element of the destination.

This instruction takes two operands:

VPHSUBDQ dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHSUBDQ instruction is an XOP instruction. The presence of this instruction set is indicated bya CPUID feature bit. (See the CPUID Specification, order# 25481.

Related Instructions

VPHSUBBW, VPHSUBWD

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHSUBDQ Packed Horizontal Subtract Signed Doubleword toSigned Quadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHSUBDQ xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 E3 /r

095 63127 64 313296

063127 64128255

subtract

0s

src = xmm2/mem128

dest = xmm1

VPHSUBDQ

subtract

Page 182: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

182 VPHSUBDQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 183: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPHSUBWD 183

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Subtracts the most significant signed integer word from the least significant signed integer word ofeach doubleword from the source and packs the sign-extended 32-bit integer result of each subtractionin the destination.

This instruction takes two operands:

VPHSUBWD dest, src

The destination is an XMM register and the source is an XMM register or 128-bit memory location.When the destination register is written, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The VPHSUBWD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

Related Instructions

VPHSUBBW, VPHSUBDQ

rFLAGS Affected

None

MXCSR FLAGS Affected

None

VPHSUBWD Packed Horizontal Subtract Signed Word toSigned Doubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPHSUBWD xmm1, xmm2/mem128 8F RXB.09 0.1111.0.00 E2 /r

0111 95 63127 161564 3132484780 7996112

128255095 63127 64 313296

src = xmm2/mem128

dest = xmm1

VPHSUBWD

subtract subtract subtract subtract

0s

Page 184: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

184 VPHSUBWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 185: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSDD 185

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies each packed 32-bit signed integer value in the first source by the corresponding packed 32-bit signed integer value in the second source, then adds the 64-bit signed integer product to thecorresponding packed 32-bit signed integer value in the third source. The four resulting 32-bit sumsare stored in the destination.

The VPMACSDD instruction requires four operands:

VPMACSDD dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the destinationregister is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When the third source designates the same XMM register as the destination, the XMM registerbehaves as an accumulator.

No saturation is performed on the sum. If the result of the multiplication causes non-zero values to beset in the upper 32 bits of the 64 bit product, they are ignored. If the result of the add overflows, thecarry is ignored (neither the overflow nor carry bit in rFLAGS is set). In both cases, only the signedlow-order 32 bits of the result are written to the destination.

The VPMACSDD instruction is an XOP instruction. The presence of this instruction set is indicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.

VPMACSDD Packed Multiply AccumulateSigned Doubleword to Signed Doubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSDD xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 9E /r /is4

Page 186: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

186 VPMACSDD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

VPMACSDD

127 6463 0

255 128VEX.L=0 0s

dest = xmm1/ymm

src1 = xmm2 src2 = xmm3/mem128

src3 = xmm4/ymm

31329596

mul

add add

mul

add

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

mul

add

mul

Page 187: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSDD 187

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 188: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

188 VPMACSDQH Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies the second 32-bit signed integer value of the first source by the second 32-bit signed integervalue in the second source, then adds the 64-bit signed integer product to the low-order 64-bit signedinteger value in the third source. Simultaneously, multiplies the fourth 32-bit signed integer value ofthe first source by the fourth 32-bit signed integer value in the second source, then adds the 64-bitsigned integer product to the second 64-bit signed integer value in the third source.The results arewritten to the destination register.

The VPMACSDQH instruction requires four operands:

VPMACSDQH dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the destinationregister is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv field; the second source (src2) isan XMM register or 128-bit memory location specified by the MODRM.rm field; and the third source(src3) is an XMM register specified by imm8[7:4].

When the third source designates the same XMM register as th destination register, the XMM registerbehaves as an accumulator.

No saturation is performed on the sum. If the result of the add overflows, the carry is ignored (neitherthe overflow nor carry bit in rFLAGS is set).

The VPMACSDQH instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMACSDQH Packed Multiply Accumulate Signed HighDoubleword to Signed Quadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSDQH xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 9F /r /is4

Page 189: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSDQH 189

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

63127

255064

127

0s dest = xmm1

src3 = xmm4095 63127 64 313296

095 63127 64 313296

multiply

063127 64

add

addmultiply

VPMACSDQH

src2 = xmm3/mem128

src1 = xmm2

Page 190: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

190 VPMACSDQH Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 191: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSDQL 191

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the low-order 32-bit signed integer value of the first source by the low-order 32-bit signedinteger value in the second source, then adds the 64-bit signed integer product to the low-order 64-bitsigned integer value in the third source. Simultaneously, multiplies the third 32-bit signed integer valueof the first source by the corresponding 32-bit signed integer value in the second source, then adds the64-bit signed integer product to the second 64-bit signed integer value in the third source. The resultsare written to the destination (register.

TheVPMACSDQL instruction requires four operands:

VPMACSDQL dest, src1, src2, src3 dest = src1* src2 + src3

The destination register is a YMM register addressed by the MODRM.reg field. When the destinationregister is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

No saturation is performed on the sum. If the result of the add overflows, the carry is ignored (neitherthe overflow nor carry bit in rFLAGS is set). Only the low-order 64 bits of each result are written in thedestination.

The VPMACSDQL instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMACSDQL Packed Multiply Accumulate Signed LowDoubleword to Signed Quadword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSDQL xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.8 0.src1.0.00 97 /r /is4

Page 192: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

192 VPMACSDQL Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

63127

255064

127

0s dest = xmm1

src3 = xmm4

095 63127 64 313296

095 63127 64 313296

multiply

063127 64

add

addmultiply

VPMACSDQL

src2 = xmm3/mem128

src1 = xmm2

Page 193: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSDQL 193

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 194: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

194 VPMACSSDD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed 32-bit signed integer value in the first source by the corresponding packed 32-bit signed integer value in the second source, then adds each 64-bit signed integer product to thecorresponding packed 32-bit signed integer value in the third source. The saturated results are writtento the destination register.

The VPMACSSDD instruction requires four operands:

VPMACSSDD dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the destination register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

Out of range results of the addition are saturated to fit into a signed 32-bit integer. For each packedvalue in the destination, if the value is larger than the largest signed 32-bit integer, it is saturated to7FFF_FFFFh, and if the value is smaller than the smallest signed 32-bit integer, it is saturated to8000_0000h.

The VPMACSSDD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMACSSDD Packed Multiply Accumulate Signed Doublewordto Signed Doubleword with Saturation

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSSDD xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 8E /r /is4

Page 195: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSDD 195

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

VPMACSSDD

127 6463 0

255 128VEX.L=0 0s

sat

dest = xmm1

src1 = xmm2 src2 = xmm3/mem128

src3 = xmm4/ymm

31329596

mul

add add

mul

add

255 192191 128159160223224

127 6463 031329596

127 6463 031329596

mul

add

mul

satsat

sat

Page 196: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

196 VPMACSSDD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 197: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSDQH 197

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the second 32-bit signed integer value of the first source by the second 32-bit signed integervalue in the second source, then adds the 64-bit signed integer product to the low-order 64-bit signedinteger value in the third source. Simultaneously, multiplies the fourth 32-bit signed integer value ofthe first source by the fourth 32-bit signed integer value in the second source, then adds the 64-bitsigned integer product to the high-order 64-bit signed integer value in the third source. The saturatedresults are written to the destination register.

The PMACSSDQH instruction requires four operands:

VPMACSSDQH dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the destination XMM register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

Out of range results of the addition are saturated to fit into a signed 64-bit integer. For each packed value in the destination, if the value is larger than the largest signed 64-bit integer, it is saturated to 7FFF_FFFF_FFFF_FFFFh, and if the value is smaller than the smallest signed 64-bit integer, it is saturated to 8000_0000_0000_0000h.

The VPMACSSDQH instruction is an XOP instruction. The presence of this instruction set is indicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMACSSDQH Packed Multiply Accumulate Signed HighDoubleword to Signed Quadword with Saturation

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSSDQH xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 8F /r is4

Page 198: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

198 VPMACSSDQH Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

63127

255064

127

0s dest = xmm1

src3 = xmm4095 63127 64 313296

095 63127 64 313296

063127 64

multiply

VPMACSSDQH

src2 = xmm3/mem128

src1 = xmm2

saturate saturate

add

add

multiply

Page 199: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSDQH 199

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 200: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

200 VPMACSSDQL Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies the low-order 32-bit signed integer value of the first source by the low-order 32-bit signedinteger value in the second source, then adds the 64-bit signed integer product to the low-order 64-bitsigned integer value in the third source. Simultaneously, multiplies the third 32-bit signed integer valueof the first source by the third 32-bit signed integer value in the second source, then adds the 64-bitsigned integer product to the high-order 64-bit signed integer value in the third source. The saturatedresults are written to the destination register.

The VPMACSSDQL instruction requires four operands:

VPMACSSDQL dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) register is an XMM register addressed by the MODRM.reg field. When the destination register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

Out of range results of the addition are saturated to fit into a signed 64-bit integer. For each packed value in the destination, if the value is larger than the largest signed 64-bit integer, it is saturated to 7FFF_FFFF_FFFF_FFFFh, and if the value is smaller than the smallest signed 64-bit integer, it is saturated to 8000_0000_0000_0000h.

The VPMACSSDQL instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

VPMACSSDQL Packed Multiply Accumulate Signed LowDoubleword to Signed Quadword with Saturation

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

PMACSSDQL xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 87 /r /is4

Page 201: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSDQL 201

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

63127

255064

128

0s dest = xmm1

src3 = xmm4095 63127 64 313296

095 63127 64 313296

multiply

063127 64

multiply

VPMACSSDQL

src2 = xmm3/mem128

src1 = xmm2

saturate saturate

add

add

Page 202: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

202 VPMACSSDQL Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 203: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSWD 203

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies the odd-numbered packed 16-bit signed integer values in the first source by thecorresponding packed 16-bit signed integer values in the second source, then adds the 32-bit signedinteger products to the corresponding packed 32-bit signed integer values in the third source. Thesaturated results are written to the destination register.

The VPMACSSWD instruction requires four operands:

VPMACSSWD dest, src1, src2, src3 dest = src1* src2 + src3

The destinationa (dest) is an XMM register addressed by the MODRM.reg field. When the destination XMM register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv field; the second source (src2) isan XMM register or 128-bit memory location specified by the MODRM.rm field; and the third source(src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

Out of range results of the addition are saturated to fit into a signed 32-bit integer. For each packedvalue in the destination, if the value is larger than the largest signed 32-bit integer, it is saturated to7FFF_FFFFh, and if the value is smaller than the smallest signed 32-bit integer, it is saturated to8000_0000h.

The VPMACSSWD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

VPMACSSWD Packed Multiply Accumulate Signed Word toSigned Doubleword with Saturation

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSSWD xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 86 /r /is4

Page 204: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

204 VPMACSSWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

src1 = xmm2

dest = xmm1

015

1631

3247

4863

6479

8095

96111

112127

multiply

multiply

multiply

0151631324748636479809596111112127

multiply

031

3263

6495

96127

add

add

add

add

255 1280s

031

3263

6495

96127

VPMACSSWD

src2 = xmm3/mem128

src3 = xmm4

saturatesaturatesaturate saturate

Page 205: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSWD 205

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 206: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

206 VPMACSSWW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed 16-bit signed integer value in the first source by its corresponding packed 16-bit signed integer value in the second source, then adds the 32-bit signed integer products to thecorresponding packed 16-bit signed integer value in the third source. The saturated results are writtento the destination register.

The VPMACSSWW instruction requires four operands:

VPMACSSWW dest, src1, src2, src3 dest = src1* src2 + src3

The destination register is an XMM register addressed by the MODRM.reg field. When the destination register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 and dest designate the same XMM register, this register behaves as an accumulator.

Out of range results of the addition are saturated to fit into a signed 16-bit integer. For each packedvalue in the destination, if the value is larger than the largest signed 16-bit integer, it is saturated to7FFFh, and if the value is smaller than the smallest signed 16-bit integer, it is saturated to 8000h.

The VPMACSSWW instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.

VPMACSSWW Packed Multiply Accumulate Signed Word toSigned Word with Saturation

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

PMACSSWW xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 85 /r /is4

Page 207: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSSWW 207

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL,VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

src1 = xmm2

src2 = xmm3/mem128

dest = xmm1

0151631324748636479809596111112127

multiply

multiply

multiply

multiply add

add

multiply

multiply

multiply

0151631324748636479809596111112127

multiply

add

add

add

add

add

015

1631

3247

4863

6479

8095

96111

112127

VPMACSSWW

add

multiply

0151631324748636479809596111112127255 128

0s

saturate saturate saturate saturatesaturate saturate saturate saturate

src3 = xmm4

Page 208: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

208 VPMACSSWW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 209: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSWD 209

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies each odd-numbered packed 16-bit signed integer value in the first source by thecorresponding packed 16-bit signed integer value in the second source, then adds the 32-bit signedinteger products to the corresponding packed 32-bit signed integer value in the third source. The fourresults are written to the destination register.

The VPMACSWD instruction requires four operands:

VPMACSWD dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) register is an XMM register addressed by the MODRM.reg field. When the destination XMM register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

If the result of the add overflows, the carry is ignored (neither the overflow nor carry bit in rFLAGS isset). Only the low-order 32 bits of the result are written in the destination.

The VPMACSWD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMACSWD Packed Multiply Accumulate Signed Word toSigned Doubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSWD xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 96 /r /is4

Page 210: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

210 VPMACSWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSSDD, VPMACSDO, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

src1 = xmm2

src3 = xmm/mem128

015

1631

3247

4863

6479

8095

96111

112127

multiply

multiply

multiply

0151631324748636479809596111112127

multiply

031

3263

6495

96127

add

add

add

add

031

3263

6495

96127

128255

0s

src4 = xmm

dest = xmm1

VPMACSWD

Page 211: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSWD 211

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 212: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

212 VPMACSWW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed 16-bit signed integer value in the first source by the corresponding packed 16-bit signed integer value in the second source, then adds each 32-bit signed integer product to thecorresponding packed 16-bit signed integer value in the third source. The eight results are written tothe destination register.

The VPMACSWW instruction requires four operands:

VPMACSWW dest, src1, src2, src3 dest = src1* src2 + src3

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the destination XMM register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source (src1) is an XMM register specified by the XOP.vvvv fields; the second source (src2)is an XMM register or 128-bit memory location specified by the MODRM.rm field; and the thirdsource (src3) is an XMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

No saturation is performed on the sum. If the result of the multipliplication causes non-zero values tobe set in the upper 16 bits of the 32 bit result, they are ignored. If the result of the add overflows, thecarry is ignored (neither the overflow nor carry bit in rFLAGS is set). In both cases, only the signedlow-order 16 bits of the result are written in the destination.

The VPMACSWW instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMACSWW Packed Multiply Accumulate Signed Word toSigned Word

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMACSWW xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 95 /r /is4

Page 213: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMACSWW 213

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPMACSSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

src1 = xmm src3 = xmm0

1516

3132

4748

6364

7980

9596

111112

127

multiply

multiply

multiply

multiply add

add

multiply

multiply

multiply

015

1631

3247

4863

6479

8095

96111

112127

multiply

add

add

add

add

add

add

015

1631

3247

4863

6479

8095

96111

112127

015

1631

3247

4863

6479

8095

96111

112127 src2 = xmm/mem128

dest = xmm

VPMACSWW

128255

0s

Page 214: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

214 VPMACSWW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 215: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMADCSSWD 215

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Multiplies each packed 16-bit signed integer value in the first source by the corresponding packed 16-bit signed integer value in the second source, then adds the 32-bit signed integer products of the even-odd adjacent words. Each resulting sum is then added to the corresponding packed 32-bit signedinteger value in the third source. The four results are written to the destination (accumulator) register.

The VPMADCSSWD instruction requires four operands:

VPMADCSSWD dest, src1, src2, src3 dest = src1* src2 + src3

The destination register is an XMM register addressed by the MODRM.reg field. When the destination register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source is an XMM register specified by the XOP.vvvv fields; the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field; and the third source is anXMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

Out of range results of the addition are saturated to fit into a signed 32-bit integer. For each packed value in the destination, if the value is larger than the largest signed 32-bit integer, it is saturated to 7FFF_FFFFh, and if the value is smaller than the smallest signed 32-bit integer, it is saturated to 8000_0000h.

The VPMADCSSWD instruction is an XOP instruction. The presence of this instruction set isindicated by a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMADCSSWD Packed Multiply, Add and Accumulate SignedWord to Signed Doubleword with Saturation

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPMADCSSWD xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 A6 /r /is4

Page 216: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

216 VPMADCSSWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

src1 = xmm2

src2 = xmm3/mem128

src3 = xmm40

1516

3132

4748

6364

7980

9596

111112

127

multiply

multiply

multiply

multiplyadd

multiply

multiply

multiply

015

1631

3247

4863

6479

8095

96111

112127

multiply

add

add

031

3263

6495

96127

saturatesaturatesaturatesaturate

add

031

3263

6495

96127

dest = xmm1128255

0s

VPMADCSSWD

add

add

add

add

Page 217: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMADCSSWD 217

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 218: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

218 VPMADCSWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Multiplies each packed 16-bit signed integer value in the first source by the corresponding packed 16-bit signed integer value in the second source, then adds the 32-bit signed integer products of the even-odd adjacent words together and adds their sum to the corresponding packed 32-bit signed integervalues in the third source. The four results are written to the destination register.

The VPMADCSWD instruction requires four operands:

VPMADCSWD dest, src1, src2, src3 dest = src1* src2 + src3

The destination register is an XMM register addressed by the MODRM.reg field. When the destination register is written, the upper 128 bits of the corresponding YMM register are cleared to zeros.

The first source is an XMM register specified by the XOP.vvvv fields, the second source is an XMMregister or 128-bit memory location specified by the MODRM.rm field; and the third source is anXMM register specified by imm8[7:4].

When src3 designates the same XMM register as the dest register, the XMM register behaves as anaccumulator.

No saturation is performed on the sum. If the result of the addition overflows, the carry is ignored(neither the overflow nor carry bit in rFLAGS is set). Only the signed 32-bits of the result are written tothe destination.

The VPMADCSWD instruction is an XOP instruction. The presence of this instruction set is indicatedby a CPUID feature bit. (See the CPUID Specification, order# 25481.)

VPMADCSWD Packed Multiply Add and Accumulate SignedWord to Signed Doubleword

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

PMADCSWD xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.08 0.src1.0.00 B6 /r /is4

Page 219: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPMADCSWD 219

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPMACSSWW, VPMACSWW, VPMACSSWD, VPMACSWD, VPMACSSDD, VPMACSDD, VPMACSSDQL, VPMACSSDQH, VPMACSDQL, VPMACSDQH, VPMADCSSWD

rFLAGS Affected

None

MXCSR Flags Affected

None

src1 = xmm2

src2 = xmm3/mem128

src3 = xmm40151631324748636479809596111112127

multiply

multiply

multiply

multiplyadd

multiply

multiply

multiply

015

1631

3247

4863

6479

8095

96111

112127

multiply

add

add

0313263649596127

add

031

3263

6495

96127

dest = xmm1128255

0s

VPMADCSWD

add

add

add

add

Page 220: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

220 VPMADCSWD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.W was set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 221: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPPERM 221

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Selects 16 of the 32-packed bytes in the two sources and optionally applies a logical transformation toeach selected byte before it is stored to its specified position in the destination XMM register.

The VPPERM instruction requires four operands:

VPPERM dest, src1, src2, selector

The 32-byte source consists of the concatenation of the second source (src2) and the first source (src1).The third source operand (src3) contains control bytes specifying the source byte and the logicaloperation to perform on each destination byte.

The src1 operand is always an XMM register specified by XOP.vvvv

This instruction supports operand source configuration using XOP.W. When XOP.W is 0, src2 is anXMM register or 128-bit memory location specified by MODRM.rm and selector is an XMM registerspecified by imm8[7:4]. When XOP.W is 1, src2 is an XMM register specified by imm8[7:4] andselector is an XMM register or 128-bit memory location specified by MODRM.rm.

The destination (dest) is always an XMM register specified by MODRM.reg. When the result operandis written to the dest XMM register, the upper 128 bits of the corresponding YMM register are clearedto zeros.

For each byte of the 16-byte result, the corresponding selector byte is used as follows:

• Bits 4:0 of the selector selects the source byte to move from the 32 bytes from src2:src1.

• Bits 7:5 of the selector selects the logical operation to perform on the selected operand.

VPPERM Packed Permute Bytes

Page 222: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

222 VPPERM Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Table 2-3. VPPERM Control Byte

TheVPPERM instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

Bits Description

7:5 Op - Defines the logical operation performed on the selected operand.

OP Operation

000 Source byte (no logical operation)

001 Invert source byte

010 Bit reverse of source byte

011 Bit reverse of inverted source byte

100 00h

101 FFh

110 Most significant bit of source byte replicated in all bit positions.

111 Invert most significant bit of source byte and replicate in all bit positions.

4:0 Source Selector

Selector Source Selected Selector Source Selected

00000 src1[7:0] 10000 src2[7:0]

00001 src1[15:8] 10001 src2[15:8]

00010 src1[23:16] 10010 src2[23:16]

00011 src1[31:24] 10011 src2[31:24]

00100 src1[39:32] 10100 src2[39:32]

00101 src1[47:40] 10101 src2[47:40]

00110 src1[55:48] 10110 src2[55:48]

00111 src1[63:56] 10111 src2[63:56]

01000 src1[71:64] 11000 src2[71:64]

01001 src1[79:72] 11001 src2[79:72]

01010 src1[87:80] 11010 src2[87:80]

01011 src1[95:88] 11011 src2[95:88]

01100 src1[103:96] 11100 src2[103:96]

01101 src1[111:104] 11101 src2[111:104]

01110 src1[119:112] 11110 src2[119:112]

01111 src1[127:120] 11111 src2[127:120]

Page 223: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPPERM 223

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Actionfor (i=0; i<16; i=++) dest[i]:= control[i].op (src1|src2)control[i].src_sel;

Related Instructions

VPSHUFHW, VPSHUFD, VPSHUFLW, VPSHUFW, VPERMPS, VPERMPD

rFLAGS Affected

None

MXCSR Flags Affected

None

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPPERM xmm1, xmm2, xmm3, xmm4/mem128 8F RXB.8 1.src1.0.00 A3 /r is4

VPPERM xmm1, xmm2, xmm3/mem128, xmm4 8F RXB.8 0.src1.0.00 A3 /r is4

015 14 1 0 15 14 1

015 14 1

src2

src1

selector

dest127

logical

... ...

mux

logical

src_sel 1F 1E 11 10 0F 0E 01 00

mux..... ...

255 128 1

0s

... ... ... ...

Page 224: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

224 VPPERM Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC XAn unaligned memory reference was performed while alignment checking was enabled while MXCSR.MM=1.

Page 225: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPROTB 225

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Rotates each byte of the source by the amount specified in the signed value of the corresponding countbyte and writes the result in the corresponding byte of the destination.

There are two versions of the instruction, depending on the source of the count byte used for each 8-bitshift:

• VPROTB dest, src, fixed-count• VPROTB dest, src, variable-count-src

The destination (dest) operand of both versions of this instruction is an XMM register addressed by theMODRM.reg field. When the result of the rotation is written to the destination XMM register, theupper 128 bits of the corresponding YMM register are cleared to zeros.

The fixed-count version of this instruction rotates each byte element of the source (src) by the numberof bits specified by the immediate fixed-count byte. All byte elements of the source are rotated by thesame number of bits. The source is a 128-bit XMM register or memory location addressed by theMODRM.rm field.

The variable-count-src version of this instruction rotates each byte of the source by the amountspecified in the corresponding byte element in the variable-count-src, which is an XMM register or128-bit memory location.

The src and variable-count-src are configurable through XOP.W. If XOP.W is 0, the variable-count-src is an XMM register specified by XOP.vvvv and the src operand is an XMM register or 128-bitmemory location specified by MODRM.rm. If XOP.W is 1, the variable-count-src is an XMMregister or 128-bit memory location specified by MODRM.rm and the src operand is a XMM registerspecified by XOP.vvvv.

If the count value is positive, bits are rotated to the left (toward the more significant bit positions). Thebits rotated out left of the most significant bit are rotated back in at the right end (least-significant bit)of the byte.

If the count value is negative, bits are rotated to the right (toward the least significant bit positions).The bits rotated to the right out of the least significant bit are rotated back in at the left end (most-significant bit) of the byte.

The VPROTB instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPROTB Packed Rotate Bytes

Mnemonic

Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPROTB xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 90 /r

VPROTB xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 90 /r

VPROTB xmm1, xmm2, imm8 8F RXB.08 0.1111.0.00 C0 /r /ib

Page 226: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

226 VPROTB Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPROTW, VPROTD, VPROTQ,VPSHLB, VPSHLW, VPSHLD, VPSHLQ, VPSHAB, VPSHAW,VPSHAD, VPSHAQ

rFLAGS Affected

None

imm8

127 0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

dest = xmm

src1127 0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

rotate

rotate

16 rotates

… … … … … … … … … … … … … … … … …

src2 = 16 count bytes

0

dest = xmm

count

127 0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

127 0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

rotate

rotate

16 rotates

… … … … … … … … … … … … … … … … …

… … … … … … … … … … … … … … … … …

src1

7

256 128

0s

count count

256 128

0s

VPROTB

xmm if VEX.W = 1xmm/mem128 if VEX.W = 0

xmm/mem128 if VEX.W = 0mem128 if VEX.W = 1

Page 227: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPROTB 227

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b for immediate count form of instruction (opcode C0h).

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 228: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

228 VPROTD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Rotates each of the four doublewords of the source operand by the amount specified in the signedvalue of the corresponding count byte and writes the result in the corresponding doubleword of thedestination.

There are two variants of this instruction, depending on the source of the count byte used for each doubleword shift:

• VPROTD dest, src, fixed-count• VPROTD dest, src, variable-count

The dest operand of both versions of this instruction is an XMM register addressed by theMODRM.reg field. When the 128-bit result operand is written to the dest register, the upper 128 bits ofthe corresponding YMM register are cleared to zeros.

The fixed count version of this instruction rotates each doubleword of the source operand by thenumber of bits specified by the immediate fixed-count byte operand. All doubleword elements of thesource operand are rotated by the same number of bits. The src is anXMM register or memory locationaddressed by the MODRM.rm field.

The variable count version of this instruction rotates each doubleword of the source by the amountspecified in the low order byte of the corresponding doubleword of the variable-count operand vector.

The src and variable-count operand vector are configurable through XOP.W. If XOP.W is 0, the src isan XMM register or 128-bit memory location specified by the MODRM.rm field and the variable-count operand vector is an XMM register specified by XOP.vvvv. If XOP.W is 1, the src operand is anXMM register specified by XOP.vvvv and the variable-count operand is an XMM register or 128-bitmemory location specified by the MODRM.rm field.

If the count value is positive, bits are rotated to the left (toward the more significant bit positions). Thebits rotated out to the left of the most significant bit of each source doubleword operand are rotatedback in at the right end (least-significant bit) of the doubleword.

If the count value is negative, bits are rotated to the right (toward the least significant bit positions).The bits rotated to the right out of the least significant bit of each source doubleword operand arerotated back in at the left end (most-significant bit) of the doubleword.

The VPROTD instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPROTD Packed Rotate Doublewords

Page 229: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPROTD 229

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPROTB, VPROTW, VPROTQ, VPSHLB, VPSHLW, VPSHLD, VPSHLQ, VPSHAB, VPSHAW,VPSHAD, VPSHAQ

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPROTD xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 92 /r

VPROTD xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 92 /r

VPROTD xmm1, xmm2/mem128, imm8 8F RXB.08 0.1111.0.00 C2 /ib

countimm8

xmm/mem128127 6463 0

255 1280s

dest = xmm

31329596

rotate

rotate

rotate

rotate

127 6463 031329596

count

src2 = variable count127 6463 0

255 1280s

dest = xmm

xmm/mem128 if VEX.W = 031329596 127 6463 031329596

rotate

rotate

rotate

rotate

127 6463 031329596

count

count

count

count

mem128 if VEX.W = 1xmm if VEX.W = 1xmm/mem128 if VEX.W = 0

VPROTD

count

count

count

src1

src1

Page 230: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

230 VPROTD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b for immediate count form of instruction (opcode C2h).

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 231: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPROTQ 231

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Rotates each of the quadwords of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding quadword of the destination.

There are two variants of this instruction, depending on the source of the count byte used for each quadword shift:

• VPROTQ dest, src, fixed-count• VPROTQ dest, src, variable-count

The dest operand of both versions of this instruction is an XMM register addressed by theMODRM.reg field. When the 128-bit result is written to the dest XMM register, the upper 128 bits ofthe corresponding YMM register are cleared to zeros.

The fixed count version of this instruction rotates each quadword in the source by the number of bitsspecified by the immediate fixed-count byte operand. All quadword elements of the source are rotatedby the same number of bits. The src is a 128-bit XMM register or memory location addressed by theMODRM.rm field.

The variable count version of this instruction rotates each quadword of the source by the amountspecified in the low order byte of the corresponding quadword of the variable-count operand.

The src and variable-count are configurable through XOP.W. If XOP.W is 0, the src is an XMMregister or 128-bit memory location specified by MODRM.rm and the count is an XMM registerspecified by XOP.vvvv. If XOP.W is 1, src is an XMM register specified by XOP.vvvv and thevariable-count is an XMM register or 128-bit memory location specified by MODRM.rm.

If the count value is positive, bits are rotated to the left (toward the more significant bit positions) of theoperand element. The bits rotated out to the left of the most significant bit of the word element arerotated back in at the right end (least-significant bit).

If the count value is negative, operand element bits are rotated to the right (toward the least significantbit positions). The bits rotated to the right out of the least significant bit are rotated back in at the leftend (most-significant bit) of the word element.

The VPROTQ instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPROTQ Packed Rotate Quadwords

Page 232: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

232 VPROTQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

PROTB, PROTW, PROTD, PSHLB, PSHLW, PSHLD, PSHLQ, PSHAB, PSHAW, PSHAD, PSHAQ

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPROTQ xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 93 /r

VPROTQ xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 93 /r

VPROTQ xmm1, xmm2/mem128, imm8 8F RXB.08 0.1111.0.00 C3 /ib

VPROTQ

countimm8

xmm/mem128127 6463 0

255 1280s

dest = xmm

rotate

rotate

127 6463 0

count

count

src1

src2 = variable count127 6463 0

255 1280s

dest = xmm

xmm/mem128 if VEX.W = 0127 6463 0

rotate

rotate

127 64 63 0

count

count

mem128 if VEX.W = 1xmm if VEX.W = 1xmm/mem128 if VEX.W = 0

src1

Page 233: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPROTQ 233

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b for immediate count form of instruction (opcode C3h).

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 234: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

234 VPROTW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Rotates each of the eight words of the source operand by the amount specified in the signed value ofthe corresponding count byte and writes the result in the corresponding word of the destination.

There are two variants of this instruction, depending on the source of the count byte used for each word shift:

• VPROTW dest, src, fixed-count• VPROTW dest, src, variable-count

The dest operand of both versions of this instruction is a YMM register addressed by the MODRM.regfield. When the 128-bit result operand is written to the dest XMM register, the upper 128 bits of thecorresponding YMM register are cleared to zeros.

The fixed count version of this instruction rotates each word of the source operand by the number ofbits specified by the immediate fixed-count byte operand. All word elements of the source operand arerotated by the same number of bits. The src operand is a 128-bit YMM register or memory locationaddressed by the MODRM.rm field.

The variable count version of this instruction rotates each word of the source operand by the amountspecified in the low order byte of the corresponding word of the variable-count operand.

The src and count operands are configurable through XOP.W. If XOP.W is 0, the src operand is anXMM register or 128-bit memory location specified by MODRM.rm and the count operand is anXMM register specified by XOP.vvvv. If XOP.W is 1, the src operand is an XMM register specified byXOP.vvvv and the variable-count operand is an XMM register or 128-bit memory location specifiedby MODRM.rm.

If the count value is positive, bits are rotated to the left (toward the more significant bit positions) . Thebits rotated out to the left of the most significant bit of an element are rotated back in at the right end(least-significant bit) of the word element.

If the count value is negative, bits are rotated to the right (toward the least significant bit positions) ofthe element. The bits rotated to the right out of the least significant bit of an element are rotated back inat the left end (most-significant bit) of the word element.

The PROTW instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPROTW Packed Rotate Words

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPROTW xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 91 /r

VPROTW xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 91 /r

VPROTW xmm1, xmm2/mem128, imm8 8F RXB.08 0.1111.0.00 C1 /r /ib

Page 235: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPROTW 235

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

PROTB, PROTD, PROTQ, PSHLB, PSHLW, PSHLD, PSHLQ, PSHAB, PSHAW, PSHAD, PSHAQ

rFLAGS Affected

None

127 0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

src1

015

1631

3247

4863

6479

8095

96111

112127

dest

015

1631

3247

4863

6479

8095

96111

112127

255 128

rotate

count count

count count

count count

count

count

src2(xmm/mem)

(xmm)

(xmm)

rotaterotate

rotaterotate

rotaterotate

rotate

src1

015

1631

3247

4863

6479

8095

96111

112127

dest015

1631

3247

4863

6479

8095

96111

112127

255 128

rotate

(xmm)

(xmm)

rotaterotate

rotaterotate

rotaterotate

rotate

0 7

count countimm8

0s

0s

VPROTW

Page 236: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

236 VPROTW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

X XOP.vvvv was not 1111b for immediate count form of instruction (opcode C1h).

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 237: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHAB 237

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Shifts each signed byte of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding byte of the destination.

The count byte for each 8-bit shift is an 8-bit signed two's-complement value in the corresponding byteelement of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the byte.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions). Themost significant bit (sign bit) is replicated and shifted in at the left end (most-significant bit) of thebyte.

The VPSHAB instruction requires three operands:

VPSHAB dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the results arewritten to the destination XMM register, the upper 128 bits of the corresponding YMM register arecleared to zeros.

If XOP.W is 0, the count is an XMM register specified by XOP.vvvv and the src is an XMM register or128-bit memory location specified by MODRM.rm. If XOP.W is 1, the count is an XMM register or128-bit memory location specified by MODRM.rm and the src operand is an XMM register specifiedby XOP.vvvv.

The VPSHAB instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHAB Packed Shift Arithmetic Bytes

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHAB xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 98 /r

VPSHAB xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 98 /r

Page 238: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

238 VPSHAB Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLB, VPSHLW, VPSHLD, VPSHLQ, VPSHAW,VPSHAD, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

src

0s

127

127

127

255

00

0128

shift

shift

16 count bytes

count

count

VPSHAB

Page 239: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHAB 239

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Exception RealVirtual8086 Protected Cause of Exception

Page 240: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

240 VPSHAD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Shifts each of the four signed doublewords of the source operand by the amount specified in the signedvalue of the corresponding count byte and writes the result in the corresponding doubleword of thedestination.

The count byte for each doubleword shift is an 8-bit signed two's-complement value located in the low-order byte of the corresponding doubleword element of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the doubleword.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions). Themost significant bit (sign bit) is replicated and shifted in at the left end (most-significant bit) of thedoubleword.

The VPSHAD instruction requires three operands:

VPSHAD dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the 128-bitresult is written to the dest XMM register, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count is an XMM registerspecified by XOP.vvvv and the src is an XMM register or memory location specified by MODRM.rm.If XOP.W is 1, the count is an XMM register or memory location specified by MODRM.rm and the srcis an XMM register specified by XOP.vvvv.

The VPSHAD instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHAD Packed Shift Arithmetic Doublewords

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHAD xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 9A /r

VPSHAD xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 9A /r

Page 241: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHAD 241

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLB, VPSHLW, VPSHLD, VPSHLQ, VPSHAB,VPSHAW, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

0 7 32 39 64 71 96 103

src = xmm/mem

031326364

9596127

dest = xmm

0313263649596127

shift

shift

shiftshift

count

count

count

count

count = xmm/mem127

255 128

VPSHAD

0s

Page 242: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

242 VPSHAD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Exception RealVirtual8086 Protected Cause of Exception

Page 243: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference PSHAQ 243

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Shifts the two quadwords of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding quadword of the destination.

The count byte for each quadword shift is an 8-bit signed two's-complement value located in the low-order byte of the corresponding quadword element of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the quadword.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions). Themost significant bit is replicated and shifted in at the left end (most-significant bit) of the quadword.

The shift amount is stored in two’s-complement form. The count is modulo 64.

The VPSHAQ instruction requires three operands:

VPSHAQ dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the 128-bitresult operand is written to the dest XMM register, the upper 128 bits of the corresponding YMMregister are cleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count is a 128-bit XMMregister specified by XOP.vvvv and the src is a 128-bit XMM register or memory location specified byMODRM.rm. If XOP.W is 1, the count is a 128-bit XMM register or memory location specified byMODRM.rm and the src is a 128-bit XMM register specified by XOP.vvvv.

The VPSHAQ instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHAQ Packed Shift Arithmetic Quadwords

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHAQ xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 9B /r

VPSHAQ xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 9B /r

Page 244: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

244 PSHAQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLB, VPSHLW, VPSHLD, VPSHLQ, VPSHAB,VPSHAW, VPSHAD

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

127 0 7 64 71

src106364127

dest06364127255 128

shift

shift

count

count

count(xmm/mem)

(xmm)

(ymm)0s

Page 245: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference PSHAQ 245

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enable.

Exception RealVirtual8086 Protected Cause of Exception

Page 246: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

246 VPSHAW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Shifts each of the eight words of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding signed word of the destination.

The count byte for each word shift is an 8-bit signed two's-complement value located in the low-orderbyte of the corresponding word element of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the word.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions). Themost significant bit (signed bit) is replicated and shifted in at the left end (most-significant bit) of theword.

The shift amount is stored in two’s-complement form. The count is modulo 16.

The VPSHAW instruction requires three operands:

VPSHAW dest, src, count

The destination (dest) is a YMM register addressed by the MODRM.reg field. When the 128-bit resultoperand is written to the destination XMM register, the upper 128 bits of the corresponding YMMregister are cleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count is a 128-bit XMMregister specified by XOP.vvvv and the src operand is a 128-bit XMM register or memory locationspecified by MODRM.rm. If XOP.W is 1, the count operand is a 128-bit XMM register or memorylocation specified by MODRM.rm and the src operand is a 128-bit XMM register specified byXOP.vvvv.

The VPSHAW instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHAW Packed Shift Arithmetic Words

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHAW xmm1, xmm2/mem128, xmm3 8F RXB.09 0.cnt.0.00 99 /r

VPSHAW xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 99 /r

Page 247: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHAW 247

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLB, VPSHLW, VPSHLD, VPSHLQ, VPSHAB,VPSHAD, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

127 0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

src1015

1631

3247

4863

6479

8095

96111

112127

dest015

1631

3247

4863

6479

8095

96111

112127128

shiftshift

shiftshift

shiftshift

shiftshift

count count

count count

count count

count

count

count(xmm/mem)

(xmm)

(ymm)0s

Page 248: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

248 VPSHAW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Exception RealVirtual8086 Protected Cause of Exception

Page 249: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHLB 249

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Shifts each byte of the source operand by the amount specified in the signed value of the correspondingcount byte and writes the result in the corresponding byte of the destination.

The count byte for each byte shift is an 8-bit signed two's-complement value located in the thecorresponding byte element of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the byte.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions).Zeros are shifted in at the left end (most-significant bit) of the byte.

The VPSHLB instruction requires three operands:

VPSHLB dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the 128-bitresult is written to the destination XMM register, the upper 128 bits of the corresponding YMMregister are cleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count is a 128-bit XMMregister specified by XOP.vvvv and the src is a 128-bit XMM register or memory location specified byMODRM.rm. If XOP.W is 1, the count is a 128-bit XMM register or memory location specified byMODRM.rm and the src is a 128-bit XMM register specified by XOP.vvvv.

The VPSHLB instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHLB Packed Shift Logical Bytes

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHLB xmm1, xmm2/mem128, xmm3 8F RXB.9 0.cnt.0.00 94 /r

VPSHLB xmm1, xmm2, xmm3/mem128 8F RXB.9 1.src.0.00 94 /r

Page 250: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

250 VPSHLB Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLW, VPSHLD, VPSHLQ, VPSHAB, VPSHAW,VPSHAD, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

src

count

127 0

127 0

dest 0127

……16 counts…

shift shift

16 shifts

Page 251: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHLB 251

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 252: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

252 VPSHLD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Shifts each doubleword of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding doubleword of the destination.

The count byte for each doubleword shift is an 8-bit signed two's-complement value located in the low-order byte of the corresponding doubleword element of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the doubleword.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions).Zeros are shifted in at the left end (most-significant bit) of the doubleword.

The shift amount is stored in two’s-complement form. The count is modulo 32.

The VPSHLD instruction requires three operands:

VPSHLD dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the 128-bitresult is written to the destination XMM register, the upper 128 bits of the corresponding YMMregister are cleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count is a 128-bit XMMregister specified by XOP.vvvv and the src is a 128-bit XMM register or memory location specified byMODRM.rm. If XOP.W is 1, the count is a 128-bit XMM register or memory location specified byMODRM.rm and the src operand is a 128-bit XMM register specified by XOP.vvvv.

The VPSHLD instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHLD Packed Shift Logical Doublewords

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHLD ymm1, xmm3/mem128, xmm2 8F RXB.09 0.cnt.0.00 96 /r

VPSHLD ymm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 96 /r

Page 253: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHLD 253

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLB, VPSHLW, VPSHLQ, VPSHAB, VPSHAW,VPSHAD, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

255 128

0 7 32 39 64 71 96 103

src10313263649596127

dest0313263649596127

shift

shift

shiftshift

count

count

count

count

count(xmm/mem)

(xmm)

(ymm)

127

0s

Page 254: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

254 VPSHLD Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Exception RealVirtual8086 Protected Cause of Exception

Page 255: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHLQ 255

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Shifts the two quadwords of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding quadword of the destination.

The count byte for each quadword shift is an 8-bit signed two's-complement value located in the low-order byte of the corresponding quadword element of the count operand.

Bit 6 of the count byte is ignored.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the quadword.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions).Zeros are shifted in at the left end (most-significant bit) of the quadword.

The VPSHLQ instruction requires three operands:

VPSHLQ dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the 128-bitresult is written to the dest YMM register, the upper 128 bits of the corresponding YMM register arecleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count operand is a 128-bitXMM register specified by XOP.vvvv and the src is a 128-bit XMM register or memory locationspecified by MODRM.rm. If XOP.W is 1, the count is a 128-bit XMM register or memory locationspecified by MODRM.rm and the src is a 128-bit XMM register specified by XOP.vvvv.

The VPSHLQ instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHLQ Packed Shift Logical Quadwords

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHLQ xmm1, xmm3/mem128, xmm2 8F RXB.09 0.cnt.0.00 97 /r

VPSHLQ xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 97 /r

Page 256: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

256 VPSHLQ Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Related Instructions

VPROTB, VPROTW, VPROTD, VPROTQ, VPSHLB, VPSHLW, VPSHLD, VPSHAB, VPSHAW,VPSHAD, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

127 0 7 64 71

src1063

64127

dest063

64127255 128

shift

shift

count

count

count(xmm/mem)

(xmm)

(ymm)0s

Page 257: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHLQ 257

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Exception RealVirtual8086 Protected Cause of Exception

Page 258: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

258 VPSHLW Instruction Reference

AMD64 Technology Documentation Updates 43479—3.03—May 2009

Shifts each of the eight words of the source operand by the amount specified in the signed value of thecorresponding count byte and writes the result in the corresponding word of the destination.

The count byte for each word shift is an 8-bit signed two's-complement value located in the low-orderbyte of the corresponding word element of the count operand.

If the count value is positive, bits are shifted to the left (toward the more significant bit positions).Zeros are shifted in at the right end (least-significant bit) of the word.

If the count value is negative, bits are shifted to the right (toward the least significant bit positions).Zeros are shifted in at the left end (most-significant bit) of the word.

The VPSHLW instruction requires three operands:

VPSHLW dest, src, count

The destination (dest) is an XMM register addressed by the MODRM.reg field. When the 128-bitresult is written to the destination XMM register, the upper 128 bits of the corresponding YMMregister are cleared to zeros.

The src and count are configurable through XOP.W. If XOP.W is 0, the count operand is a 128-bitXMM register specified by XOP.vvvv and the src is a 128-bit XMM register or memory locationspecified by MODRM.rm. If XOP.W is 1, the count is a 128-bit XMM register or memory locationspecified by MODRM.rm and the src is a 128-bit XMM register specified by XOP.vvvv.

The VPSHLW instruction is an XOP instruction. The presence of this instruction set is indicated by aCPUID feature bit. (See the CPUID Specification, order# 25481.)

VPSHLW Packed Shift Logical Words

Mnemonic Encoding

XOP RXB.mmmmm W.vvvv.L.pp Opcode

VPSHLW xmm1, xmm3/mem128, xmm2 8F RXB.09 0.cnt.0.00 95 /r

VPSHLW xmm1, xmm2, xmm3/mem128 8F RXB.09 1.src.0.00 95 /r

Page 259: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

Instruction Reference VPSHLW 259

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

Related Instructions

VPROTB, VPROLW, VPROTD, VPROTQ, VPSHLB, VPSHLD, VPSHLQ, VPSHAB, VPSHAW,VPSHAD, VPSHAQ

rFLAGS Affected

None

MXCSR Flags Affected

None

0 7 16 32 23 39 48 55 64 71 80 87 96 103 112 119

src1015

1631

3247

4863

6479

8095

96111

112127

dest015

1631

3247

4863

6479

8095

96111

112127255 128

shiftshift

shiftshift

shiftshift

shiftshift

count count

count count

count count

count

count

src2(ymm/mem)

(ymm)

(ymm)0s

Page 260: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

260 AMD XOP, FMA4 and CVT16 Instructions

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

Exceptions

Exception RealVirtual8086 Protected Cause of Exception

Invalid opcode, #UD

X X XOP instructions are only recognized in protected mode.

X The XOP instructions are not supported, as indicated by ECX bit 11 of CPUID function 8000_0001h.

X The emulate bit (EM) of CR0 was set to 1.

XThe operating-system XSAVE/XRSTOR support bit (OSXSAVE) of CR4 was cleared to 0, as indicated by ECX bit 27 of CPUID function 0000_0001h.

XThe operating-system YMM support bits XFEATURE_ENABED_MASK[2:1] were were not both set to 1.

X XOP.L was set to 1.

Device not available, #NM X The task-switch bit (TS) of CR0 was set to 1.

Stack, #SS X A memory address exceeded the stack segment limit or was non-canonical.

General protection, #GP X A memory address exceeded a data segment limit or

was non-canonical.

X A null data segment was used to reference memory.

Page fault, #PF X A page fault resulted from the execution of the instruction.

Alignment Check, #AC X An unaligned memory reference was performed while alignment checking was enabled.

Page 261: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

261

43479—Rev. 3.03—May 2009 AMD64 Technology Documentation Updates

AMD Confidential-Advance Information

Index

Numerics

16-bit mode............................................................. 1032-bit mode............................................................. 1064-bit mode............................................................. 11

A

addressingRIP-relative.......................................................... 16

B

biased exponent ....................................................... 11

C

commit ................................................................... 11compatibility mode .................................................. 11

D

direct referencing..................................................... 11displacements .......................................................... 12double quadword ..................................................... 12doubleword ............................................................. 12

E

eAX–eSP register .................................................... 17effective address size................................................ 12effective operand size ............................................... 12eFLAGS register...................................................... 18eIP register .............................................................. 18element ................................................................... 12endian order ............................................................ 20exceptions ............................................................... 12exponent ................................................................. 11

F

flush ....................................................................... 13

I

IGN ........................................................................ 13indirect ................................................................... 13

L

legacy mode ............................................................ 13legacy x86............................................................... 13long mode ............................................................... 13LSB........................................................................ 14lsb .......................................................................... 14

M

mask ....................................................................... 14MBZ....................................................................... 14modes

16-bit ................................................................... 1032-bit ................................................................... 1064-bit ................................................................... 11compatibility ........................................................ 11legacy .................................................................. 13long ..................................................................... 13protected .............................................................. 15real ...................................................................... 15virtual-8086.......................................................... 17

moffset.................................................................... 14MSB ....................................................................... 14msb......................................................................... 14MSR ....................................................................... 18

O

octword ................................................................... 14offset....................................................................... 14overflow.................................................................. 15

P

packed..................................................................... 15protected mode ........................................................ 15

Q

quadword ................................................................ 15

R

r8–r15 ..................................................................... 18rAX–rSP ................................................................. 19RAZ........................................................................ 15real address mode. See real modereal mode ................................................................ 15registers

eAX–eSP ............................................................. 17eFLAGS............................................................... 18eIP....................................................................... 18r8–r15.................................................................. 18rAX–rSP .............................................................. 19rFLAGS............................................................... 19rIP ....................................................................... 19

relative .................................................................... 15reserved................................................................... 15rFLAGS register ...................................................... 19rIP register............................................................... 19RIP-relative addressing............................................. 16

Page 262: AMD64 Architecture Programmer's Manual Volume 6: 128-Bit

262

AMD64 Technology Documentation Updates 43479—Rev. 3.03—May 2009

AMD Confidential-Advance Information

S

set........................................................................... 16SSE ........................................................................ 16SSE-2 ..................................................................... 16SSE3 ...................................................................... 16sticky bits................................................................ 16

T

TSS ........................................................................ 16

U

underflow................................................................ 16

V

VCVTPH2PS .......................................................... 42VCVTPS2PH .......................................................... 45vector...................................................................... 16VFMADDPD .......................................................... 48VFMADDPS........................................................... 52VFMADDSD .......................................................... 56VFMADDSS..................................................... 59, 99VFMADDSUBPD ................................................... 62VFMADDSUBPS.................................................... 66VFMSUBADDPD ................................................... 70VFMSUBADDPS.................................................... 74VFMSUBPD........................................................... 78VFMSUBPS............................................................ 81VFMSUBSD........................................................... 84VFMSUBSS............................................................ 87VFNMADDPD........................................................ 90VFNMADDPS ........................................................ 93VFNMADDSD........................................................ 96VFNMSUBPD ...................................................... 102VFNMSUBPS....................................................... 105VFNMSUBSD ...................................................... 108VFNMSUBSS....................................................... 111VFRCZPD ............................................................ 114VFRCZPS............................................................. 117VFRCZSD ............................................................ 120VFRCZSS............................................................. 124virtual-8086 mode.................................................... 17VPCMOV ............................................................. 127VPCOMB ...................................................... 130, 133VPCOMQ ............................................................. 136VPCOMUB........................................................... 139VPCOMUD ................................................... 139, 142VPCOMUQ .......................................................... 145VPCOMUW................................................... 145, 148VPCOMW ............................................................ 151VPHADDBD ........................................................ 154VPHADDBQ ........................................................ 156

VPHADDBW........................................................ 158VPHADDDQ ........................................................ 160PHADDUBD......................................................... 162VPHADDUBQ ...................................................... 164VPHADDUBW ..................................................... 166VPHADDUDQ...................................................... 168VPHADDUWD ..................................................... 170VPHADDUWQ ..................................................... 172VPHADDWD........................................................ 174VPHADDWQ........................................................ 176VPHSUBBW......................................................... 178VPHSUBDQ ......................................................... 180VPHSUBWD ........................................................ 182VPMACSDD......................................................... 184VPMACSDQH ...................................................... 187VPMACSDQL....................................................... 190VPMACSSDD....................................................... 193VPMACSSDQL .................................................... 199VPMACSSQH....................................................... 196VPMACSSWD...................................................... 202VPMACSSWW ..................................................... 205VPMACSWD........................................................ 208VPMACSWW ....................................................... 211VPMADCSSWD ................................................... 214VPMADCSWD ..................................................... 217VPPERM .............................................................. 220VPROTB............................................................... 224VPROTD............................................................... 227VPROTQ............................................................... 230VPROTW.............................................................. 233VPSHAB .............................................................. 236VPSHAD .............................................................. 239VPSHAQ .............................................................. 242VPSHAW.............................................................. 245VPSHLB............................................................... 248VPSHLD............................................................... 251VPSHLQ............................................................... 254VPSHLW .............................................................. 257