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
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
|
//===- Intrinsics.td - Defines all LLVM intrinsics ---------*- tablegen -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by Chris Lattner and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines properties of all LLVM intrinsics.
//
//===----------------------------------------------------------------------===//
include "llvm/CodeGen/ValueTypes.td"
//===----------------------------------------------------------------------===//
// Properties we keep track of for intrinsics.
//===----------------------------------------------------------------------===//
class IntrinsicProperty;
// Intr*Mem - Memory properties. An intrinsic is allowed to have exactly one of
// these properties set. They are listed from the most aggressive (best to use
// if correct) to the least aggressive. If no property is set, the worst case
// is assumed (IntrWriteMem).
// InstrNoMem - The intrinsic does not access memory or have any other side
// effects. It may be CSE'd deleted if dead, etc.
def InstrNoMem : IntrinsicProperty;
// InstrReadArgMem - This intrinsic reads only from memory that one of its
// arguments points to, but may read an unspecified amount.
def InstrReadArgMem : IntrinsicProperty;
// IntrReadMem - This intrinsic reads from unspecified memory, so it cannot be
// moved across stores. However, it can be reordered otherwise and can be
// deleted if dead.
def IntrReadMem : IntrinsicProperty;
// InstrWriteArgMem - This intrinsic reads and writes only from memory that one
// of its arguments points to, but may access an unspecified amount. It has no
// other side effects. This may only be used if the intrinsic doesn't "capture"
// the argument pointer (e.g. storing it someplace).
def InstrWriteArgMem : IntrinsicProperty;
// IntrWriteMem - This intrinsic may read or modify unspecified memory or has
// other side effects. It cannot be modified by the optimizer. This is the
// default if the intrinsic has no other Intr*Mem property.
def IntrWriteMem : IntrinsicProperty;
//===----------------------------------------------------------------------===//
// Types used by intrinsics.
//===----------------------------------------------------------------------===//
class LLVMType<ValueType vt, string typeval> {
ValueType VT = vt;
string TypeVal = typeval;
}
class LLVMPackedType<ValueType VT, int numelts, LLVMType elty>
: LLVMType<VT, "Type::PackedTyID">{
int NumElts = numelts;
LLVMType ElTy = elty;
}
def llvm_void_ty : LLVMType<isVoid, "Type::VoidTyID">;
def llvm_bool_ty : LLVMType<i1 , "Type::BoolTyID">;
def llvm_sbyte_ty : LLVMType<i8 , "Type::SByteTyID">;
def llvm_short_ty : LLVMType<i16, "Type::ShortTyID">;
def llvm_int_ty : LLVMType<i32, "Type::IntTyID">;
def llvm_long_ty : LLVMType<i64, "Type::LongTyID">;
def llvm_ubyte_ty : LLVMType<i8, "Type::UByteTyID">;
def llvm_ushort_ty : LLVMType<i16, "Type::UShortTyID">;
def llvm_uint_ty : LLVMType<i32, "Type::UIntTyID">;
def llvm_ulong_ty : LLVMType<i64, "Type::ULongTyID">;
def llvm_float_ty : LLVMType<f32, "Type::FloatTyID">;
def llvm_double_ty : LLVMType<f64, "Type::DoubleTyID">;
def llvm_ptr_ty : LLVMType<OtherVT, "Type::PointerTyID">; // sbyte*
def llvm_ptrptr_ty : LLVMType<OtherVT, "Type::PointerTyID">; // sbyte**
def llvm_descriptor_ty : LLVMType<OtherVT, "Type::PointerTyID">; // global*
def llvm_v16i8_ty : LLVMPackedType<v16i8,16, llvm_sbyte_ty>; // 16 x sbyte
def llvm_v8i16_ty : LLVMPackedType<v8i16, 8, llvm_short_ty>; // 8 x short
def llvm_v2i32_ty : LLVMPackedType<v2i32, 2, llvm_int_ty>; // 2 x int
def llvm_v4i32_ty : LLVMPackedType<v4i32, 4, llvm_int_ty>; // 4 x int
def llvm_v4f32_ty : LLVMPackedType<v4f32, 4, llvm_float_ty>; // 4 x float
def llvm_v2f64_ty : LLVMPackedType<v2f64, 2, llvm_double_ty>; // 2 x double
//===----------------------------------------------------------------------===//
// Intrinsic Definitions.
//===----------------------------------------------------------------------===//
// Intrinsic class - This is used to define one LLVM intrinsic. The name of the
// intrinsic definition should start with "int_", then match the LLVM intrinsic
// name with the "llvm." prefix removed, and all "."s turned into "_"s. For
// example, llvm.bswap.i16 -> int_bswap_i16.
//
// * Types is a list containing the return type and the argument types
// expected for the intrinsic.
// * Properties can be set to describe the behavior of the intrinsic.
//
class Intrinsic<list<LLVMType> types,
list<IntrinsicProperty> properties = [],
string name = ""> {
string LLVMName = name;
string TargetPrefix = ""; // Set to a prefix for target-specific intrinsics.
list<LLVMType> Types = types;
list<IntrinsicProperty> Properties = properties;
}
/// GCCBuiltin - If this intrinsic exactly corresponds to a GCC builtin, this
/// specifies the name of the builtin. This provides automatic CBE and CFE
/// support.
class GCCBuiltin<string name> {
string GCCBuiltinName = name;
}
//===--------------- Variable Argument Handling Intrinsics ----------------===//
//
def int_vastart : Intrinsic<[llvm_void_ty, llvm_ptrptr_ty], [], "llvm.va_start">;
def int_vacopy : Intrinsic<[llvm_void_ty, llvm_ptrptr_ty, llvm_ptrptr_ty], [],
"llvm.va_copy">;
def int_vaend : Intrinsic<[llvm_void_ty, llvm_ptrptr_ty], [], "llvm.va_end">;
//===------------------- Garbage Collection Intrinsics --------------------===//
//
def int_gcroot : Intrinsic<[llvm_void_ty, llvm_ptrptr_ty, llvm_ptr_ty]>;
def int_gcread : Intrinsic<[llvm_ptr_ty, llvm_ptr_ty, llvm_ptrptr_ty],
[InstrReadArgMem]>;
def int_gcwrite : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty,
llvm_ptrptr_ty], [InstrWriteArgMem]>;
//===--------------------- Code Generator Intrinsics ----------------------===//
//
def int_returnaddress : Intrinsic<[llvm_ptr_ty, llvm_uint_ty], [InstrNoMem]>;
def int_frameaddress : Intrinsic<[llvm_ptr_ty, llvm_uint_ty], [InstrNoMem]>;
def int_stacksave : Intrinsic<[llvm_ptr_ty], [IntrReadMem]>;
def int_stackrestore : Intrinsic<[llvm_void_ty, llvm_ptr_ty]>;
def int_prefetch : Intrinsic<[llvm_void_ty, llvm_ptr_ty,
llvm_uint_ty, llvm_uint_ty]>;
def int_pcmarker : Intrinsic<[llvm_void_ty, llvm_uint_ty]>;
def int_readcyclecounter : Intrinsic<[llvm_ulong_ty]>;
//===------------------- Standard C Library Intrinsics --------------------===//
//
let Properties = [InstrWriteArgMem] in {
def int_memcpy_i32 : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty,
llvm_uint_ty, llvm_uint_ty]>;
def int_memcpy_i64 : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty,
llvm_ulong_ty, llvm_uint_ty]>;
def int_memmove_i32 : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty,
llvm_uint_ty, llvm_uint_ty]>;
def int_memmove_i64 : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ptr_ty,
llvm_ulong_ty, llvm_uint_ty]>;
def int_memset_i32 : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ubyte_ty,
llvm_uint_ty, llvm_uint_ty]>;
def int_memset_i64 : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_ubyte_ty,
llvm_ulong_ty, llvm_uint_ty]>;
}
let Properties = [InstrNoMem] in {
def int_isunordered_f32 : Intrinsic<[llvm_bool_ty,
llvm_float_ty, llvm_float_ty]>;
def int_isunordered_f64 : Intrinsic<[llvm_bool_ty,
llvm_double_ty, llvm_double_ty]>;
def int_sqrt_f32 : Intrinsic<[llvm_float_ty , llvm_float_ty]>;
def int_sqrt_f64 : Intrinsic<[llvm_double_ty, llvm_double_ty]>;
}
// NOTE: these are internal interfaces.
def int_setjmp : Intrinsic<[llvm_int_ty , llvm_ptr_ty]>;
def int_longjmp : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_int_ty]>;
def int_sigsetjmp : Intrinsic<[llvm_int_ty , llvm_ptr_ty]>;
def int_siglongjmp : Intrinsic<[llvm_void_ty, llvm_ptr_ty, llvm_int_ty]>;
//===-------------------- Bit Manipulation Intrinsics ---------------------===//
//
// None of these intrinsics accesses memory at all.
let Properties = [InstrNoMem] in {
def int_bswap_i16 : Intrinsic<[llvm_ushort_ty, llvm_ushort_ty]>;
def int_bswap_i32 : Intrinsic<[llvm_uint_ty, llvm_uint_ty]>;
def int_bswap_i64 : Intrinsic<[llvm_ulong_ty, llvm_ulong_ty]>;
def int_ctpop_i8 : Intrinsic<[llvm_ubyte_ty, llvm_ubyte_ty]>;
def int_ctpop_i16 : Intrinsic<[llvm_ushort_ty, llvm_ushort_ty]>;
def int_ctpop_i32 : Intrinsic<[llvm_uint_ty, llvm_uint_ty]>;
def int_ctpop_i64 : Intrinsic<[llvm_ulong_ty, llvm_ulong_ty]>;
def int_ctlz_i8 : Intrinsic<[llvm_ubyte_ty, llvm_ubyte_ty]>;
def int_ctlz_i16 : Intrinsic<[llvm_ushort_ty, llvm_ushort_ty]>;
def int_ctlz_i32 : Intrinsic<[llvm_uint_ty, llvm_uint_ty]>;
def int_ctlz_i64 : Intrinsic<[llvm_ulong_ty, llvm_ulong_ty]>;
def int_cttz_i8 : Intrinsic<[llvm_ubyte_ty, llvm_ubyte_ty]>;
def int_cttz_i16 : Intrinsic<[llvm_ushort_ty, llvm_ushort_ty]>;
def int_cttz_i32 : Intrinsic<[llvm_uint_ty, llvm_uint_ty]>;
def int_cttz_i64 : Intrinsic<[llvm_ulong_ty, llvm_ulong_ty]>;
}
//===------------------------ Debugger Intrinsics -------------------------===//
//
def int_dbg_stoppoint : Intrinsic<[llvm_void_ty,
llvm_uint_ty, llvm_uint_ty,
llvm_descriptor_ty]>;
def int_dbg_region_start : Intrinsic<[llvm_void_ty, llvm_descriptor_ty]>;
def int_dbg_region_end : Intrinsic<[llvm_void_ty, llvm_descriptor_ty]>;
def int_dbg_func_start : Intrinsic<[llvm_void_ty, llvm_descriptor_ty]>;
def int_dbg_declare : Intrinsic<[llvm_void_ty, llvm_ptr_ty,
llvm_descriptor_ty]>;
//===----------------------------------------------------------------------===//
// Target-specific intrinsics
//===----------------------------------------------------------------------===//
//===----------------------------------------------------------------------===//
// PowerPC Intrinsics
//
let TargetPrefix = "ppc" in { // All intrinsics start with "llvm.ppc.".
def int_ppc_altivec_lvx : GCCBuiltin<"__builtin_altivec_lvx">,
Intrinsic<[llvm_v4i32_ty, llvm_int_ty, llvm_ptr_ty],
[IntrReadMem]>;
def int_ppc_altivec_stvx : GCCBuiltin<"__builtin_altivec_stvx">,
Intrinsic<[llvm_void_ty, llvm_v4i32_ty, llvm_int_ty, llvm_ptr_ty],
[IntrWriteMem]>;
def int_ppc_altivec_vmaddfp : GCCBuiltin<"__builtin_altivec_vmaddfp">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty, llvm_v4f32_ty], [InstrNoMem]>;
def int_ppc_altivec_vnmsubfp : GCCBuiltin<"__builtin_altivec_vnmsubfp">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty, llvm_v4f32_ty], [InstrNoMem]>;
def int_ppc_altivec_vaddcuw : GCCBuiltin<"__builtin_altivec_vaddcuw">,
Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
[InstrNoMem]>;
// Saturating adds:
def int_ppc_altivec_vaddubs : GCCBuiltin<"__builtin_altivec_vaddubs">,
Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
[InstrNoMem]>;
def int_ppc_altivec_vaddsbs : GCCBuiltin<"__builtin_altivec_vaddsbs">,
Intrinsic<[llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
[InstrNoMem]>;
def int_ppc_altivec_vadduhs : GCCBuiltin<"__builtin_altivec_vadduhs">,
Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
[InstrNoMem]>;
def int_ppc_altivec_vaddshs : GCCBuiltin<"__builtin_altivec_vaddshs">,
Intrinsic<[llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
[InstrNoMem]>;
def int_ppc_altivec_vadduws : GCCBuiltin<"__builtin_altivec_vadduws">,
Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
[InstrNoMem]>;
def int_ppc_altivec_vaddsws : GCCBuiltin<"__builtin_altivec_vaddsws">,
Intrinsic<[llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
[InstrNoMem]>;
// FP to integer conversion.
def int_ppc_altivec_vcfsx : GCCBuiltin<"__builtin_altivec_vcfsx">,
Intrinsic<[llvm_v4f32_ty, llvm_v4i32_ty, llvm_int_ty],
[InstrNoMem]>;
def int_ppc_altivec_vcfux : GCCBuiltin<"__builtin_altivec_vcfux">,
Intrinsic<[llvm_v4f32_ty, llvm_v4i32_ty, llvm_int_ty],
[InstrNoMem]>;
def int_ppc_altivec_vrsqrtefp : GCCBuiltin<"__builtin_altivec_vrsqrtefp">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty], [InstrNoMem]>;
}
//===----------------------------------------------------------------------===//
// X86 Intrinsics
//
// SSE1
// Arithmetic ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_addss : GCCBuiltin<"__builtin_ia32_addss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_addps : GCCBuiltin<"__builtin_ia32_addps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_subss : GCCBuiltin<"__builtin_ia32_subss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_subps : GCCBuiltin<"__builtin_ia32_subps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_mulss : GCCBuiltin<"__builtin_ia32_mulss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_mulps : GCCBuiltin<"__builtin_ia32_mulps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_divss : GCCBuiltin<"__builtin_ia32_divss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_divps : GCCBuiltin<"__builtin_ia32_divps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_sqrtss : GCCBuiltin<"__builtin_ia32_sqrtss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_sqrtps : GCCBuiltin<"__builtin_ia32_sqrtps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_rcpss : GCCBuiltin<"__builtin_ia32_rcpss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_rcpps : GCCBuiltin<"__builtin_ia32_rcpps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_rsqrtss : GCCBuiltin<"__builtin_ia32_rsqrtss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_rsqrtps : GCCBuiltin<"__builtin_ia32_rsqrtps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_minss : GCCBuiltin<"__builtin_ia32_minss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_minps : GCCBuiltin<"__builtin_ia32_minps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_maxss : GCCBuiltin<"__builtin_ia32_maxss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_maxps : GCCBuiltin<"__builtin_ia32_maxps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
// Logical ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_andps : GCCBuiltin<"__builtin_ia32_andps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_andnotps : GCCBuiltin<"__builtin_ia32_andnotps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_orps : GCCBuiltin<"__builtin_ia32_orps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_xorps : GCCBuiltin<"__builtin_ia32_xorps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
// Comparison ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpeqss : GCCBuiltin<"__builtin_ia32_cmpeqss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpeqps : GCCBuiltin<"__builtin_ia32_cmpeqps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpltss : GCCBuiltin<"__builtin_ia32_cmpltss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpltps : GCCBuiltin<"__builtin_ia32_cmpltps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpless : GCCBuiltin<"__builtin_ia32_cmpless">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpleps : GCCBuiltin<"__builtin_ia32_cmpleps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpgtss : GCCBuiltin<"__builtin_ia32_cmpgtss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpgtps : GCCBuiltin<"__builtin_ia32_cmpgtps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpgess : GCCBuiltin<"__builtin_ia32_cmpgess">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpgeps : GCCBuiltin<"__builtin_ia32_cmpgeps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpneqss : GCCBuiltin<"__builtin_ia32_cmpneqss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpneqps : GCCBuiltin<"__builtin_ia32_cmpneqps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpnltss : GCCBuiltin<"__builtin_ia32_cmpnltss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpnltps : GCCBuiltin<"__builtin_ia32_cmpnltps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpnless : GCCBuiltin<"__builtin_ia32_cmpnless">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpnleps : GCCBuiltin<"__builtin_ia32_cmpnleps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpngtss : GCCBuiltin<"__builtin_ia32_cmpngtss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpngtps : GCCBuiltin<"__builtin_ia32_cmpngtps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpngess : GCCBuiltin<"__builtin_ia32_cmpngess">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpngeps : GCCBuiltin<"__builtin_ia32_cmpngeps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpordss : GCCBuiltin<"__builtin_ia32_cmpordss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpordps : GCCBuiltin<"__builtin_ia32_cmpordps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpunordss : GCCBuiltin<"__builtin_ia32_cmpunordss">,
Intrinsic<[llvm_float_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cmpunordps : GCCBuiltin<"__builtin_ia32_cmpunordps">,
Intrinsic<[llvm_v4f32_ty, llvm_v4f32_ty,
llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_comieqss : GCCBuiltin<"__builtin_ia32_comieq">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_comiltss : GCCBuiltin<"__builtin_ia32_comilt">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_comiless : GCCBuiltin<"__Builtin_ia32_comile">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_comigtss : GCCBuiltin<"__builtin_ia32_comigt">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_comigess : GCCBuiltin<"__builtin_ia32_comige">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_comineqss : GCCBuiltin<"__builtin_ia32_comineq">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ucomieqss : GCCBuiltin<"__builtin_ia32_ucomieq">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ucomiltss : GCCBuiltin<"__builtin_ia32_ucomilt">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ucomiless : GCCBuiltin<"__Builtin_ia32_ucomile">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ucomigtss : GCCBuiltin<"__builtin_ia32_ucomigt">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ucomigess : GCCBuiltin<"__builtin_ia32_ucomige">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ucomineqss : GCCBuiltin<"__builtin_ia32_ucomineq">,
Intrinsic<[llvm_int_ty, llvm_float_ty,
llvm_float_ty], [InstrNoMem]>;
}
// Conversion ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cvtss2si : GCCBuiltin<"__builtin_ia32_cvtss2si">,
Intrinsic<[llvm_int_ty, llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cvtps2pi : GCCBuiltin<"__builtin_ia32_cvtps2pi">,
Intrinsic<[llvm_v2i32_ty, llvm_v4i32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cvttss2si : GCCBuiltin<"__builtin_ia32_cvttss2si">,
Intrinsic<[llvm_int_ty, llvm_float_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cvttps2pi : GCCBuiltin<"__builtin_ia32_cvttps2pi">,
Intrinsic<[llvm_v2i32_ty, llvm_v4i32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cvtsi2ss : GCCBuiltin<"__builtin_ia32_cvtsi2ss">,
Intrinsic<[llvm_float_ty, llvm_int_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_cvtpi2ps : GCCBuiltin<"__builtin_ia32_cvtpi2ps">,
Intrinsic<[llvm_v4f32_ty, llvm_v2i32_ty], [InstrNoMem]>;
}
// SIMD load ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_loadhps : GCCBuiltin<"__builtin_ia32_loadhps">,
Intrinsic<[llvm_v4f32_ty, llvm_ptr_ty], [IntrReadMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_loadlps : GCCBuiltin<"__builtin_ia32_loadlps">,
Intrinsic<[llvm_v4f32_ty, llvm_ptr_ty], [IntrReadMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_loadups : GCCBuiltin<"__builtin_ia32_loadups">,
Intrinsic<[llvm_v4f32_ty, llvm_ptr_ty], [IntrReadMem]>;
}
// SIMD store ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_storehps : GCCBuiltin<"__builtin_ia32_storehps">,
Intrinsic<[llvm_ptr_ty, llvm_v4f32_ty], [IntrWriteMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_storelps : GCCBuiltin<"__builtin_ia32_storelps">,
Intrinsic<[llvm_ptr_ty, llvm_v4f32_ty], [IntrWriteMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_storeups : GCCBuiltin<"__builtin_ia32_storeups">,
Intrinsic<[llvm_ptr_ty, llvm_v4f32_ty], [IntrWriteMem]>;
}
// Cacheability support ops
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_prefetch : GCCBuiltin<"__builtin_ia32_prefetch">,
Intrinsic<[llvm_ptr_ty, llvm_int_ty], [IntrWriteMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_movntq : GCCBuiltin<"__builtin_ia32_movntq">,
Intrinsic<[llvm_ptr_ty, llvm_v2i32_ty], [IntrWriteMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_movntps : GCCBuiltin<"__builtin_ia32_movntps">,
Intrinsic<[llvm_ptr_ty, llvm_v4f32_ty], [IntrWriteMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_sfence : GCCBuiltin<"__builtin_ia32_sfence">,
Intrinsic<[llvm_void_ty], [IntrWriteMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_movmskps : GCCBuiltin<"__builtin_ia32_movmskps">,
Intrinsic<[llvm_int_ty, llvm_v4f32_ty], [InstrNoMem]>;
}
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse_ldmxcsr : GCCBuiltin<"__builtin_ia32_ldmxcsr">,
Intrinsic<[llvm_void_ty, llvm_ptr_ty], [IntrWriteMem]>;
}
// SSE2
let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
def int_x86_sse2_movmskpd : GCCBuiltin<"__builtin_ia32_movmskpd">,
Intrinsic<[llvm_int_ty, llvm_v2f64_ty], [InstrNoMem]>;
}
|