SIMD_Programming_Manual_for_Linux_and_Windows_2004_Cockshott.pdf

(6496 KB) Pobierz
SIMD Programming Manual
for Linux and Windows
Springer-Verlag London Ltd.
Paul Cockshott and Kenneth Renfrew
SIMD Programming
Manual for Linux
and Windows
~Springer
Paul Cockshott, BaEcon, DipEd, MSc, PhD
Department of Computing Science
University of Glasgow
17 Lilybank Gardens
Glasgow G12 8RZ
UK
Kenneth Renfrew, BSc(Hons)
Crookhill Farm
Gateside
By Beith
Ayrshire KA15 1HQ
UK
British Library Cataloguing in Publication Data
Cockshott, W. Paul
SIMD programming manual for Linux and Windows. - (Springer professional computing)
1.
Parallel computing (Computer science)
1.
Title II. Renfrew, Kenneth
005.2'75
ISBN 978-1-84996-920-8
Library of Congress Cataloging-in-Publication Data
Cockshott, W. Paul, 1952-
SIMD programming manual for Linux and Windows/Paul Cockshott and Kenneth Renfrew.
p. cm. - (Springer professional computing)
Includes index.
ISBN 978-1-84996-920-8
ISBN 978-1-4471-3862-4 (eBook)
DOI 10.1007/978-1-4471-3862-4
1.
Parallel programming (Computer science) 2. Linux. 3. Microsoft Windows
(Computer file)
I.
Renfrew, Kenneth, 1962- II. Title. III. Series.
QA76.642C63 2004
005.2'75-dc22
2003067311
Apart from any fair dealing for the purposes of research or private study, or criticism or review,
as permitted under the Copyright, Designs and Patents Act 1988, this publication may only be
reproduced, stored or transmitted, in any form or by any means, with the prior permission in
writing of the publishers, or in the case of reprographic reproduction in accordance with the
terms of licences issued by the Copyright Licensing Agency. Enquiries concerning reproduction
outside those terms should be sent to the publishers.
ISBN 978-1-84996-920-8
springeronline.com
©
Springer-Verlag London 2004
Originally published by Springer-Verlag London Berlin Heidelberg 2004
Softcover reprint of the hardcover 1st edition 2004
The use of registered names, trademarks etc. in this publication does not imply, even in the
absence of a specific statement, that such narnes are exempt from the relevant laws and
regulations and therefore free for general use.
The publisher makes no representation, express or implied, with regard to the accuracy of the
information contained in this book and cannot accept any legal responsibility or liability for any
errors or omissions that may be made.
Typeset by Gray Publishing, Tunbridge Wells, UK
34/3830-54321 Printed on acid-free paper SPIN 10962251
Contents
List of Tables
List of Figures
List of Algorithms
Introduction
xvii
xix
xxiii
XXV
Paul Cockshott
I
SIMD Programming
1
3
3
4
5
6
8
11
11
12
13
15
17
18
19
21
22
23
1 Computer Speed, Program Speed
1.1 Clocks . . . . . . . . . . . . . . . .
1.2 Width . . . . . . . . . . . . . . . .
1.3 Instruction Speed . . . . . . . .
1.4 Overhead Instructions . . . . .
1.5 Algorithm Complexity. . . . .
2
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
SIMD Instruction-sets
2.1 The SIMD Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.2 The MMX Register Architecture . . . . . . . . . . . . . . . . . . . . . . .
2.3 MMX Data-types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4 3DNow! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.1 Cache Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.4.2 Cache Line Length and Prefetching . . . . . . . . . . . . . . .
2.5 Streaming SIMD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2.5.1 Cache Optimisation ..........................
2.6 The Motorola Altivec Architecture . . . . . . . . . . . . . . . . . . . . .
SIMD Programming
in
Assembler and
C
3.1 Vectorising C Compilers ............................
3.1.1 Dead for Loop Elimination . . . . . . . . . . .. . . . . . . . . . .
3.1.2 Loop Unrolling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
3.2 Direct Use of Assembler Code ........................
3.2.1 The Example Program .........................
3.3 Use of Assembler Intrinsics . . . . . . . . . . . . . . . . . . . . . . . . . .
3
23
24
25
25
26
27
v
Zgłoś jeśli naruszono regulamin