Download presentation
Presentation is loading. Please wait.
Published by芙 花 Modified over 5 years ago
1
Other Processors Having learnt MIPS, we can learn other major processors. Not going to be able to cover everything; will pick on the interesting aspects.
2
ARM Advanced RISC Machine
The major processor for mobile and embedded electronics, like iPad Simple, low power, low cost
3
ARM One of the most interesting features is the conditional execution.
That is, an instruction will execute if some condition is true, otherwise it will not do anything (turned into a nop).
4
ARM A set of flags, showing the relation of two numbers : gt, equal, lt. cmp Ri, Rj # set the flags depending on the values in Ri and Rj subgt Ri, Ri, Rj # i = i – j if flag is gt sublt Ri, Ri, Rj # i = i – j if flag is lt bne Label # goto Label if flag is not equal
5
ARM How to implement while (i != j) { if (i > j) i -= j; else
}
6
ARM In MIPS, assume i is in $s0, j in $s1: Loop: beq $s0, $s1, Done
slt $t0, $s0, $s1 beq $t0, $0, L1 sub $s0, $s0, $s1 j Loop L1: sub $s1, $s1, $s0 L2: j Loop
7
ARM In ARM, Loop: cmp Ri, Rj subgt Ri, Ri, Rj sublt Rj, Rj, Ri
bne Loop
8
ARM Discussion: Given the MIPS hardware setup, can we support conditional execution?
9
Introduction to Intel IA-32 and IA-64 Instruction Set Architectures
10
History 5/4/2019 9/27/2007 11:23:26 PM week06-3.ppt
CDA3100 week06-3.ppt
11
Recent Intel Processors
5/4/2019 Recent Intel Processors The Intel® Pentium® 4 Processor Family ( ) The Intel® Xeon® Processor ( ) The Intel® Pentium® M Processor (2003-Current) The Intel® Pentium® Processor Extreme Edition ( ) The Intel® Core™ Duo and Intel® Core™ Solo Processors (2006-Current) The Intel® Xeon® Processor 5100 Series and Intel® Core™2 Processor Family (2006-Current) 9/27/ :23:26 PM week06-3.ppt CDA3100 week06-3.ppt
12
History 5/4/2019 9/27/2007 11:23:27 PM week06-3.ppt
CDA3100 week06-3.ppt
13
Recent Intel Processors
5/4/2019 Recent Intel Processors 9/27/ :23:27 PM week06-3.ppt CDA3100 week06-3.ppt
14
Intel Core 2 Duo Processors
5/4/2019 Intel Core 2 Duo Processors 9/27/ :23:28 PM week06-3.ppt CDA3100 week06-3.ppt
15
Intel Core 2 Quad Processors
5/4/2019 Intel Core 2 Quad Processors 9/27/ :23:28 PM week06-3.ppt CDA3100 week06-3.ppt
16
Bit and Byte Ordering 5/4/2019 9/27/2007 11:23:29 PM week06-3.ppt
CDA3100 week06-3.ppt
17
Intel Assembly Each instruction is represented by
5/4/2019 Intel Assembly Each instruction is represented by Where label presents the line A mnemonic is a reserved name for a class of instruction opcodes which have the same function. The operands argument1, argument2, and argument3 are optional. There may be from zero to three operands, depending on the instruction 9/27/ :23:29 PM week06-3.ppt CDA3100 week06-3.ppt
18
Memory Modes 5/4/2019 9/27/2007 11:23:30 PM week06-3.ppt
CDA3100 week06-3.ppt
19
Addressing The processors use byte addressing
5/4/2019 Addressing The processors use byte addressing Intel processors support segmented addressing Each address is specified by a segment register and byte address within the segment 9/27/ :23:30 PM week06-3.ppt CDA3100 week06-3.ppt
20
5/4/2019 9/27/ :23:30 PM week06-3.ppt CDA3100 week06-3.ppt
21
Intel Registers 5/4/2019 9/27/2007 11:23:31 PM week06-3.ppt
CDA3100 week06-3.ppt
22
Basic Program Execution Registers
5/4/2019 Basic Program Execution Registers General purpose registers There are eight registers (note that they are not quite general purpose as some instructions assume certain registers) Segment registers They define up to six segment selectors EIP register – Effective instruction pointer EFLAGS – Program status and control register 9/27/ :23:31 PM week06-3.ppt CDA3100 week06-3.ppt
23
General Purpose and Segment Registers
5/4/2019 General Purpose and Segment Registers 9/27/ :23:32 PM week06-3.ppt CDA3100 week06-3.ppt
24
General Purpose Registers
5/4/2019 General Purpose Registers EAX — Accumulator for operands and results data EBX — Pointer to data in the DS segment ECX — Counter for string and loop operations EDX — I/O pointer ESI — Pointer to data in the segment pointed to by the DS register; source pointer for string operations EDI — Pointer to data (or destination) in the segment pointed to by the ES register; destination pointer for string operations ESP — Stack pointer (in the SS segment) EBP — Pointer to data on the stack (in the SS segment) CDA3100 week06-3.ppt
25
Alternative General Purpose Register Names
5/4/2019 Alternative General Purpose Register Names CDA3100 week06-3.ppt
26
5/4/2019 Registers in IA-64 CDA3100 week06-3.ppt
27
5/4/2019 Segment Registers CDA3100 week06-3.ppt
28
Operand Addressing Immediate addressing Register addressing
5/4/2019 Operand Addressing Immediate addressing Maximum value allowed varies among instructions and it can be 8-bit, 16-bit, or 32-bit Register addressing Register addressing depends on the mode (IA-32 or IA-64) CDA3100 week06-3.ppt
29
5/4/2019 Register Addressing CDA3100 week06-3.ppt
30
Memory Operand Memory operand is specified by a segment and offset
5/4/2019 Memory Operand Memory operand is specified by a segment and offset CDA3100 week06-3.ppt
31
Offset Displacement - An 8-, 16-, or 32-bit value.
5/4/2019 Offset Displacement - An 8-, 16-, or 32-bit value. Base - The value in a general-purpose register. Index — The value in a general-purpose register. Scale factor — A value of 2, 4, or 8 that is multiplied by the index value. CDA3100 week06-3.ppt
32
5/4/2019 Effective Address CDA3100 week06-3.ppt
33
Effective Address Common combinations Displacement Base
5/4/2019 Effective Address Common combinations Displacement Base Base + displacement (Index * scale) + displacement Base + index + displacement Base + (Index * scale) + displacement CDA3100 week06-3.ppt
34
Addressing Mode Encoding
5/4/2019 Addressing Mode Encoding CDA3100 week06-3.ppt
35
Fundamental Data Types
5/4/2019 Fundamental Data Types CDA3100 week06-3.ppt
36
5/4/2019 Example CDA3100 week06-3.ppt
37
Pointer Data Types Near pointer Far pointer 5/4/2019
CDA3100 week06-3.ppt
38
5/4/2019 128-Bit SIMD Data Types CDA3100 week06-3.ppt
39
5/4/2019 BCD Integers Intel also supports BCD integers, where each digit (0-9) is represented by 4 bits CDA3100 week06-3.ppt
40
Floating Point Numbers
5/4/2019 Floating Point Numbers CDA3100 week06-3.ppt
41
General Purpose Instructions
5/4/2019 General Purpose Instructions Data transfer instructions CDA3100 week06-3.ppt
42
Data Transfer Instructions
5/4/2019 Data Transfer Instructions CDA3100 week06-3.ppt
43
Data Transfer Instructions
5/4/2019 Data Transfer Instructions CDA3100 week06-3.ppt
44
Binary Arithmetic Instructions
5/4/2019 Binary Arithmetic Instructions CDA3100 week06-3.ppt
45
Decimal Arithmetic Instructions
5/4/2019 Decimal Arithmetic Instructions CDA3100 week06-3.ppt
46
5/4/2019 Logical Instructions CDA3100 week06-3.ppt
47
Shift and Rotate Instructions
5/4/2019 Shift and Rotate Instructions CDA3100 week06-3.ppt
48
Bit and Byte Instructions
5/4/2019 Bit and Byte Instructions CDA3100 week06-3.ppt
49
Bit and Byte Instructions
5/4/2019 Bit and Byte Instructions CDA3100 week06-3.ppt
50
Control Transfer Instructions
5/4/2019 Control Transfer Instructions CDA3100 week06-3.ppt
51
5/4/2019 CDA3100 week06-3.ppt
52
5/4/2019 String Instructions CDA3100 week06-3.ppt
53
5/4/2019 I/O Instructions These instructions move data between the processor’s I/O ports and a register or memory CDA3100 week06-3.ppt
54
Enter and Leave Instructions
5/4/2019 Enter and Leave Instructions These instructions provide machine-language support for procedure calls in block structured languages CDA3100 week06-3.ppt
55
Segment Register Instructions
5/4/2019 Segment Register Instructions The segment register instructions allow far pointers (segment addresses) to be loaded into the segment registers CDA3100 week06-3.ppt
56
5/4/2019 Procedure Call Types The processor supports procedure calls in the following two different ways: CALL and RET instructions. ENTER and LEAVE instructions, in conjunction with the CALL and RET instructions CDA3100 week06-3.ppt
57
5/4/2019 Stack CDA3100 week06-3.ppt
58
Calling Procedures Using CALL and RET
5/4/2019 Calling Procedures Using CALL and RET Near call (within the current code segment) Near return CDA3100 week06-3.ppt
59
Far Call and Far Return Far call Far return 5/4/2019
CDA3100 week06-3.ppt
60
Stack During Call and Return
5/4/2019 Stack During Call and Return CDA3100 week06-3.ppt
61
Parameter Passing Passing parameters on the stack
5/4/2019 Parameter Passing Passing parameters through the general-purpose registers Can pass up to six parameters by copying the parameters to the general-purpose registers Passing parameters on the stack Stack can be used to pass a large number of parameters and also return a large number of values Passing parameters in an argument list Place the parameters in an argument list A pointer to the argument list can then be passed to the called procedure CDA3100 week06-3.ppt
62
Saving Procedure State Information
5/4/2019 Saving Procedure State Information The processor does not save general purpose registers A calling procedure should explicitly save the values in any of the general-purpose registers that it will need when it resumes execution after a return One can use PUSHA and POPA to save and restore all the general purpose registers (except ESP) CDA3100 week06-3.ppt
63
Calls to Other Privilege Levels
5/4/2019 Calls to Other Privilege Levels CDA3100 week06-3.ppt
64
Stack For Calling and Called Procedure
5/4/2019 Stack For Calling and Called Procedure CDA3100 week06-3.ppt
65
Procedure Calls For Block-structured Languages
5/4/2019 Procedure Calls For Block-structured Languages ENTER and LEAVE instructions automatically create and release, respectively, stack frames for called procedures The ENTER instruction creates a stack frame compatible with the scope rules typically used in block-structured languages The LEAVE instruction, which does not have any operands, reverses the action of the previous ENTER instruction CDA3100 week06-3.ppt
66
5/4/2019 ENTER Instruction CDA3100 week06-3.ppt
67
IA-32 and IA-64 Instruction Format
5/4/2019 IA-32 and IA-64 Instruction Format CDA3100 week06-3.ppt
68
Examples of Instruction Formats
5/4/2019 Examples of Instruction Formats CDA3100 week06-3.ppt
69
5/4/2019 ADD Instructions CDA3100 week06-3.ppt
70
5/4/2019 ADD Instructions CDA3100 week06-3.ppt
71
Add Instruction Description
5/4/2019 Add Instruction Description CDA3100 week06-3.ppt
72
SCAS/SCASB/SCASW/SCASD—Scan String
5/4/2019 SCAS/SCASB/SCASW/SCASD—Scan String CDA3100 week06-3.ppt
73
SIMD in IA-32 and IA-64 To improve performance, Intel adopted SIMD (single instruction multiple data) instructions MMX technology (Pentium II processor family) SSE 10/7/2007 9:37:48 PM week07-1.ppt
74
MMX MMX introduced Eight new 64-bit data registers, called MMX registers Three new packed data types: 64-bit packed byte integers (signed and unsigned) 64-bit packed word integers (signed and unsigned) 64-bit packed double word integers (signed and unsigned) Instructions that support the new data types 10/7/2007 9:37:59 PM week07-1.ppt
75
MMX Packed integer types allow operations to be applied on multiple integers 10/7/2007 9:38:00 PM week07-1.ppt
76
SSE SSE introduced eight 128-bit data registers (called XMM registers)
In 64-bit modes, they are available as bit registers The 128-bit packed single-precision floating-point data type, which allows four single-precision operations to be performed simultaneously They can be used in parallel with MMX registers 10/7/2007 9:38:04 PM week07-1.ppt
77
SSE Execution Environment
10/7/2007 9:38:04 PM week07-1.ppt
78
XMM Registers In certain modes, additional eight 64 bit registers are also available (XMM8 - XMM15) 10/7/2007 9:38:05 PM week07-1.ppt
79
SSE Data Type SSE extensions introduced one new data type
128-Bit Packed Single-Precision Floating-Point Data Type SSE 2 introduced five data types 10/7/2007 9:38:05 PM week07-1.ppt
80
Packed and Scalar Double-Precision Floating-Point Operations
10/7/2007 9:38:07 PM week07-1.ppt
81
SSE Instructions SSE Data Transfer Instructions 10/7/2007 9:38:10 PM
week07-1.ppt
82
SSE Packed Arithmetic Instructions
10/7/2007 9:38:11 PM week07-1.ppt
83
SSE Packed Arithmetic Instructions
10/7/2007 9:38:12 PM week07-1.ppt
84
SSE Comparison, Logical, and Shuffle Instructions
10/7/2007 9:38:12 PM week07-1.ppt
85
SSE2 Instructions 10/7/2007 9:38:14 PM week07-1.ppt
86
SSE2 128-Bit SIMD Integer Instructions
10/7/2007 9:38:14 PM week07-1.ppt
87
Horizontal Addition/Subtraction
10/7/2007 9:38:16 PM week07-1.ppt
88
Horizontal Data Movements
10/7/2007 9:38:17 PM week07-1.ppt
89
Conversion Between Different Types
10/7/2007 9:38:17 PM week07-1.ppt
90
Using MMX/SSE Instructions in C/C++ Programs
Data types for MMX and SSE instructions These types are defined in C/C++ /usr/lib/gcc/i386-redhat-linux/3.4.3/include/mmintrin.h /usr/lib/gcc/i386-redhat-linux/3.4.3/include/pmmintrin.h /usr/lib/gcc/i386-redhat-linux/3.4.3/include/emmintrin.h 10/7/2007 9:38:18 PM week07-1.ppt
91
Built-in Functions Built-in functions are C-style functional interfaces to MMX/SSE instructions See 10/7/2007 9:38:29 PM week07-1.ppt
92
Intel MMX/SSE Intrinsics
Intrinsics are C/C++ functions and procedures for MMX/SSE instructions With instrinsics, one can program using these instructions indirectly using the provided intrinsics In general, there is a one-to-one correspondence between MMX/SSE instructions and intrinsics 10/7/ :01:41 PM week07-1.ppt
93
GCC Inline Assembly GCC inline assembly allows us to insert inline functions written in assembly GCC provides the utility to specify input and output operands as C variables Basic inline Extended inline assembly 10/7/ :01:43 PM week07-1.ppt
94
GCC Inline Assembly Some examples 10/7/ :03:01 PM week07-1.ppt
95
GCC Inline Assembly 10/7/ :03:04 PM week07-1.ppt
96
GCC Inline Assembly 10/7/ :03:06 PM week07-1.ppt
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.