forked from etmc/tmLQCD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsse_32.h
662 lines (597 loc) · 24.7 KB
/
sse_32.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/*******************************************************************************
*
* File sse.h
*
* Macros for Dirac spinors, SU(3) vectors and SU(3) matrices using
* inline assembly SSE and SSE2 instructions
*
* Needs gcc version 2.95.2 or later, and binutils snapshot 010122 or later
* if the SSE2 instructions are used
*
* Version: 2.1
* Author: Martin Luescher <[email protected]>
* Date: 15.03.2001
*
*******************************************************************************/
typedef struct
{
float c1,c2,c3,c4;
} sse_float __attribute__ ((aligned (16)));
typedef struct
{
sse_float c1,c2,c3;
} sse_vector __attribute__ ((aligned (16)));
static sse_float _sse_sgn12 __attribute__ ((unused)) ={-1.0f,-1.0f,1.0f,1.0f};
static sse_float _sse_sgn13 __attribute__ ((unused)) ={-1.0f,1.0f,-1.0f,1.0f};
static sse_float _sse_sgn14 __attribute__ ((unused)) ={-1.0f,1.0f,1.0f,-1.0f};
static sse_float _sse_sgn23 __attribute__ ((unused)) ={1.0f,-1.0f,-1.0f,1.0f};
static sse_float _sse_sgn24 __attribute__ ((unused)) ={1.0f,-1.0f,1.0f,-1.0f};
static sse_float _sse_sgn34 __attribute__ ((unused)) ={1.0f,1.0f,-1.0f,-1.0f};
/*******************************************************************************
*
* Cache manipulation macros
*
*******************************************************************************/
#if defined P4
#define _prefetch_spinor(addr) \
__asm__ __volatile__ ("prefetcht0 %0 \n\t" \
"prefetcht0 %1" \
: \
: \
"m" (*(((char*)(((unsigned int)(addr))&~0x7f)))), \
"m" (*(((char*)(((unsigned int)(addr))&~0x7f))+128)))
#define _prefetch_su3(addr) \
__asm__ __volatile__ ("prefetcht0 %0 \n\t" \
"prefetcht0 %1" \
: \
: \
"m" (*(((char*)(((unsigned int)(addr))&~0x7f)))), \
"m" (*(((char*)(((unsigned int)(addr))&~0x7f))+128)))
#else
#define _prefetch_spinor(addr) \
__asm__ __volatile__ ("prefetcht0 %0 \n\t" \
"prefetcht0 %1 \n\t" \
"prefetcht0 %2" \
: \
: \
"m" (*(((char*)(addr)))), \
"m" (*(((char*)(addr))+32)), \
"m" (*(((char*)(addr))+64)))
#define _prefetch_su3(addr) \
__asm__ __volatile__ ("prefetcht0 %0 \n\t" \
"prefetcht0 %1 \n\t" \
"prefetcht0 %2" \
: \
: \
"m" (*(((char*)(((unsigned int)(addr))&~0x1f)))), \
"m" (*(((char*)(((unsigned int)(addr))&~0x1f))+32)), \
"m" (*(((char*)(((unsigned int)(addr))&~0x1f))+64)))
#endif
/*******************************************************************************
*
* Macros for su3 vectors used in D_psi version 2.1
*
* Most of these macros operate on pairs of su3 vectors that are stored
* in the low and high words of xmm0,xmm1,xmm2 or xmm3,xmm4,xmm5. For example,
*
* xmm0 -> sl.c1.re,sl.c1.im,sh.c1.re,sh.c1.im
* xmm1 -> sl.c2.re,sl.c2.im,sh.c2.re,sh.c2.im
* xmm2 -> sl.c3.re,sl.c3.im,sh.c3.re,sh.c3.im
*
* (where sl and sh are of type su3_vector). This can also be interpreted as
* an sse_vector s that is stored in these registers according to
*
* xmm0 -> s.c1.c1,s.c1.c2,s.c1.c3,s.c1.c4
* xmm1 -> s.c2.c1,s.c2.c2,s.c2.c3,s.c2.c4
* xmm2 -> s.c3.c1,s.c3.c2,s.c3.c3,s.c3.c4
*
* The load and store macros can be used to move data in either format
* from and to the xmm registers
*
*******************************************************************************/
/*
* Loads two su3 vectors sl and sh to the low and high words of xmm0,xmm1,xmm2
*/
#if defined SSE2
#define _sse_pair_load(sl,sh) \
__asm__ __volatile__ ("movsd %0, %%xmm0 \n\t" \
"movsd %1, %%xmm1 \n\t" \
"movsd %2, %%xmm2 \n\t" \
"movhps %3, %%xmm0 \n\t" \
"movhps %4, %%xmm1 \n\t" \
"movhps %5, %%xmm2" \
: \
: \
"m" ((sl).c1), \
"m" ((sl).c2), \
"m" ((sl).c3), \
"m" ((sh).c1), \
"m" ((sh).c2), \
"m" ((sh).c3))
#else
#define _sse_pair_load(sl,sh) \
__asm__ __volatile__ ("movlps %0, %%xmm0 \n\t" \
"movlps %1, %%xmm1 \n\t" \
"movlps %2, %%xmm2 \n\t" \
"movhps %3, %%xmm0 \n\t" \
"movhps %4, %%xmm1 \n\t" \
"movhps %5, %%xmm2" \
: \
: \
"m" ((sl).c1), \
"m" ((sl).c2), \
"m" ((sl).c3), \
"m" ((sh).c1), \
"m" ((sh).c2), \
"m" ((sh).c3))
#endif
/*
* Loads two su3 vectors sl and sh to the low and high words of xmm3,xmm4,xmm5
*/
#if defined SSE2
#define _sse_pair_load_up(sl,sh) \
__asm__ __volatile__ ("movsd %0, %%xmm3 \n\t" \
"movsd %1, %%xmm4 \n\t" \
"movsd %2, %%xmm5 \n\t" \
"movhps %3, %%xmm3 \n\t" \
"movhps %4, %%xmm4 \n\t" \
"movhps %5, %%xmm5" \
: \
: \
"m" ((sl).c1), \
"m" ((sl).c2), \
"m" ((sl).c3), \
"m" ((sh).c1), \
"m" ((sh).c2), \
"m" ((sh).c3))
#else
#define _sse_pair_load_up(sl,sh) \
__asm__ __volatile__ ("movlps %0, %%xmm3 \n\t" \
"movlps %1, %%xmm4 \n\t" \
"movlps %2, %%xmm5 \n\t" \
"movhps %3, %%xmm3 \n\t" \
"movhps %4, %%xmm4 \n\t" \
"movhps %5, %%xmm5" \
: \
: \
"m" ((sl).c1), \
"m" ((sl).c2), \
"m" ((sl).c3), \
"m" ((sh).c1), \
"m" ((sh).c2), \
"m" ((sh).c3))
#endif
/*
* Stores the low and high words of xmm0,xmm1,xmm2 to the su3 vectors rl and rh
*/
#define _sse_pair_store(rl,rh) \
__asm__ __volatile__ ("movlps %%xmm0, %0 \n\t" \
"movlps %%xmm1, %1 \n\t" \
"movlps %%xmm2, %2 \n\t" \
"movhps %%xmm0, %3 \n\t" \
"movhps %%xmm1, %4 \n\t" \
"movhps %%xmm2, %5" \
: \
"=m" ((rl).c1), \
"=m" ((rl).c2), \
"=m" ((rl).c3), \
"=m" ((rh).c1), \
"=m" ((rh).c2), \
"=m" ((rh).c3))
/*
* Stores the low and high words of xmm3,xmm4,xmm5 to the su3 vectors rl and rh
*/
#define _sse_pair_store_up(rl,rh) \
__asm__ __volatile__ ("movlps %%xmm3, %0 \n\t" \
"movlps %%xmm4, %1 \n\t" \
"movlps %%xmm5, %2 \n\t" \
"movhps %%xmm3, %3 \n\t" \
"movhps %%xmm4, %4 \n\t" \
"movhps %%xmm5, %5" \
: \
"=m" ((rl).c1), \
"=m" ((rl).c2), \
"=m" ((rl).c3), \
"=m" ((rh).c1), \
"=m" ((rh).c2), \
"=m" ((rh).c3))
/*
* Loads the components s.c1,s.c2,s.c3 of an _sse_vector s to xmm0,xmm1,xmm2
*/
#define _sse_vector_load(s) \
__asm__ __volatile__ ("movaps %0, %%xmm0 \n\t" \
"movaps %1, %%xmm1 \n\t" \
"movaps %2, %%xmm2" \
: \
: \
"m" ((s).c1), \
"m" ((s).c2), \
"m" ((s).c3))
/*
* Stores xmm0,xmm1,xmm2 to the components r.c1,r.c2,r.c3 of an _sse_vector r
*/
#define _sse_vector_store(r) \
__asm__ __volatile__ ("movaps %%xmm0, %0 \n\t" \
"movaps %%xmm1, %1 \n\t" \
"movaps %%xmm2, %2" \
: \
"=m" ((r).c1), \
"=m" ((r).c2), \
"=m" ((r).c3))
/*
* Multiplies xmm0,xmm1,xmm2 with a constant sse_float c
*/
#define _sse_vector_mul(c) \
__asm__ __volatile__ ("mulps %0, %%xmm0 \n\t" \
"mulps %0, %%xmm1 \n\t" \
"mulps %0, %%xmm2" \
: \
: \
"m" (c))
/*
* Adds xmm3,xmm4,xmm5 to xmm1,xmm2,xmm3
*/
#define _sse_vector_add() \
__asm__ __volatile__ ("addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
:)
/*
* Subtracts xmm3,xmm4,xmm5 from xmm1,xmm2,xmm3
*/
#define _sse_vector_sub() \
__asm__ __volatile__ ("subps %%xmm3, %%xmm0 \n\t" \
"subps %%xmm4, %%xmm1 \n\t" \
"subps %%xmm5, %%xmm2" \
: \
:)
/*
* Multiplies the high words xmm3,xmm4,xmm5 with -1 and adds these registers
* to xmm0,xmm1,xmm2
*/
#define _sse_vector_addsub() \
__asm__ __volatile__ ("mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn34))
/*
* Multiplies the low words xmm3,xmm4,xmm5 with -1 and adds these registers
* to xmm0,xmm1,xmm2
*/
#define _sse_vector_subadd() \
__asm__ __volatile__ ("mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn12))
/*
* Multiplies xmm3,xmm4,xmm5 with i and adds them to xmm1,xmm2,xmm3
*/
#define _sse_vector_i_add() \
__asm__ __volatile__ ("shufps $0xb1, %%xmm3, %%xmm3 \n\t" \
"shufps $0xb1, %%xmm4, %%xmm4 \n\t" \
"shufps $0xb1, %%xmm5, %%xmm5 \n\t" \
"mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn13))
/*
* Multiplies xmm3,xmm4,xmm5 with i and subtracts them from xmm1,xmm2,xmm3
*/
#define _sse_vector_i_sub() \
__asm__ __volatile__ ("shufps $0xb1, %%xmm3, %%xmm3 \n\t" \
"shufps $0xb1, %%xmm4, %%xmm4 \n\t" \
"shufps $0xb1, %%xmm5, %%xmm5 \n\t" \
"mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn24))
/*
* Exchanges the high and low words of xmm3,xmm4,xmm5, multiplies them with i
* and adds the result to xmm1,xmm2,xmm3
*/
#define _sse_vector_xch_i_add() \
__asm__ __volatile__ ("shufps $0x1b, %%xmm3, %%xmm3 \n\t" \
"shufps $0x1b, %%xmm4, %%xmm4 \n\t" \
"shufps $0x1b, %%xmm5, %%xmm5 \n\t" \
"mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn13))
/*
* Exchanges the high and low words of xmm3,xmm4,xmm5, multiplies them with i
* and subtracts the result from xmm1,xmm2,xmm3
*/
#define _sse_vector_xch_i_sub() \
__asm__ __volatile__ ("shufps $0x1b, %%xmm3, %%xmm3 \n\t" \
"shufps $0x1b, %%xmm4, %%xmm4 \n\t" \
"shufps $0x1b, %%xmm5, %%xmm5 \n\t" \
"mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn24))
/*
* Multiplies the low and high words of xmm3,xmm4,xmm5 with i and -i
* respectively and adds these registers to xmm1,xmm2,xmm3
*/
#define _sse_vector_i_addsub() \
__asm__ __volatile__ ("shufps $0xb1, %%xmm3, %%xmm3 \n\t" \
"shufps $0xb1, %%xmm4, %%xmm4 \n\t" \
"shufps $0xb1, %%xmm5, %%xmm5 \n\t" \
"mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn14))
/*
* Multiplies the low and high words of xmm3,xmm4,xmm5 with -i and i
* respectively and adds these registers to xmm1,xmm2,xmm3
*/
#define _sse_vector_i_subadd() \
__asm__ __volatile__ ("shufps $0xb1, %%xmm3, %%xmm3 \n\t" \
"shufps $0xb1, %%xmm4, %%xmm4 \n\t" \
"shufps $0xb1, %%xmm5, %%xmm5 \n\t" \
"mulps %0, %%xmm3 \n\t" \
"mulps %0, %%xmm4 \n\t" \
"mulps %0, %%xmm5 \n\t" \
"addps %%xmm3, %%xmm0 \n\t" \
"addps %%xmm4, %%xmm1 \n\t" \
"addps %%xmm5, %%xmm2" \
: \
: \
"m" (_sse_sgn23))
/*
* Exchanges the high and low words in xmm3,xmm4,xmm5
*/
#define _sse_vector_xch() \
__asm__ __volatile__ ("shufps $0x4e, %%xmm3, %%xmm3 \n\t" \
"shufps $0x4e, %%xmm4, %%xmm4 \n\t" \
"shufps $0x4e, %%xmm5, %%xmm5" \
: \
:)
/*
* Multiplies a pair sl,sh of su3 vectors with an su3 matrix u,
* assuming sl and sh are in the low and high words of xmm0,xmm1,xmm2
*
* On output the result is in xmm3,xmm4,xmm5 and the registers
* xmm0,xmm1,xmm2 are changed
*/
#define _sse_su3_multiply(u) \
__asm__ __volatile__ ("movss %0, %%xmm3 \n\t" \
"movss %1, %%xmm6 \n\t" \
"movss %2, %%xmm4 \n\t" \
"movss %3, %%xmm7 \n\t" \
"movss %4, %%xmm5 \n\t" \
"shufps $0x0, %%xmm3, %%xmm3 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm4, %%xmm4 \n\t" \
"mulps %%xmm0, %%xmm3 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"shufps $0x0, %%xmm5, %%xmm5 \n\t" \
"mulps %%xmm0, %%xmm4 \n\t" \
"addps %%xmm6, %%xmm3 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"mulps %%xmm0, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm4 \n\t" \
"movss %5, %%xmm6 \n\t" \
"movss %6, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm3 \n\t" \
"movss %7, %%xmm6 \n\t" \
"movss %8, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm4 \n\t" \
"addps %%xmm7, %%xmm5" \
: \
: \
"m" ((u).c11.re), \
"m" ((u).c12.re), \
"m" ((u).c21.re), \
"m" ((u).c23.re), \
"m" ((u).c31.re), \
"m" ((u).c32.re), \
"m" ((u).c13.re), \
"m" ((u).c22.re), \
"m" ((u).c33.re)); \
__asm__ __volatile__ ("movss %0, %%xmm6 \n\t" \
"movss %1, %%xmm7 \n\t" \
"shufps $0xb1, %%xmm0, %%xmm0 \n\t" \
"shufps $0xb1, %%xmm1, %%xmm1 \n\t" \
"shufps $0xb1, %%xmm2, %%xmm2 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %9, %%xmm0 \n\t" \
"mulps %9, %%xmm1 \n\t" \
"mulps %9, %%xmm2 \n\t" \
"mulps %%xmm0, %%xmm6 \n\t" \
"mulps %%xmm1, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm3 \n\t" \
"addps %%xmm7, %%xmm4 \n\t" \
"movss %2, %%xmm6 \n\t" \
"movss %3, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm2, %%xmm6 \n\t" \
"mulps %%xmm0, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm4 \n\t" \
"movss %4, %%xmm6 \n\t" \
"movss %5, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm0, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm3 \n\t" \
"addps %%xmm7, %%xmm5 \n\t" \
"movss %6, %%xmm0 \n\t" \
"movss %7, %%xmm6 \n\t" \
"movss %8, %%xmm7 \n\t" \
"shufps $0x0, %%xmm0, %%xmm0 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm2, %%xmm0 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"addps %%xmm0, %%xmm3 \n\t" \
"addps %%xmm6, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm4" \
: \
: \
"m" ((u).c11.im), \
"m" ((u).c22.im), \
"m" ((u).c33.im), \
"m" ((u).c21.im), \
"m" ((u).c12.im), \
"m" ((u).c31.im), \
"m" ((u).c13.im), \
"m" ((u).c32.im), \
"m" ((u).c23.im), \
"m" (_sse_sgn13))
/*
* Multiplies a pair sl,sh of su3 vectors with an su3 matrix u^dagger,
* assuming sl and sh are in the low and high words of xmm0,xmm1,xmm2
*
* On output the result is in xmm3,xmm4,xmm5 and the registers
* xmm0,xmm1,xmm2 are changed
*/
#define _sse_su3_inverse_multiply(u) \
__asm__ __volatile__ ("movss %0, %%xmm3 \n\t" \
"movss %1, %%xmm6 \n\t" \
"movss %2, %%xmm4 \n\t" \
"movss %3, %%xmm7 \n\t" \
"movss %4, %%xmm5 \n\t" \
"shufps $0x0, %%xmm3, %%xmm3 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm4, %%xmm4 \n\t" \
"mulps %%xmm0, %%xmm3 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"shufps $0x0, %%xmm5, %%xmm5 \n\t" \
"mulps %%xmm0, %%xmm4 \n\t" \
"addps %%xmm6, %%xmm3 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"mulps %%xmm0, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm4 \n\t" \
"movss %5, %%xmm6 \n\t" \
"movss %6, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm3 \n\t" \
"movss %7, %%xmm6 \n\t" \
"movss %8, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm4 \n\t" \
"addps %%xmm7, %%xmm5" \
: \
: \
"m" ((u).c11.re), \
"m" ((u).c21.re), \
"m" ((u).c12.re), \
"m" ((u).c32.re), \
"m" ((u).c13.re), \
"m" ((u).c23.re), \
"m" ((u).c31.re), \
"m" ((u).c22.re), \
"m" ((u).c33.re)); \
__asm__ __volatile__ ("movss %0, %%xmm6 \n\t" \
"movss %1, %%xmm7 \n\t" \
"shufps $0xb1, %%xmm0, %%xmm0 \n\t" \
"shufps $0xb1, %%xmm1, %%xmm1 \n\t" \
"shufps $0xb1, %%xmm2, %%xmm2 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %9, %%xmm0 \n\t" \
"mulps %9, %%xmm1 \n\t" \
"mulps %9, %%xmm2 \n\t" \
"mulps %%xmm0, %%xmm6 \n\t" \
"mulps %%xmm1, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm3 \n\t" \
"addps %%xmm7, %%xmm4 \n\t" \
"movss %2, %%xmm6 \n\t" \
"movss %3, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm2, %%xmm6 \n\t" \
"mulps %%xmm0, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm4 \n\t" \
"movss %4, %%xmm6 \n\t" \
"movss %5, %%xmm7 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm0, %%xmm7 \n\t" \
"addps %%xmm6, %%xmm3 \n\t" \
"addps %%xmm7, %%xmm5 \n\t" \
"movss %6, %%xmm0 \n\t" \
"movss %7, %%xmm6 \n\t" \
"movss %8, %%xmm7 \n\t" \
"shufps $0x0, %%xmm0, %%xmm0 \n\t" \
"shufps $0x0, %%xmm6, %%xmm6 \n\t" \
"shufps $0x0, %%xmm7, %%xmm7 \n\t" \
"mulps %%xmm2, %%xmm0 \n\t" \
"mulps %%xmm1, %%xmm6 \n\t" \
"mulps %%xmm2, %%xmm7 \n\t" \
"addps %%xmm0, %%xmm3 \n\t" \
"addps %%xmm6, %%xmm5 \n\t" \
"addps %%xmm7, %%xmm4" \
: \
: \
"m" ((u).c11.im), \
"m" ((u).c22.im), \
"m" ((u).c33.im), \
"m" ((u).c12.im), \
"m" ((u).c21.im), \
"m" ((u).c13.im), \
"m" ((u).c31.im), \
"m" ((u).c23.im), \
"m" ((u).c32.im), \
"m" (_sse_sgn24));