Home | History | Annotate | Download | only in llvm
      1 //===- IntrinsicsX86.td - Defines X86 intrinsics -----------*- tablegen -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 //
     10 // This file defines all of the X86-specific intrinsics.
     11 //
     12 //===----------------------------------------------------------------------===//
     13 
     14 //===----------------------------------------------------------------------===//
     15 // Interrupt traps
     16 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
     17   def int_x86_int : Intrinsic<[], [llvm_i8_ty]>;
     18 }
     19 
     20 //===----------------------------------------------------------------------===//
     21 // 3DNow!
     22 
     23 let TargetPrefix = "x86" in {
     24   def int_x86_3dnow_pavgusb : GCCBuiltin<"__builtin_ia32_pavgusb">,
     25               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     26                         [IntrNoMem]>;
     27   def int_x86_3dnow_pf2id : GCCBuiltin<"__builtin_ia32_pf2id">,
     28               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     29   def int_x86_3dnow_pfacc : GCCBuiltin<"__builtin_ia32_pfacc">,
     30               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     31                         [IntrNoMem]>;
     32   def int_x86_3dnow_pfadd : GCCBuiltin<"__builtin_ia32_pfadd">,
     33               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     34                         [IntrNoMem]>;
     35   def int_x86_3dnow_pfcmpeq : GCCBuiltin<"__builtin_ia32_pfcmpeq">,
     36               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     37                         [IntrNoMem]>;
     38   def int_x86_3dnow_pfcmpge : GCCBuiltin<"__builtin_ia32_pfcmpge">,
     39               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     40                         [IntrNoMem]>;
     41   def int_x86_3dnow_pfcmpgt : GCCBuiltin<"__builtin_ia32_pfcmpgt">,
     42               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     43                         [IntrNoMem]>;
     44   def int_x86_3dnow_pfmax : GCCBuiltin<"__builtin_ia32_pfmax">,
     45               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     46                         [IntrNoMem]>;
     47   def int_x86_3dnow_pfmin : GCCBuiltin<"__builtin_ia32_pfmin">,
     48               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     49                         [IntrNoMem]>;
     50   def int_x86_3dnow_pfmul : GCCBuiltin<"__builtin_ia32_pfmul">,
     51               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     52                         [IntrNoMem]>;
     53   def int_x86_3dnow_pfrcp : GCCBuiltin<"__builtin_ia32_pfrcp">,
     54               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     55   def int_x86_3dnow_pfrcpit1 : GCCBuiltin<"__builtin_ia32_pfrcpit1">,
     56               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     57                         [IntrNoMem]>;
     58   def int_x86_3dnow_pfrcpit2 : GCCBuiltin<"__builtin_ia32_pfrcpit2">,
     59               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     60                         [IntrNoMem]>;
     61   def int_x86_3dnow_pfrsqrt : GCCBuiltin<"__builtin_ia32_pfrsqrt">,
     62               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     63   def int_x86_3dnow_pfrsqit1 : GCCBuiltin<"__builtin_ia32_pfrsqit1">,
     64               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     65                         [IntrNoMem]>;
     66   def int_x86_3dnow_pfsub : GCCBuiltin<"__builtin_ia32_pfsub">,
     67               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     68                         [IntrNoMem]>;
     69   def int_x86_3dnow_pfsubr : GCCBuiltin<"__builtin_ia32_pfsubr">,
     70               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     71                         [IntrNoMem]>;
     72   def int_x86_3dnow_pi2fd : GCCBuiltin<"__builtin_ia32_pi2fd">,
     73               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     74   def int_x86_3dnow_pmulhrw : GCCBuiltin<"__builtin_ia32_pmulhrw">,
     75               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     76                         [IntrNoMem]>;
     77 }
     78 
     79 //===----------------------------------------------------------------------===//
     80 // 3DNow! extensions
     81 
     82 let TargetPrefix = "x86" in {
     83   def int_x86_3dnowa_pf2iw : GCCBuiltin<"__builtin_ia32_pf2iw">,
     84               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     85   def int_x86_3dnowa_pfnacc : GCCBuiltin<"__builtin_ia32_pfnacc">,
     86               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     87                         [IntrNoMem]>;
     88   def int_x86_3dnowa_pfpnacc : GCCBuiltin<"__builtin_ia32_pfpnacc">,
     89               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
     90                         [IntrNoMem]>;
     91   def int_x86_3dnowa_pi2fw : GCCBuiltin<"__builtin_ia32_pi2fw">,
     92               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     93   def int_x86_3dnowa_pswapd :
     94               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
     95 }
     96 
     97 //===----------------------------------------------------------------------===//
     98 // SSE1
     99 
    100 // Arithmetic ops
    101 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    102   def int_x86_sse_add_ss : GCCBuiltin<"__builtin_ia32_addss">,
    103               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    104                          llvm_v4f32_ty], [IntrNoMem]>;
    105   def int_x86_sse_sub_ss : GCCBuiltin<"__builtin_ia32_subss">,
    106               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    107                          llvm_v4f32_ty], [IntrNoMem]>;
    108   def int_x86_sse_mul_ss : GCCBuiltin<"__builtin_ia32_mulss">,
    109               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    110                          llvm_v4f32_ty], [IntrNoMem]>;
    111   def int_x86_sse_div_ss : GCCBuiltin<"__builtin_ia32_divss">,
    112               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    113                          llvm_v4f32_ty], [IntrNoMem]>;
    114   def int_x86_sse_sqrt_ss : GCCBuiltin<"__builtin_ia32_sqrtss">,
    115               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
    116                         [IntrNoMem]>;
    117   def int_x86_sse_sqrt_ps : GCCBuiltin<"__builtin_ia32_sqrtps">,
    118               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
    119                         [IntrNoMem]>;
    120   def int_x86_sse_rcp_ss : GCCBuiltin<"__builtin_ia32_rcpss">,
    121               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
    122                         [IntrNoMem]>;
    123   def int_x86_sse_rcp_ps : GCCBuiltin<"__builtin_ia32_rcpps">,
    124               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
    125                         [IntrNoMem]>;
    126   def int_x86_sse_rsqrt_ss : GCCBuiltin<"__builtin_ia32_rsqrtss">,
    127               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
    128                         [IntrNoMem]>;
    129   def int_x86_sse_rsqrt_ps : GCCBuiltin<"__builtin_ia32_rsqrtps">,
    130               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty],
    131                         [IntrNoMem]>;
    132   def int_x86_sse_min_ss : GCCBuiltin<"__builtin_ia32_minss">,
    133               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    134                          llvm_v4f32_ty], [IntrNoMem]>;
    135   def int_x86_sse_min_ps : GCCBuiltin<"__builtin_ia32_minps">,
    136               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    137                          llvm_v4f32_ty], [IntrNoMem]>;
    138   def int_x86_sse_max_ss : GCCBuiltin<"__builtin_ia32_maxss">,
    139               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    140                          llvm_v4f32_ty], [IntrNoMem]>;
    141   def int_x86_sse_max_ps : GCCBuiltin<"__builtin_ia32_maxps">,
    142               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    143                          llvm_v4f32_ty], [IntrNoMem]>;
    144 }
    145 
    146 // Comparison ops
    147 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    148   def int_x86_sse_cmp_ss : GCCBuiltin<"__builtin_ia32_cmpss">,
    149               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    150                          llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
    151   def int_x86_sse_cmp_ps : GCCBuiltin<"__builtin_ia32_cmpps">,
    152               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    153                          llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
    154   def int_x86_sse_comieq_ss : GCCBuiltin<"__builtin_ia32_comieq">,
    155               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    156                          llvm_v4f32_ty], [IntrNoMem]>;
    157   def int_x86_sse_comilt_ss : GCCBuiltin<"__builtin_ia32_comilt">,
    158               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    159                          llvm_v4f32_ty], [IntrNoMem]>;
    160   def int_x86_sse_comile_ss : GCCBuiltin<"__builtin_ia32_comile">,
    161               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    162                          llvm_v4f32_ty], [IntrNoMem]>;
    163   def int_x86_sse_comigt_ss : GCCBuiltin<"__builtin_ia32_comigt">,
    164               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    165                          llvm_v4f32_ty], [IntrNoMem]>;
    166   def int_x86_sse_comige_ss : GCCBuiltin<"__builtin_ia32_comige">,
    167               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    168                          llvm_v4f32_ty], [IntrNoMem]>;
    169   def int_x86_sse_comineq_ss : GCCBuiltin<"__builtin_ia32_comineq">,
    170               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    171                          llvm_v4f32_ty], [IntrNoMem]>;
    172   def int_x86_sse_ucomieq_ss : GCCBuiltin<"__builtin_ia32_ucomieq">,
    173               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    174                          llvm_v4f32_ty], [IntrNoMem]>;
    175   def int_x86_sse_ucomilt_ss : GCCBuiltin<"__builtin_ia32_ucomilt">,
    176               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    177                          llvm_v4f32_ty], [IntrNoMem]>;
    178   def int_x86_sse_ucomile_ss : GCCBuiltin<"__builtin_ia32_ucomile">,
    179               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    180                          llvm_v4f32_ty], [IntrNoMem]>;
    181   def int_x86_sse_ucomigt_ss : GCCBuiltin<"__builtin_ia32_ucomigt">,
    182               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    183                          llvm_v4f32_ty], [IntrNoMem]>;
    184   def int_x86_sse_ucomige_ss : GCCBuiltin<"__builtin_ia32_ucomige">,
    185               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    186                          llvm_v4f32_ty], [IntrNoMem]>;
    187   def int_x86_sse_ucomineq_ss : GCCBuiltin<"__builtin_ia32_ucomineq">,
    188               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
    189                          llvm_v4f32_ty], [IntrNoMem]>;
    190 }
    191 
    192 
    193 // Conversion ops
    194 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    195   def int_x86_sse_cvtss2si : GCCBuiltin<"__builtin_ia32_cvtss2si">,
    196               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    197   def int_x86_sse_cvtss2si64 : GCCBuiltin<"__builtin_ia32_cvtss2si64">,
    198               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    199   def int_x86_sse_cvttss2si : GCCBuiltin<"__builtin_ia32_cvttss2si">,
    200               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    201   def int_x86_sse_cvttss2si64 : GCCBuiltin<"__builtin_ia32_cvttss2si64">,
    202               Intrinsic<[llvm_i64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    203   def int_x86_sse_cvtsi2ss : GCCBuiltin<"__builtin_ia32_cvtsi2ss">,
    204               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    205                          llvm_i32_ty], [IntrNoMem]>;
    206   def int_x86_sse_cvtsi642ss : GCCBuiltin<"__builtin_ia32_cvtsi642ss">,
    207               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    208                          llvm_i64_ty], [IntrNoMem]>;
    209   def int_x86_sse_cvtps2pi : GCCBuiltin<"__builtin_ia32_cvtps2pi">,
    210               Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    211   def int_x86_sse_cvttps2pi: GCCBuiltin<"__builtin_ia32_cvttps2pi">,
    212               Intrinsic<[llvm_x86mmx_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    213   def int_x86_sse_cvtpi2ps : GCCBuiltin<"__builtin_ia32_cvtpi2ps">,
    214               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    215                          llvm_x86mmx_ty], [IntrNoMem]>;
    216 }
    217 
    218 // SIMD store ops
    219 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    220   def int_x86_sse_storeu_ps : GCCBuiltin<"__builtin_ia32_storeups">,
    221               Intrinsic<[], [llvm_ptr_ty,
    222                          llvm_v4f32_ty], []>;
    223 }
    224 
    225 // Cacheability support ops
    226 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    227   def int_x86_sse_sfence : GCCBuiltin<"__builtin_ia32_sfence">,
    228               Intrinsic<[], [], []>;
    229 }
    230 
    231 // Control register.
    232 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    233   def int_x86_sse_stmxcsr :
    234               Intrinsic<[], [llvm_ptr_ty], []>;
    235   def int_x86_sse_ldmxcsr :
    236               Intrinsic<[], [llvm_ptr_ty], []>;
    237 }
    238 
    239 // Misc.
    240 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    241   def int_x86_sse_movmsk_ps : GCCBuiltin<"__builtin_ia32_movmskps">,
    242               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    243 }
    244 
    245 //===----------------------------------------------------------------------===//
    246 // SSE2
    247 
    248 // FP arithmetic ops
    249 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    250   def int_x86_sse2_add_sd : GCCBuiltin<"__builtin_ia32_addsd">,
    251               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    252                          llvm_v2f64_ty], [IntrNoMem]>;
    253   def int_x86_sse2_sub_sd : GCCBuiltin<"__builtin_ia32_subsd">,
    254               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    255                          llvm_v2f64_ty], [IntrNoMem]>;
    256   def int_x86_sse2_mul_sd : GCCBuiltin<"__builtin_ia32_mulsd">,
    257               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    258                          llvm_v2f64_ty], [IntrNoMem]>;
    259   def int_x86_sse2_div_sd : GCCBuiltin<"__builtin_ia32_divsd">,
    260               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    261                          llvm_v2f64_ty], [IntrNoMem]>;
    262   def int_x86_sse2_sqrt_sd : GCCBuiltin<"__builtin_ia32_sqrtsd">,
    263               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty],
    264                         [IntrNoMem]>;
    265   def int_x86_sse2_sqrt_pd : GCCBuiltin<"__builtin_ia32_sqrtpd">,
    266               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty],
    267                         [IntrNoMem]>;
    268   def int_x86_sse2_min_sd : GCCBuiltin<"__builtin_ia32_minsd">,
    269               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    270                          llvm_v2f64_ty], [IntrNoMem]>;
    271   def int_x86_sse2_min_pd : GCCBuiltin<"__builtin_ia32_minpd">,
    272               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    273                          llvm_v2f64_ty], [IntrNoMem]>;
    274   def int_x86_sse2_max_sd : GCCBuiltin<"__builtin_ia32_maxsd">,
    275               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    276                          llvm_v2f64_ty], [IntrNoMem]>;
    277   def int_x86_sse2_max_pd : GCCBuiltin<"__builtin_ia32_maxpd">,
    278               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    279                          llvm_v2f64_ty], [IntrNoMem]>;
    280 }
    281 
    282 // FP comparison ops
    283 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    284   def int_x86_sse2_cmp_sd : GCCBuiltin<"__builtin_ia32_cmpsd">,
    285               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    286                          llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
    287   def int_x86_sse2_cmp_pd : GCCBuiltin<"__builtin_ia32_cmppd">,
    288               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    289                          llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
    290   def int_x86_sse2_comieq_sd : GCCBuiltin<"__builtin_ia32_comisdeq">,
    291               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    292                          llvm_v2f64_ty], [IntrNoMem]>;
    293   def int_x86_sse2_comilt_sd : GCCBuiltin<"__builtin_ia32_comisdlt">,
    294               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    295                          llvm_v2f64_ty], [IntrNoMem]>;
    296   def int_x86_sse2_comile_sd : GCCBuiltin<"__builtin_ia32_comisdle">,
    297               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    298                          llvm_v2f64_ty], [IntrNoMem]>;
    299   def int_x86_sse2_comigt_sd : GCCBuiltin<"__builtin_ia32_comisdgt">,
    300               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    301                          llvm_v2f64_ty], [IntrNoMem]>;
    302   def int_x86_sse2_comige_sd : GCCBuiltin<"__builtin_ia32_comisdge">,
    303               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    304                          llvm_v2f64_ty], [IntrNoMem]>;
    305   def int_x86_sse2_comineq_sd : GCCBuiltin<"__builtin_ia32_comisdneq">,
    306               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    307                          llvm_v2f64_ty], [IntrNoMem]>;
    308   def int_x86_sse2_ucomieq_sd : GCCBuiltin<"__builtin_ia32_ucomisdeq">,
    309               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    310                          llvm_v2f64_ty], [IntrNoMem]>;
    311   def int_x86_sse2_ucomilt_sd : GCCBuiltin<"__builtin_ia32_ucomisdlt">,
    312               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    313                          llvm_v2f64_ty], [IntrNoMem]>;
    314   def int_x86_sse2_ucomile_sd : GCCBuiltin<"__builtin_ia32_ucomisdle">,
    315               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    316                          llvm_v2f64_ty], [IntrNoMem]>;
    317   def int_x86_sse2_ucomigt_sd : GCCBuiltin<"__builtin_ia32_ucomisdgt">,
    318               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    319                          llvm_v2f64_ty], [IntrNoMem]>;
    320   def int_x86_sse2_ucomige_sd : GCCBuiltin<"__builtin_ia32_ucomisdge">,
    321               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    322                          llvm_v2f64_ty], [IntrNoMem]>;
    323   def int_x86_sse2_ucomineq_sd : GCCBuiltin<"__builtin_ia32_ucomisdneq">,
    324               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
    325                          llvm_v2f64_ty], [IntrNoMem]>;
    326 }
    327 
    328 // Integer arithmetic ops.
    329 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    330   def int_x86_sse2_padds_b : GCCBuiltin<"__builtin_ia32_paddsb128">,
    331               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    332                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
    333   def int_x86_sse2_padds_w : GCCBuiltin<"__builtin_ia32_paddsw128">,
    334               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    335                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    336   def int_x86_sse2_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb128">,
    337               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    338                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
    339   def int_x86_sse2_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw128">,
    340               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    341                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    342   def int_x86_sse2_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb128">,
    343               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    344                          llvm_v16i8_ty], [IntrNoMem]>;
    345   def int_x86_sse2_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw128">,
    346               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    347                          llvm_v8i16_ty], [IntrNoMem]>;
    348   def int_x86_sse2_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb128">,
    349               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    350                          llvm_v16i8_ty], [IntrNoMem]>;
    351   def int_x86_sse2_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw128">,
    352               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    353                          llvm_v8i16_ty], [IntrNoMem]>;
    354   def int_x86_sse2_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw128">,
    355               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    356                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    357   def int_x86_sse2_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw128">,
    358               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    359                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    360   def int_x86_sse2_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq128">,
    361               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty,
    362                          llvm_v4i32_ty], [IntrNoMem, Commutative]>;
    363   def int_x86_sse2_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd128">,
    364               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty,
    365                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    366   def int_x86_sse2_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb128">,
    367               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    368                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
    369   def int_x86_sse2_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw128">,
    370               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    371                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    372   def int_x86_sse2_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub128">,
    373               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    374                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
    375   def int_x86_sse2_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw128">,
    376               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    377                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    378   def int_x86_sse2_pminu_b : GCCBuiltin<"__builtin_ia32_pminub128">,
    379               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    380                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
    381   def int_x86_sse2_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw128">,
    382               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    383                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    384   def int_x86_sse2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw128">,
    385               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty,
    386                          llvm_v16i8_ty], [IntrNoMem, Commutative]>;
    387 }
    388 
    389 // Integer shift ops.
    390 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    391   def int_x86_sse2_psll_w : GCCBuiltin<"__builtin_ia32_psllw128">,
    392               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    393                          llvm_v8i16_ty], [IntrNoMem]>;
    394   def int_x86_sse2_psll_d : GCCBuiltin<"__builtin_ia32_pslld128">,
    395               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    396                          llvm_v4i32_ty], [IntrNoMem]>;
    397   def int_x86_sse2_psll_q : GCCBuiltin<"__builtin_ia32_psllq128">,
    398               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    399                          llvm_v2i64_ty], [IntrNoMem]>;
    400   def int_x86_sse2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw128">,
    401               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    402                          llvm_v8i16_ty], [IntrNoMem]>;
    403   def int_x86_sse2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld128">,
    404               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    405                          llvm_v4i32_ty], [IntrNoMem]>;
    406   def int_x86_sse2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq128">,
    407               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    408                          llvm_v2i64_ty], [IntrNoMem]>;
    409   def int_x86_sse2_psra_w : GCCBuiltin<"__builtin_ia32_psraw128">,
    410               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    411                          llvm_v8i16_ty], [IntrNoMem]>;
    412   def int_x86_sse2_psra_d : GCCBuiltin<"__builtin_ia32_psrad128">,
    413               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    414                          llvm_v4i32_ty], [IntrNoMem]>;
    415 
    416   def int_x86_sse2_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi128">,
    417               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    418                          llvm_i32_ty], [IntrNoMem]>;
    419   def int_x86_sse2_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi128">,
    420               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    421                          llvm_i32_ty], [IntrNoMem]>;
    422   def int_x86_sse2_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi128">,
    423               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    424                          llvm_i32_ty], [IntrNoMem]>;
    425   def int_x86_sse2_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi128">,
    426               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    427                          llvm_i32_ty], [IntrNoMem]>;
    428   def int_x86_sse2_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi128">,
    429               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    430                          llvm_i32_ty], [IntrNoMem]>;
    431   def int_x86_sse2_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi128">,
    432               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    433                          llvm_i32_ty], [IntrNoMem]>;
    434   def int_x86_sse2_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi128">,
    435               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    436                          llvm_i32_ty], [IntrNoMem]>;
    437   def int_x86_sse2_psrai_d : GCCBuiltin<"__builtin_ia32_psradi128">,
    438               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    439                          llvm_i32_ty], [IntrNoMem]>;
    440 
    441   def int_x86_sse2_psll_dq : GCCBuiltin<"__builtin_ia32_pslldqi128">,
    442               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    443                          llvm_i32_ty], [IntrNoMem]>;
    444   def int_x86_sse2_psrl_dq : GCCBuiltin<"__builtin_ia32_psrldqi128">,
    445               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    446                          llvm_i32_ty], [IntrNoMem]>;
    447   def int_x86_sse2_psll_dq_bs : GCCBuiltin<"__builtin_ia32_pslldqi128_byteshift">,
    448               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    449                          llvm_i32_ty], [IntrNoMem]>;
    450   def int_x86_sse2_psrl_dq_bs : GCCBuiltin<"__builtin_ia32_psrldqi128_byteshift">,
    451               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty,
    452                          llvm_i32_ty], [IntrNoMem]>;
    453 }
    454 
    455 // Conversion ops
    456 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    457   def int_x86_sse2_cvtdq2pd : GCCBuiltin<"__builtin_ia32_cvtdq2pd">,
    458               Intrinsic<[llvm_v2f64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
    459   def int_x86_sse2_cvtdq2ps : GCCBuiltin<"__builtin_ia32_cvtdq2ps">,
    460               Intrinsic<[llvm_v4f32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
    461   def int_x86_sse2_cvtpd2dq : GCCBuiltin<"__builtin_ia32_cvtpd2dq">,
    462               Intrinsic<[llvm_v4i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    463   def int_x86_sse2_cvttpd2dq : GCCBuiltin<"__builtin_ia32_cvttpd2dq">,
    464               Intrinsic<[llvm_v4i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    465   def int_x86_sse2_cvtpd2ps : GCCBuiltin<"__builtin_ia32_cvtpd2ps">,
    466               Intrinsic<[llvm_v4f32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    467   def int_x86_sse2_cvtps2dq : GCCBuiltin<"__builtin_ia32_cvtps2dq">,
    468               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    469   def int_x86_sse2_cvttps2dq : GCCBuiltin<"__builtin_ia32_cvttps2dq">,
    470               Intrinsic<[llvm_v4i32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    471   def int_x86_sse2_cvtps2pd : GCCBuiltin<"__builtin_ia32_cvtps2pd">,
    472               Intrinsic<[llvm_v2f64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
    473   def int_x86_sse2_cvtsd2si : GCCBuiltin<"__builtin_ia32_cvtsd2si">,
    474               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    475   def int_x86_sse2_cvtsd2si64 : GCCBuiltin<"__builtin_ia32_cvtsd2si64">,
    476               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    477   def int_x86_sse2_cvttsd2si : GCCBuiltin<"__builtin_ia32_cvttsd2si">,
    478               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    479   def int_x86_sse2_cvttsd2si64 : GCCBuiltin<"__builtin_ia32_cvttsd2si64">,
    480               Intrinsic<[llvm_i64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    481   def int_x86_sse2_cvtsi2sd : GCCBuiltin<"__builtin_ia32_cvtsi2sd">,
    482               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    483                          llvm_i32_ty], [IntrNoMem]>;
    484   def int_x86_sse2_cvtsi642sd : GCCBuiltin<"__builtin_ia32_cvtsi642sd">,
    485               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    486                          llvm_i64_ty], [IntrNoMem]>;
    487   def int_x86_sse2_cvtsd2ss : GCCBuiltin<"__builtin_ia32_cvtsd2ss">,
    488               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    489                          llvm_v2f64_ty], [IntrNoMem]>;
    490   def int_x86_sse2_cvtss2sd : GCCBuiltin<"__builtin_ia32_cvtss2sd">,
    491               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    492                          llvm_v4f32_ty], [IntrNoMem]>;
    493   def int_x86_sse_cvtpd2pi : GCCBuiltin<"__builtin_ia32_cvtpd2pi">,
    494               Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    495   def int_x86_sse_cvttpd2pi: GCCBuiltin<"__builtin_ia32_cvttpd2pi">,
    496               Intrinsic<[llvm_x86mmx_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    497   def int_x86_sse_cvtpi2pd : GCCBuiltin<"__builtin_ia32_cvtpi2pd">,
    498               Intrinsic<[llvm_v2f64_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
    499 }
    500 
    501 // SIMD store ops
    502 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    503   def int_x86_sse2_storeu_pd : GCCBuiltin<"__builtin_ia32_storeupd">,
    504               Intrinsic<[], [llvm_ptr_ty,
    505                          llvm_v2f64_ty], []>;
    506   def int_x86_sse2_storeu_dq : GCCBuiltin<"__builtin_ia32_storedqu">,
    507               Intrinsic<[], [llvm_ptr_ty,
    508                          llvm_v16i8_ty], []>;
    509   def int_x86_sse2_storel_dq : GCCBuiltin<"__builtin_ia32_storelv4si">,
    510               Intrinsic<[], [llvm_ptr_ty,
    511                          llvm_v4i32_ty], []>;
    512 }
    513 
    514 // Misc.
    515 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    516   def int_x86_sse2_packsswb_128 : GCCBuiltin<"__builtin_ia32_packsswb128">,
    517               Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
    518                          llvm_v8i16_ty], [IntrNoMem]>;
    519   def int_x86_sse2_packssdw_128 : GCCBuiltin<"__builtin_ia32_packssdw128">,
    520               Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty,
    521                          llvm_v4i32_ty], [IntrNoMem]>;
    522   def int_x86_sse2_packuswb_128 : GCCBuiltin<"__builtin_ia32_packuswb128">,
    523               Intrinsic<[llvm_v16i8_ty], [llvm_v8i16_ty,
    524                          llvm_v8i16_ty], [IntrNoMem]>;
    525   def int_x86_sse2_movmsk_pd : GCCBuiltin<"__builtin_ia32_movmskpd">,
    526               Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty], [IntrNoMem]>;
    527   def int_x86_sse2_pmovmskb_128 : GCCBuiltin<"__builtin_ia32_pmovmskb128">,
    528               Intrinsic<[llvm_i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
    529   def int_x86_sse2_maskmov_dqu : GCCBuiltin<"__builtin_ia32_maskmovdqu">,
    530               Intrinsic<[], [llvm_v16i8_ty,
    531                          llvm_v16i8_ty, llvm_ptr_ty], []>;
    532   def int_x86_sse2_clflush : GCCBuiltin<"__builtin_ia32_clflush">,
    533               Intrinsic<[], [llvm_ptr_ty], []>;
    534   def int_x86_sse2_lfence : GCCBuiltin<"__builtin_ia32_lfence">,
    535               Intrinsic<[], [], []>;
    536   def int_x86_sse2_mfence : GCCBuiltin<"__builtin_ia32_mfence">,
    537               Intrinsic<[], [], []>;
    538 }
    539 
    540 //===----------------------------------------------------------------------===//
    541 // SSE3
    542 
    543 // Addition / subtraction ops.
    544 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    545   def int_x86_sse3_addsub_ps : GCCBuiltin<"__builtin_ia32_addsubps">,
    546               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    547                          llvm_v4f32_ty], [IntrNoMem]>;
    548   def int_x86_sse3_addsub_pd : GCCBuiltin<"__builtin_ia32_addsubpd">,
    549               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    550                          llvm_v2f64_ty], [IntrNoMem]>;
    551 }
    552 
    553 // Horizontal ops.
    554 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    555   def int_x86_sse3_hadd_ps : GCCBuiltin<"__builtin_ia32_haddps">,
    556               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    557                          llvm_v4f32_ty], [IntrNoMem]>;
    558   def int_x86_sse3_hadd_pd : GCCBuiltin<"__builtin_ia32_haddpd">,
    559               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    560                          llvm_v2f64_ty], [IntrNoMem]>;
    561   def int_x86_sse3_hsub_ps : GCCBuiltin<"__builtin_ia32_hsubps">,
    562               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    563                          llvm_v4f32_ty], [IntrNoMem]>;
    564   def int_x86_sse3_hsub_pd : GCCBuiltin<"__builtin_ia32_hsubpd">,
    565               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    566                          llvm_v2f64_ty], [IntrNoMem]>;
    567 }
    568 
    569 // Specialized unaligned load.
    570 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    571   def int_x86_sse3_ldu_dq : GCCBuiltin<"__builtin_ia32_lddqu">,
    572               Intrinsic<[llvm_v16i8_ty], [llvm_ptr_ty], [IntrReadMem]>;
    573 }
    574 
    575 // Thread synchronization ops.
    576 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    577   def int_x86_sse3_monitor : GCCBuiltin<"__builtin_ia32_monitor">,
    578               Intrinsic<[], [llvm_ptr_ty,
    579                          llvm_i32_ty, llvm_i32_ty], []>;
    580   def int_x86_sse3_mwait : GCCBuiltin<"__builtin_ia32_mwait">,
    581               Intrinsic<[], [llvm_i32_ty,
    582                          llvm_i32_ty], []>;
    583 }
    584 
    585 //===----------------------------------------------------------------------===//
    586 // SSSE3
    587 
    588 // Horizontal arithmetic ops
    589 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    590   def int_x86_ssse3_phadd_w         : GCCBuiltin<"__builtin_ia32_phaddw">,
    591               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    592                          llvm_x86mmx_ty], [IntrNoMem]>;
    593   def int_x86_ssse3_phadd_w_128     : GCCBuiltin<"__builtin_ia32_phaddw128">,
    594               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    595                          llvm_v8i16_ty], [IntrNoMem]>;
    596 
    597   def int_x86_ssse3_phadd_d         : GCCBuiltin<"__builtin_ia32_phaddd">,
    598               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    599                          llvm_x86mmx_ty], [IntrNoMem]>;
    600   def int_x86_ssse3_phadd_d_128     : GCCBuiltin<"__builtin_ia32_phaddd128">,
    601               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    602                          llvm_v4i32_ty], [IntrNoMem]>;
    603 
    604   def int_x86_ssse3_phadd_sw        : GCCBuiltin<"__builtin_ia32_phaddsw">,
    605               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    606                          llvm_x86mmx_ty], [IntrNoMem]>;
    607   def int_x86_ssse3_phadd_sw_128    : GCCBuiltin<"__builtin_ia32_phaddsw128">,
    608               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    609                          llvm_v8i16_ty], [IntrNoMem]>;
    610 
    611   def int_x86_ssse3_phsub_w         : GCCBuiltin<"__builtin_ia32_phsubw">,
    612               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    613                          llvm_x86mmx_ty], [IntrNoMem]>;
    614   def int_x86_ssse3_phsub_w_128     : GCCBuiltin<"__builtin_ia32_phsubw128">,
    615               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    616                          llvm_v8i16_ty], [IntrNoMem]>;
    617 
    618   def int_x86_ssse3_phsub_d         : GCCBuiltin<"__builtin_ia32_phsubd">,
    619               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    620                          llvm_x86mmx_ty], [IntrNoMem]>;
    621   def int_x86_ssse3_phsub_d_128     : GCCBuiltin<"__builtin_ia32_phsubd128">,
    622               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    623                          llvm_v4i32_ty], [IntrNoMem]>;
    624 
    625   def int_x86_ssse3_phsub_sw        : GCCBuiltin<"__builtin_ia32_phsubsw">,
    626               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    627                          llvm_x86mmx_ty], [IntrNoMem]>;
    628   def int_x86_ssse3_phsub_sw_128    : GCCBuiltin<"__builtin_ia32_phsubsw128">,
    629               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    630                          llvm_v8i16_ty], [IntrNoMem]>;
    631 
    632   def int_x86_ssse3_pmadd_ub_sw     : GCCBuiltin<"__builtin_ia32_pmaddubsw">,
    633               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    634                          llvm_x86mmx_ty], [IntrNoMem]>;
    635   def int_x86_ssse3_pmadd_ub_sw_128 : GCCBuiltin<"__builtin_ia32_pmaddubsw128">,
    636               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty,
    637                          llvm_v16i8_ty], [IntrNoMem]>;
    638 }
    639 
    640 // Packed multiply high with round and scale
    641 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    642   def int_x86_ssse3_pmul_hr_sw      : GCCBuiltin<"__builtin_ia32_pmulhrsw">,
    643               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    644                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
    645   def int_x86_ssse3_pmul_hr_sw_128  : GCCBuiltin<"__builtin_ia32_pmulhrsw128">,
    646               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    647                          llvm_v8i16_ty], [IntrNoMem, Commutative]>;
    648 }
    649 
    650 // Shuffle ops
    651 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    652   def int_x86_ssse3_pshuf_b         : GCCBuiltin<"__builtin_ia32_pshufb">,
    653               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    654                          llvm_x86mmx_ty], [IntrNoMem]>;
    655   def int_x86_ssse3_pshuf_b_128     : GCCBuiltin<"__builtin_ia32_pshufb128">,
    656               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    657                          llvm_v16i8_ty], [IntrNoMem]>;
    658   def int_x86_sse_pshuf_w           : GCCBuiltin<"__builtin_ia32_pshufw">,
    659               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_i8_ty],
    660                          [IntrNoMem]>;
    661 }
    662 
    663 // Sign ops
    664 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    665   def int_x86_ssse3_psign_b         : GCCBuiltin<"__builtin_ia32_psignb">,
    666               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    667                          llvm_x86mmx_ty], [IntrNoMem]>;
    668   def int_x86_ssse3_psign_b_128     : GCCBuiltin<"__builtin_ia32_psignb128">,
    669               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty,
    670                          llvm_v16i8_ty], [IntrNoMem]>;
    671 
    672   def int_x86_ssse3_psign_w         : GCCBuiltin<"__builtin_ia32_psignw">,
    673               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    674                          llvm_x86mmx_ty], [IntrNoMem]>;
    675   def int_x86_ssse3_psign_w_128     : GCCBuiltin<"__builtin_ia32_psignw128">,
    676               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty,
    677                          llvm_v8i16_ty], [IntrNoMem]>;
    678 
    679   def int_x86_ssse3_psign_d         : GCCBuiltin<"__builtin_ia32_psignd">,
    680               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
    681                          llvm_x86mmx_ty], [IntrNoMem]>;
    682   def int_x86_ssse3_psign_d_128     : GCCBuiltin<"__builtin_ia32_psignd128">,
    683               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty,
    684                          llvm_v4i32_ty], [IntrNoMem]>;
    685 }
    686 
    687 // Absolute value ops
    688 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    689   def int_x86_ssse3_pabs_b     : GCCBuiltin<"__builtin_ia32_pabsb">,
    690               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
    691   def int_x86_ssse3_pabs_b_128 : GCCBuiltin<"__builtin_ia32_pabsb128">,
    692               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
    693 
    694   def int_x86_ssse3_pabs_w     : GCCBuiltin<"__builtin_ia32_pabsw">,
    695               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
    696   def int_x86_ssse3_pabs_w_128 : GCCBuiltin<"__builtin_ia32_pabsw128">,
    697               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
    698 
    699   def int_x86_ssse3_pabs_d     : GCCBuiltin<"__builtin_ia32_pabsd">,
    700               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
    701   def int_x86_ssse3_pabs_d_128 : GCCBuiltin<"__builtin_ia32_pabsd128">,
    702               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
    703 }
    704 
    705 //===----------------------------------------------------------------------===//
    706 // SSE4.1
    707 
    708 // FP rounding ops
    709 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    710   def int_x86_sse41_round_ss        : GCCBuiltin<"__builtin_ia32_roundss">,
    711               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
    712                          llvm_i32_ty], [IntrNoMem]>;
    713   def int_x86_sse41_round_ps        : GCCBuiltin<"__builtin_ia32_roundps">,
    714               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
    715                          llvm_i32_ty], [IntrNoMem]>;
    716   def int_x86_sse41_round_sd        : GCCBuiltin<"__builtin_ia32_roundsd">,
    717               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
    718                          llvm_i32_ty], [IntrNoMem]>;
    719   def int_x86_sse41_round_pd        : GCCBuiltin<"__builtin_ia32_roundpd">,
    720               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
    721                          llvm_i32_ty], [IntrNoMem]>;
    722 }
    723 
    724 // Vector sign and zero extend
    725 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    726   def int_x86_sse41_pmovsxbd        : GCCBuiltin<"__builtin_ia32_pmovsxbd128">,
    727               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty],
    728                         [IntrNoMem]>;
    729   def int_x86_sse41_pmovsxbq        : GCCBuiltin<"__builtin_ia32_pmovsxbq128">,
    730               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty],
    731                         [IntrNoMem]>;
    732   def int_x86_sse41_pmovsxbw        : GCCBuiltin<"__builtin_ia32_pmovsxbw128">,
    733               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty],
    734                         [IntrNoMem]>;
    735   def int_x86_sse41_pmovsxdq        : GCCBuiltin<"__builtin_ia32_pmovsxdq128">,
    736               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty],
    737                         [IntrNoMem]>;
    738   def int_x86_sse41_pmovsxwd        : GCCBuiltin<"__builtin_ia32_pmovsxwd128">,
    739               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty],
    740                         [IntrNoMem]>;
    741   def int_x86_sse41_pmovsxwq        : GCCBuiltin<"__builtin_ia32_pmovsxwq128">,
    742               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty],
    743                         [IntrNoMem]>;
    744   def int_x86_sse41_pmovzxbd        : GCCBuiltin<"__builtin_ia32_pmovzxbd128">,
    745               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty],
    746                         [IntrNoMem]>;
    747   def int_x86_sse41_pmovzxbq        : GCCBuiltin<"__builtin_ia32_pmovzxbq128">,
    748               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty],
    749                         [IntrNoMem]>;
    750   def int_x86_sse41_pmovzxbw        : GCCBuiltin<"__builtin_ia32_pmovzxbw128">,
    751               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty],
    752                         [IntrNoMem]>;
    753   def int_x86_sse41_pmovzxdq        : GCCBuiltin<"__builtin_ia32_pmovzxdq128">,
    754               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty],
    755                         [IntrNoMem]>;
    756   def int_x86_sse41_pmovzxwd        : GCCBuiltin<"__builtin_ia32_pmovzxwd128">,
    757               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty],
    758                         [IntrNoMem]>;
    759   def int_x86_sse41_pmovzxwq        : GCCBuiltin<"__builtin_ia32_pmovzxwq128">,
    760               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty],
    761                         [IntrNoMem]>;
    762 }
    763 
    764 // Vector min element
    765 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    766   def int_x86_sse41_phminposuw     : GCCBuiltin<"__builtin_ia32_phminposuw128">,
    767               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty],
    768                         [IntrNoMem]>;
    769 }
    770 
    771 // Vector compare, min, max
    772 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    773   def int_x86_sse41_pmaxsb          : GCCBuiltin<"__builtin_ia32_pmaxsb128">,
    774               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
    775                         [IntrNoMem, Commutative]>;
    776   def int_x86_sse41_pmaxsd          : GCCBuiltin<"__builtin_ia32_pmaxsd128">,
    777               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
    778                         [IntrNoMem, Commutative]>;
    779   def int_x86_sse41_pmaxud          : GCCBuiltin<"__builtin_ia32_pmaxud128">,
    780               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
    781                         [IntrNoMem, Commutative]>;
    782   def int_x86_sse41_pmaxuw          : GCCBuiltin<"__builtin_ia32_pmaxuw128">,
    783               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
    784                         [IntrNoMem, Commutative]>;
    785   def int_x86_sse41_pminsb          : GCCBuiltin<"__builtin_ia32_pminsb128">,
    786               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
    787                         [IntrNoMem, Commutative]>;
    788   def int_x86_sse41_pminsd          : GCCBuiltin<"__builtin_ia32_pminsd128">,
    789               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
    790                         [IntrNoMem, Commutative]>;
    791   def int_x86_sse41_pminud          : GCCBuiltin<"__builtin_ia32_pminud128">,
    792               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
    793                         [IntrNoMem, Commutative]>;
    794   def int_x86_sse41_pminuw          : GCCBuiltin<"__builtin_ia32_pminuw128">,
    795               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
    796                         [IntrNoMem, Commutative]>;
    797 }
    798 
    799 // Advanced Encryption Standard (AES) Instructions
    800 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    801   def int_x86_aesni_aesimc          : GCCBuiltin<"__builtin_ia32_aesimc128">,
    802               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty],
    803                         [IntrNoMem]>;
    804   def int_x86_aesni_aesenc          : GCCBuiltin<"__builtin_ia32_aesenc128">,
    805               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    806                         [IntrNoMem]>;
    807   def int_x86_aesni_aesenclast : GCCBuiltin<"__builtin_ia32_aesenclast128">,
    808               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    809                         [IntrNoMem]>;
    810   def int_x86_aesni_aesdec          : GCCBuiltin<"__builtin_ia32_aesdec128">,
    811               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    812                         [IntrNoMem]>;
    813   def int_x86_aesni_aesdeclast : GCCBuiltin<"__builtin_ia32_aesdeclast128">,
    814               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    815                         [IntrNoMem]>;
    816   def int_x86_aesni_aeskeygenassist :
    817               GCCBuiltin<"__builtin_ia32_aeskeygenassist128">,
    818               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_i8_ty],
    819                         [IntrNoMem]>;
    820 }
    821 
    822 // Vector pack
    823 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    824   def int_x86_sse41_packusdw        : GCCBuiltin<"__builtin_ia32_packusdw128">,
    825               Intrinsic<[llvm_v8i16_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
    826                         [IntrNoMem]>;
    827 }
    828 
    829 // Vector multiply
    830 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    831   def int_x86_sse41_pmuldq          : GCCBuiltin<"__builtin_ia32_pmuldq128">,
    832               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
    833                         [IntrNoMem, Commutative]>;
    834 }
    835 
    836 // Vector extract
    837 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    838   def int_x86_sse41_pextrb         :
    839               Intrinsic<[llvm_i32_ty], [llvm_v16i8_ty, llvm_i32_ty],
    840                         [IntrNoMem]>;
    841   def int_x86_sse41_pextrd         :
    842               Intrinsic<[llvm_i32_ty], [llvm_v4i32_ty, llvm_i32_ty],
    843                         [IntrNoMem]>;
    844   def int_x86_sse41_pextrq         :
    845               Intrinsic<[llvm_i64_ty], [llvm_v2i64_ty, llvm_i32_ty],
    846                         [IntrNoMem]>;
    847   def int_x86_sse41_extractps      : GCCBuiltin<"__builtin_ia32_extractps128">,
    848               Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty, llvm_i32_ty],
    849                         [IntrNoMem]>;
    850 }
    851 
    852 // Vector insert
    853 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    854   def int_x86_sse41_insertps       : GCCBuiltin<"__builtin_ia32_insertps128">,
    855           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,llvm_i32_ty],
    856                     [IntrNoMem]>;
    857 }
    858 
    859 // Vector blend
    860 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    861   def int_x86_sse41_pblendvb         : GCCBuiltin<"__builtin_ia32_pblendvb128">,
    862         Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty,llvm_v16i8_ty],
    863                   [IntrNoMem]>;
    864   def int_x86_sse41_pblendw          : GCCBuiltin<"__builtin_ia32_pblendw128">,
    865         Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty, llvm_i32_ty],
    866                   [IntrNoMem]>;
    867   def int_x86_sse41_blendpd          : GCCBuiltin<"__builtin_ia32_blendpd">,
    868         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty, llvm_i32_ty],
    869                   [IntrNoMem]>;
    870   def int_x86_sse41_blendps          : GCCBuiltin<"__builtin_ia32_blendps">,
    871         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty, llvm_i32_ty],
    872                   [IntrNoMem]>;
    873   def int_x86_sse41_blendvpd         : GCCBuiltin<"__builtin_ia32_blendvpd">,
    874         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,llvm_v2f64_ty],
    875                   [IntrNoMem]>;
    876   def int_x86_sse41_blendvps         : GCCBuiltin<"__builtin_ia32_blendvps">,
    877         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,llvm_v4f32_ty],
    878                   [IntrNoMem]>;
    879 }
    880 
    881 // Vector dot product
    882 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    883   def int_x86_sse41_dppd            : GCCBuiltin<"__builtin_ia32_dppd">,
    884           Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,llvm_i32_ty],
    885                     [IntrNoMem, Commutative]>;
    886   def int_x86_sse41_dpps            : GCCBuiltin<"__builtin_ia32_dpps">,
    887           Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,llvm_i32_ty],
    888                     [IntrNoMem, Commutative]>;
    889 }
    890 
    891 // Vector sum of absolute differences
    892 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    893   def int_x86_sse41_mpsadbw         : GCCBuiltin<"__builtin_ia32_mpsadbw128">,
    894           Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty, llvm_v16i8_ty,llvm_i32_ty],
    895                     [IntrNoMem, Commutative]>;
    896 }
    897 
    898 // Cacheability support ops
    899 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
    900   def int_x86_sse41_movntdqa        : GCCBuiltin<"__builtin_ia32_movntdqa">,
    901           Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty], [IntrReadMem]>;
    902 }
    903 
    904 // Test instruction with bitwise comparison.
    905 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
    906   def int_x86_sse41_ptestz          : GCCBuiltin<"__builtin_ia32_ptestz128">,
    907           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    908                     [IntrNoMem]>;
    909   def int_x86_sse41_ptestc          : GCCBuiltin<"__builtin_ia32_ptestc128">,
    910           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    911                     [IntrNoMem]>;
    912   def int_x86_sse41_ptestnzc        : GCCBuiltin<"__builtin_ia32_ptestnzc128">,
    913           Intrinsic<[llvm_i32_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
    914                     [IntrNoMem]>;
    915 }
    916 
    917 //===----------------------------------------------------------------------===//
    918 // SSE4.2
    919 
    920 // Miscellaneous
    921 // CRC Instruction
    922 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
    923   def int_x86_sse42_crc32_32_8       : GCCBuiltin<"__builtin_ia32_crc32qi">,
    924           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i8_ty],
    925                     [IntrNoMem]>;
    926   def int_x86_sse42_crc32_32_16      : GCCBuiltin<"__builtin_ia32_crc32hi">,
    927           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i16_ty],
    928                     [IntrNoMem]>;
    929   def int_x86_sse42_crc32_32_32      : GCCBuiltin<"__builtin_ia32_crc32si">,
    930           Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty],
    931                     [IntrNoMem]>;
    932   def int_x86_sse42_crc32_64_8       :
    933           Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i8_ty],
    934                     [IntrNoMem]>;
    935   def int_x86_sse42_crc32_64_64      : GCCBuiltin<"__builtin_ia32_crc32di">,
    936           Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty],
    937                     [IntrNoMem]>;
    938 }
    939 
    940 // String/text processing ops.
    941 let TargetPrefix = "x86" in { // All intrinsics start with "llvm.x86.".
    942   def int_x86_sse42_pcmpistrm128  : GCCBuiltin<"__builtin_ia32_pcmpistrm128">,
    943     Intrinsic<[llvm_v16i8_ty],
    944         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    945         [IntrNoMem]>;
    946   def int_x86_sse42_pcmpistri128  : GCCBuiltin<"__builtin_ia32_pcmpistri128">,
    947     Intrinsic<[llvm_i32_ty],
    948         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    949         [IntrNoMem]>;
    950   def int_x86_sse42_pcmpistria128 : GCCBuiltin<"__builtin_ia32_pcmpistria128">,
    951     Intrinsic<[llvm_i32_ty],
    952         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    953         [IntrNoMem]>;
    954   def int_x86_sse42_pcmpistric128 : GCCBuiltin<"__builtin_ia32_pcmpistric128">,
    955     Intrinsic<[llvm_i32_ty],
    956         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    957         [IntrNoMem]>;
    958   def int_x86_sse42_pcmpistrio128 : GCCBuiltin<"__builtin_ia32_pcmpistrio128">,
    959     Intrinsic<[llvm_i32_ty],
    960         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    961         [IntrNoMem]>;
    962   def int_x86_sse42_pcmpistris128 : GCCBuiltin<"__builtin_ia32_pcmpistris128">,
    963     Intrinsic<[llvm_i32_ty],
    964         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    965         [IntrNoMem]>;
    966   def int_x86_sse42_pcmpistriz128 : GCCBuiltin<"__builtin_ia32_pcmpistriz128">,
    967     Intrinsic<[llvm_i32_ty],
    968         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_i8_ty],
    969         [IntrNoMem]>;
    970   def int_x86_sse42_pcmpestrm128  : GCCBuiltin<"__builtin_ia32_pcmpestrm128">,
    971     Intrinsic<[llvm_v16i8_ty],
    972         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
    973          llvm_i8_ty],
    974         [IntrNoMem]>;
    975   def int_x86_sse42_pcmpestri128  : GCCBuiltin<"__builtin_ia32_pcmpestri128">,
    976     Intrinsic<[llvm_i32_ty],
    977         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
    978          llvm_i8_ty],
    979         [IntrNoMem]>;
    980   def int_x86_sse42_pcmpestria128 : GCCBuiltin<"__builtin_ia32_pcmpestria128">,
    981     Intrinsic<[llvm_i32_ty],
    982         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
    983          llvm_i8_ty],
    984         [IntrNoMem]>;
    985   def int_x86_sse42_pcmpestric128 : GCCBuiltin<"__builtin_ia32_pcmpestric128">,
    986     Intrinsic<[llvm_i32_ty],
    987         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
    988          llvm_i8_ty],
    989         [IntrNoMem]>;
    990   def int_x86_sse42_pcmpestrio128 : GCCBuiltin<"__builtin_ia32_pcmpestrio128">,
    991     Intrinsic<[llvm_i32_ty],
    992         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
    993          llvm_i8_ty],
    994         [IntrNoMem]>;
    995   def int_x86_sse42_pcmpestris128 : GCCBuiltin<"__builtin_ia32_pcmpestris128">,
    996     Intrinsic<[llvm_i32_ty],
    997         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
    998          llvm_i8_ty],
    999         [IntrNoMem]>;
   1000   def int_x86_sse42_pcmpestriz128 : GCCBuiltin<"__builtin_ia32_pcmpestriz128">,
   1001     Intrinsic<[llvm_i32_ty],
   1002         [llvm_v16i8_ty, llvm_i32_ty, llvm_v16i8_ty, llvm_i32_ty,
   1003          llvm_i8_ty],
   1004         [IntrNoMem]>;
   1005 }
   1006 
   1007 //===----------------------------------------------------------------------===//
   1008 // AVX
   1009 
   1010 // Arithmetic ops
   1011 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1012   def int_x86_avx_addsub_pd_256 : GCCBuiltin<"__builtin_ia32_addsubpd256">,
   1013         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1014                   llvm_v4f64_ty], [IntrNoMem]>;
   1015   def int_x86_avx_addsub_ps_256 : GCCBuiltin<"__builtin_ia32_addsubps256">,
   1016         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1017                   llvm_v8f32_ty], [IntrNoMem]>;
   1018   def int_x86_avx_max_pd_256 : GCCBuiltin<"__builtin_ia32_maxpd256">,
   1019         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1020                   llvm_v4f64_ty], [IntrNoMem]>;
   1021   def int_x86_avx_max_ps_256 : GCCBuiltin<"__builtin_ia32_maxps256">,
   1022         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1023                   llvm_v8f32_ty], [IntrNoMem]>;
   1024   def int_x86_avx_min_pd_256 : GCCBuiltin<"__builtin_ia32_minpd256">,
   1025         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1026                   llvm_v4f64_ty], [IntrNoMem]>;
   1027   def int_x86_avx_min_ps_256 : GCCBuiltin<"__builtin_ia32_minps256">,
   1028         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1029                   llvm_v8f32_ty], [IntrNoMem]>;
   1030 
   1031   def int_x86_avx_sqrt_pd_256 : GCCBuiltin<"__builtin_ia32_sqrtpd256">,
   1032         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   1033   def int_x86_avx_sqrt_ps_256 : GCCBuiltin<"__builtin_ia32_sqrtps256">,
   1034         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1035 
   1036   def int_x86_avx_rsqrt_ps_256 : GCCBuiltin<"__builtin_ia32_rsqrtps256">,
   1037         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1038 
   1039   def int_x86_avx_rcp_ps_256 : GCCBuiltin<"__builtin_ia32_rcpps256">,
   1040         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1041 
   1042   def int_x86_avx_round_pd_256 : GCCBuiltin<"__builtin_ia32_roundpd256">,
   1043         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1044                   llvm_i32_ty], [IntrNoMem]>;
   1045   def int_x86_avx_round_ps_256 : GCCBuiltin<"__builtin_ia32_roundps256">,
   1046         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1047                   llvm_i32_ty], [IntrNoMem]>;
   1048 }
   1049 
   1050 // Horizontal ops
   1051 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1052   def int_x86_avx_hadd_pd_256 : GCCBuiltin<"__builtin_ia32_haddpd256">,
   1053         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1054                   llvm_v4f64_ty], [IntrNoMem]>;
   1055   def int_x86_avx_hsub_ps_256 : GCCBuiltin<"__builtin_ia32_hsubps256">,
   1056         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1057                   llvm_v8f32_ty], [IntrNoMem]>;
   1058   def int_x86_avx_hsub_pd_256 : GCCBuiltin<"__builtin_ia32_hsubpd256">,
   1059         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1060                   llvm_v4f64_ty], [IntrNoMem]>;
   1061   def int_x86_avx_hadd_ps_256 : GCCBuiltin<"__builtin_ia32_haddps256">,
   1062         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1063                   llvm_v8f32_ty], [IntrNoMem]>;
   1064 }
   1065 
   1066 // Vector permutation
   1067 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1068   def int_x86_avx_vpermilvar_pd : GCCBuiltin<"__builtin_ia32_vpermilvarpd">,
   1069         Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty,
   1070                   llvm_v2i64_ty], [IntrNoMem]>;
   1071   def int_x86_avx_vpermilvar_ps : GCCBuiltin<"__builtin_ia32_vpermilvarps">,
   1072         Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty,
   1073                   llvm_v4i32_ty], [IntrNoMem]>;
   1074 
   1075   def int_x86_avx_vpermilvar_pd_256 :
   1076         GCCBuiltin<"__builtin_ia32_vpermilvarpd256">,
   1077         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4i64_ty], [IntrNoMem]>;
   1078   def int_x86_avx_vpermilvar_ps_256 :
   1079         GCCBuiltin<"__builtin_ia32_vpermilvarps256">,
   1080         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8i32_ty], [IntrNoMem]>;
   1081 
   1082   def int_x86_avx_vperm2f128_pd_256 :
   1083         GCCBuiltin<"__builtin_ia32_vperm2f128_pd256">,
   1084         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1085                   llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
   1086   def int_x86_avx_vperm2f128_ps_256 :
   1087         GCCBuiltin<"__builtin_ia32_vperm2f128_ps256">,
   1088         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1089                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
   1090   def int_x86_avx_vperm2f128_si_256 :
   1091         GCCBuiltin<"__builtin_ia32_vperm2f128_si256">,
   1092         Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1093                   llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
   1094 }
   1095 
   1096 // Vector blend
   1097 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1098   def int_x86_avx_blend_pd_256 : GCCBuiltin<"__builtin_ia32_blendpd256">,
   1099         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1100                   llvm_v4f64_ty, llvm_i32_ty], [IntrNoMem]>;
   1101   def int_x86_avx_blend_ps_256 : GCCBuiltin<"__builtin_ia32_blendps256">,
   1102         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1103                   llvm_v8f32_ty, llvm_i32_ty], [IntrNoMem]>;
   1104   def int_x86_avx_blendv_pd_256 : GCCBuiltin<"__builtin_ia32_blendvpd256">,
   1105         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1106                   llvm_v4f64_ty, llvm_v4f64_ty], [IntrNoMem]>;
   1107   def int_x86_avx_blendv_ps_256 : GCCBuiltin<"__builtin_ia32_blendvps256">,
   1108         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1109                   llvm_v8f32_ty, llvm_v8f32_ty], [IntrNoMem]>;
   1110 }
   1111 
   1112 // Vector dot product
   1113 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1114   def int_x86_avx_dp_ps_256 : GCCBuiltin<"__builtin_ia32_dpps256">,
   1115         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1116                   llvm_v8f32_ty, llvm_i32_ty], [IntrNoMem]>;
   1117 }
   1118 
   1119 // Vector compare
   1120 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1121   def int_x86_avx_cmp_pd_256 : GCCBuiltin<"__builtin_ia32_cmppd256">,
   1122         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1123                   llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
   1124   def int_x86_avx_cmp_ps_256 : GCCBuiltin<"__builtin_ia32_cmpps256">,
   1125         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1126                   llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
   1127 }
   1128 
   1129 // Vector extract and insert
   1130 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1131   def int_x86_avx_vextractf128_pd_256 :
   1132         GCCBuiltin<"__builtin_ia32_vextractf128_pd256">,
   1133         Intrinsic<[llvm_v2f64_ty], [llvm_v4f64_ty, llvm_i8_ty], [IntrNoMem]>;
   1134   def int_x86_avx_vextractf128_ps_256 :
   1135         GCCBuiltin<"__builtin_ia32_vextractf128_ps256">,
   1136         Intrinsic<[llvm_v4f32_ty], [llvm_v8f32_ty, llvm_i8_ty], [IntrNoMem]>;
   1137   def int_x86_avx_vextractf128_si_256 :
   1138         GCCBuiltin<"__builtin_ia32_vextractf128_si256">,
   1139         Intrinsic<[llvm_v4i32_ty], [llvm_v8i32_ty, llvm_i8_ty], [IntrNoMem]>;
   1140 
   1141   def int_x86_avx_vinsertf128_pd_256 :
   1142         GCCBuiltin<"__builtin_ia32_vinsertf128_pd256">,
   1143         Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty,
   1144                   llvm_v2f64_ty, llvm_i8_ty], [IntrNoMem]>;
   1145   def int_x86_avx_vinsertf128_ps_256 :
   1146         GCCBuiltin<"__builtin_ia32_vinsertf128_ps256">,
   1147         Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty,
   1148                   llvm_v4f32_ty, llvm_i8_ty], [IntrNoMem]>;
   1149   def int_x86_avx_vinsertf128_si_256 :
   1150         GCCBuiltin<"__builtin_ia32_vinsertf128_si256">,
   1151         Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1152                   llvm_v4i32_ty, llvm_i8_ty], [IntrNoMem]>;
   1153 }
   1154 
   1155 // Vector convert
   1156 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1157   def int_x86_avx_cvtdq2_pd_256 : GCCBuiltin<"__builtin_ia32_cvtdq2pd256">,
   1158         Intrinsic<[llvm_v4f64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
   1159   def int_x86_avx_cvtdq2_ps_256 : GCCBuiltin<"__builtin_ia32_cvtdq2ps256">,
   1160         Intrinsic<[llvm_v8f32_ty], [llvm_v8i32_ty], [IntrNoMem]>;
   1161   def int_x86_avx_cvt_pd2_ps_256 : GCCBuiltin<"__builtin_ia32_cvtpd2ps256">,
   1162         Intrinsic<[llvm_v4f32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   1163   def int_x86_avx_cvt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvtps2dq256">,
   1164         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1165   def int_x86_avx_cvt_ps2_pd_256 : GCCBuiltin<"__builtin_ia32_cvtps2pd256">,
   1166         Intrinsic<[llvm_v4f64_ty], [llvm_v4f32_ty], [IntrNoMem]>;
   1167   def int_x86_avx_cvtt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvttpd2dq256">,
   1168         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   1169   def int_x86_avx_cvt_pd2dq_256 : GCCBuiltin<"__builtin_ia32_cvtpd2dq256">,
   1170         Intrinsic<[llvm_v4i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   1171   def int_x86_avx_cvtt_ps2dq_256 : GCCBuiltin<"__builtin_ia32_cvttps2dq256">,
   1172         Intrinsic<[llvm_v8i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1173 }
   1174 
   1175 // Vector bit test
   1176 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1177   def int_x86_avx_vtestz_pd : GCCBuiltin<"__builtin_ia32_vtestzpd">,
   1178         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
   1179                   llvm_v2f64_ty], [IntrNoMem]>;
   1180   def int_x86_avx_vtestc_pd : GCCBuiltin<"__builtin_ia32_vtestcpd">,
   1181         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
   1182                   llvm_v2f64_ty], [IntrNoMem]>;
   1183   def int_x86_avx_vtestnzc_pd : GCCBuiltin<"__builtin_ia32_vtestnzcpd">,
   1184         Intrinsic<[llvm_i32_ty], [llvm_v2f64_ty,
   1185                   llvm_v2f64_ty], [IntrNoMem]>;
   1186   def int_x86_avx_vtestz_ps : GCCBuiltin<"__builtin_ia32_vtestzps">,
   1187         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
   1188                   llvm_v4f32_ty], [IntrNoMem]>;
   1189   def int_x86_avx_vtestc_ps : GCCBuiltin<"__builtin_ia32_vtestcps">,
   1190         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
   1191                   llvm_v4f32_ty], [IntrNoMem]>;
   1192   def int_x86_avx_vtestnzc_ps : GCCBuiltin<"__builtin_ia32_vtestnzcps">,
   1193         Intrinsic<[llvm_i32_ty], [llvm_v4f32_ty,
   1194                   llvm_v4f32_ty], [IntrNoMem]>;
   1195   def int_x86_avx_vtestz_pd_256 : GCCBuiltin<"__builtin_ia32_vtestzpd256">,
   1196         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
   1197                   llvm_v4f64_ty], [IntrNoMem]>;
   1198   def int_x86_avx_vtestc_pd_256 : GCCBuiltin<"__builtin_ia32_vtestcpd256">,
   1199         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
   1200                   llvm_v4f64_ty], [IntrNoMem]>;
   1201   def int_x86_avx_vtestnzc_pd_256 : GCCBuiltin<"__builtin_ia32_vtestnzcpd256">,
   1202         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty,
   1203                   llvm_v4f64_ty], [IntrNoMem]>;
   1204   def int_x86_avx_vtestz_ps_256 : GCCBuiltin<"__builtin_ia32_vtestzps256">,
   1205         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
   1206                   llvm_v8f32_ty], [IntrNoMem]>;
   1207   def int_x86_avx_vtestc_ps_256 : GCCBuiltin<"__builtin_ia32_vtestcps256">,
   1208         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
   1209                   llvm_v8f32_ty], [IntrNoMem]>;
   1210   def int_x86_avx_vtestnzc_ps_256 : GCCBuiltin<"__builtin_ia32_vtestnzcps256">,
   1211         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty,
   1212                   llvm_v8f32_ty], [IntrNoMem]>;
   1213   def int_x86_avx_ptestz_256 : GCCBuiltin<"__builtin_ia32_ptestz256">,
   1214         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
   1215                   llvm_v4i64_ty], [IntrNoMem]>;
   1216   def int_x86_avx_ptestc_256 : GCCBuiltin<"__builtin_ia32_ptestc256">,
   1217         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
   1218                   llvm_v4i64_ty], [IntrNoMem]>;
   1219   def int_x86_avx_ptestnzc_256 : GCCBuiltin<"__builtin_ia32_ptestnzc256">,
   1220         Intrinsic<[llvm_i32_ty], [llvm_v4i64_ty,
   1221                   llvm_v4i64_ty], [IntrNoMem]>;
   1222 }
   1223 
   1224 // Vector extract sign mask
   1225 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1226   def int_x86_avx_movmsk_pd_256 : GCCBuiltin<"__builtin_ia32_movmskpd256">,
   1227         Intrinsic<[llvm_i32_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   1228   def int_x86_avx_movmsk_ps_256 : GCCBuiltin<"__builtin_ia32_movmskps256">,
   1229         Intrinsic<[llvm_i32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1230 }
   1231 
   1232 // Vector zero
   1233 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1234   def int_x86_avx_vzeroall : GCCBuiltin<"__builtin_ia32_vzeroall">,
   1235         Intrinsic<[], [], []>;
   1236   def int_x86_avx_vzeroupper : GCCBuiltin<"__builtin_ia32_vzeroupper">,
   1237         Intrinsic<[], [], []>;
   1238 }
   1239 
   1240 // Vector load with broadcast
   1241 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1242   def int_x86_avx_vbroadcast_ss :
   1243         GCCBuiltin<"__builtin_ia32_vbroadcastss">,
   1244         Intrinsic<[llvm_v4f32_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1245   def int_x86_avx_vbroadcast_sd_256 :
   1246         GCCBuiltin<"__builtin_ia32_vbroadcastsd256">,
   1247         Intrinsic<[llvm_v4f64_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1248   def int_x86_avx_vbroadcast_ss_256 :
   1249         GCCBuiltin<"__builtin_ia32_vbroadcastss256">,
   1250         Intrinsic<[llvm_v8f32_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1251   def int_x86_avx_vbroadcastf128_pd_256 :
   1252         GCCBuiltin<"__builtin_ia32_vbroadcastf128_pd256">,
   1253         Intrinsic<[llvm_v4f64_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1254   def int_x86_avx_vbroadcastf128_ps_256 :
   1255         GCCBuiltin<"__builtin_ia32_vbroadcastf128_ps256">,
   1256         Intrinsic<[llvm_v8f32_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1257 }
   1258 
   1259 // SIMD load ops
   1260 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1261   def int_x86_avx_ldu_dq_256 : GCCBuiltin<"__builtin_ia32_lddqu256">,
   1262         Intrinsic<[llvm_v32i8_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1263 }
   1264 
   1265 // SIMD store ops
   1266 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1267   def int_x86_avx_storeu_pd_256 : GCCBuiltin<"__builtin_ia32_storeupd256">,
   1268         Intrinsic<[], [llvm_ptr_ty, llvm_v4f64_ty], []>;
   1269   def int_x86_avx_storeu_ps_256 : GCCBuiltin<"__builtin_ia32_storeups256">,
   1270         Intrinsic<[], [llvm_ptr_ty, llvm_v8f32_ty], []>;
   1271   def int_x86_avx_storeu_dq_256 : GCCBuiltin<"__builtin_ia32_storedqu256">,
   1272         Intrinsic<[], [llvm_ptr_ty, llvm_v32i8_ty], []>;
   1273 }
   1274 
   1275 // Cacheability support ops
   1276 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1277   def int_x86_avx_movnt_dq_256 : GCCBuiltin<"__builtin_ia32_movntdq256">,
   1278         Intrinsic<[], [llvm_ptr_ty, llvm_v4i64_ty], []>;
   1279   def int_x86_avx_movnt_pd_256 : GCCBuiltin<"__builtin_ia32_movntpd256">,
   1280         Intrinsic<[], [llvm_ptr_ty, llvm_v4f64_ty], []>;
   1281   def int_x86_avx_movnt_ps_256 : GCCBuiltin<"__builtin_ia32_movntps256">,
   1282         Intrinsic<[], [llvm_ptr_ty, llvm_v8f32_ty], []>;
   1283 }
   1284 
   1285 // Conditional load ops
   1286 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1287   def int_x86_avx_maskload_pd : GCCBuiltin<"__builtin_ia32_maskloadpd">,
   1288         Intrinsic<[llvm_v2f64_ty], [llvm_ptr_ty, llvm_v2f64_ty], [IntrReadMem]>;
   1289   def int_x86_avx_maskload_ps : GCCBuiltin<"__builtin_ia32_maskloadps">,
   1290         Intrinsic<[llvm_v4f32_ty], [llvm_ptr_ty, llvm_v4f32_ty], [IntrReadMem]>;
   1291   def int_x86_avx_maskload_pd_256 : GCCBuiltin<"__builtin_ia32_maskloadpd256">,
   1292         Intrinsic<[llvm_v4f64_ty], [llvm_ptr_ty, llvm_v4f64_ty], [IntrReadMem]>;
   1293   def int_x86_avx_maskload_ps_256 : GCCBuiltin<"__builtin_ia32_maskloadps256">,
   1294         Intrinsic<[llvm_v8f32_ty], [llvm_ptr_ty, llvm_v8f32_ty], [IntrReadMem]>;
   1295 }
   1296 
   1297 // Conditional store ops
   1298 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1299   def int_x86_avx_maskstore_pd : GCCBuiltin<"__builtin_ia32_maskstorepd">,
   1300         Intrinsic<[], [llvm_ptr_ty,
   1301                   llvm_v2f64_ty, llvm_v2f64_ty], []>;
   1302   def int_x86_avx_maskstore_ps : GCCBuiltin<"__builtin_ia32_maskstoreps">,
   1303         Intrinsic<[], [llvm_ptr_ty,
   1304                   llvm_v4f32_ty, llvm_v4f32_ty], []>;
   1305   def int_x86_avx_maskstore_pd_256 :
   1306         GCCBuiltin<"__builtin_ia32_maskstorepd256">,
   1307         Intrinsic<[], [llvm_ptr_ty,
   1308                   llvm_v4f64_ty, llvm_v4f64_ty], []>;
   1309   def int_x86_avx_maskstore_ps_256 :
   1310         GCCBuiltin<"__builtin_ia32_maskstoreps256">,
   1311         Intrinsic<[], [llvm_ptr_ty,
   1312                   llvm_v8f32_ty, llvm_v8f32_ty], []>;
   1313 }
   1314 
   1315 //===----------------------------------------------------------------------===//
   1316 // AVX2
   1317 
   1318 // Integer arithmetic ops.
   1319 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1320   def int_x86_avx2_padds_b : GCCBuiltin<"__builtin_ia32_paddsb256">,
   1321               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1322                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1323   def int_x86_avx2_padds_w : GCCBuiltin<"__builtin_ia32_paddsw256">,
   1324               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1325                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1326   def int_x86_avx2_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb256">,
   1327               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1328                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1329   def int_x86_avx2_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw256">,
   1330               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1331                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1332   def int_x86_avx2_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb256">,
   1333               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1334                          llvm_v32i8_ty], [IntrNoMem]>;
   1335   def int_x86_avx2_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw256">,
   1336               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1337                          llvm_v16i16_ty], [IntrNoMem]>;
   1338   def int_x86_avx2_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb256">,
   1339               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1340                          llvm_v32i8_ty], [IntrNoMem]>;
   1341   def int_x86_avx2_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw256">,
   1342               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1343                          llvm_v16i16_ty], [IntrNoMem]>;
   1344   def int_x86_avx2_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw256">,
   1345               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1346                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1347   def int_x86_avx2_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw256">,
   1348               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1349                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1350   def int_x86_avx2_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq256">,
   1351               Intrinsic<[llvm_v4i64_ty], [llvm_v8i32_ty,
   1352                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
   1353   def int_x86_avx2_pmul_dq : GCCBuiltin<"__builtin_ia32_pmuldq256">,
   1354               Intrinsic<[llvm_v4i64_ty], [llvm_v8i32_ty,
   1355                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
   1356   def int_x86_avx2_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd256">,
   1357               Intrinsic<[llvm_v8i32_ty], [llvm_v16i16_ty,
   1358                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1359   def int_x86_avx2_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb256">,
   1360               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1361                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1362   def int_x86_avx2_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw256">,
   1363               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1364                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1365   def int_x86_avx2_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw256">,
   1366               Intrinsic<[llvm_v4i64_ty], [llvm_v32i8_ty,
   1367                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1368 }
   1369 
   1370 // Vector min, max
   1371 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1372   def int_x86_avx2_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub256">,
   1373               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1374                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1375   def int_x86_avx2_pmaxu_w : GCCBuiltin<"__builtin_ia32_pmaxuw256">,
   1376               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1377                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1378   def int_x86_avx2_pmaxu_d : GCCBuiltin<"__builtin_ia32_pmaxud256">,
   1379               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1380                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
   1381   def int_x86_avx2_pmaxs_b : GCCBuiltin<"__builtin_ia32_pmaxsb256">,
   1382               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1383                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1384   def int_x86_avx2_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw256">,
   1385               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1386                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1387   def int_x86_avx2_pmaxs_d : GCCBuiltin<"__builtin_ia32_pmaxsd256">,
   1388               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1389                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
   1390   def int_x86_avx2_pminu_b : GCCBuiltin<"__builtin_ia32_pminub256">,
   1391               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1392                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1393   def int_x86_avx2_pminu_w : GCCBuiltin<"__builtin_ia32_pminuw256">,
   1394               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1395                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1396   def int_x86_avx2_pminu_d : GCCBuiltin<"__builtin_ia32_pminud256">,
   1397               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1398                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
   1399   def int_x86_avx2_pmins_b : GCCBuiltin<"__builtin_ia32_pminsb256">,
   1400               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1401                          llvm_v32i8_ty], [IntrNoMem, Commutative]>;
   1402   def int_x86_avx2_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw256">,
   1403               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1404                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1405   def int_x86_avx2_pmins_d : GCCBuiltin<"__builtin_ia32_pminsd256">,
   1406               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1407                          llvm_v8i32_ty], [IntrNoMem, Commutative]>;
   1408 }
   1409 
   1410 // Integer shift ops.
   1411 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1412   def int_x86_avx2_psll_w : GCCBuiltin<"__builtin_ia32_psllw256">,
   1413               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1414                          llvm_v8i16_ty], [IntrNoMem]>;
   1415   def int_x86_avx2_psll_d : GCCBuiltin<"__builtin_ia32_pslld256">,
   1416               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1417                          llvm_v4i32_ty], [IntrNoMem]>;
   1418   def int_x86_avx2_psll_q : GCCBuiltin<"__builtin_ia32_psllq256">,
   1419               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1420                          llvm_v2i64_ty], [IntrNoMem]>;
   1421   def int_x86_avx2_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw256">,
   1422               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1423                          llvm_v8i16_ty], [IntrNoMem]>;
   1424   def int_x86_avx2_psrl_d : GCCBuiltin<"__builtin_ia32_psrld256">,
   1425               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1426                          llvm_v4i32_ty], [IntrNoMem]>;
   1427   def int_x86_avx2_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq256">,
   1428               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1429                          llvm_v2i64_ty], [IntrNoMem]>;
   1430   def int_x86_avx2_psra_w : GCCBuiltin<"__builtin_ia32_psraw256">,
   1431               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1432                          llvm_v8i16_ty], [IntrNoMem]>;
   1433   def int_x86_avx2_psra_d : GCCBuiltin<"__builtin_ia32_psrad256">,
   1434               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1435                          llvm_v4i32_ty], [IntrNoMem]>;
   1436 
   1437   def int_x86_avx2_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi256">,
   1438               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1439                          llvm_i32_ty], [IntrNoMem]>;
   1440   def int_x86_avx2_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi256">,
   1441               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1442                          llvm_i32_ty], [IntrNoMem]>;
   1443   def int_x86_avx2_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi256">,
   1444               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1445                          llvm_i32_ty], [IntrNoMem]>;
   1446   def int_x86_avx2_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi256">,
   1447               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1448                          llvm_i32_ty], [IntrNoMem]>;
   1449   def int_x86_avx2_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi256">,
   1450               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1451                          llvm_i32_ty], [IntrNoMem]>;
   1452   def int_x86_avx2_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi256">,
   1453               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1454                          llvm_i32_ty], [IntrNoMem]>;
   1455   def int_x86_avx2_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi256">,
   1456               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1457                          llvm_i32_ty], [IntrNoMem]>;
   1458   def int_x86_avx2_psrai_d : GCCBuiltin<"__builtin_ia32_psradi256">,
   1459               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1460                          llvm_i32_ty], [IntrNoMem]>;
   1461 
   1462   def int_x86_avx2_psll_dq : GCCBuiltin<"__builtin_ia32_pslldqi256">,
   1463               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1464                          llvm_i32_ty], [IntrNoMem]>;
   1465   def int_x86_avx2_psrl_dq : GCCBuiltin<"__builtin_ia32_psrldqi256">,
   1466               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1467                          llvm_i32_ty], [IntrNoMem]>;
   1468   def int_x86_avx2_psll_dq_bs : GCCBuiltin<"__builtin_ia32_pslldqi256_byteshift">,
   1469               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1470                          llvm_i32_ty], [IntrNoMem]>;
   1471   def int_x86_avx2_psrl_dq_bs : GCCBuiltin<"__builtin_ia32_psrldqi256_byteshift">,
   1472               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1473                          llvm_i32_ty], [IntrNoMem]>;
   1474 }
   1475 
   1476 // Pack ops.
   1477 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1478   def int_x86_avx2_packsswb : GCCBuiltin<"__builtin_ia32_packsswb256">,
   1479               Intrinsic<[llvm_v32i8_ty], [llvm_v16i16_ty,
   1480                          llvm_v16i16_ty], [IntrNoMem]>;
   1481   def int_x86_avx2_packssdw : GCCBuiltin<"__builtin_ia32_packssdw256">,
   1482               Intrinsic<[llvm_v16i16_ty], [llvm_v8i32_ty,
   1483                          llvm_v8i32_ty], [IntrNoMem]>;
   1484   def int_x86_avx2_packuswb : GCCBuiltin<"__builtin_ia32_packuswb256">,
   1485               Intrinsic<[llvm_v32i8_ty], [llvm_v16i16_ty,
   1486                          llvm_v16i16_ty], [IntrNoMem]>;
   1487   def int_x86_avx2_packusdw : GCCBuiltin<"__builtin_ia32_packusdw256">,
   1488               Intrinsic<[llvm_v16i16_ty], [llvm_v8i32_ty,
   1489                          llvm_v8i32_ty], [IntrNoMem]>;
   1490 }
   1491 
   1492 // Absolute value ops
   1493 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1494   def int_x86_avx2_pabs_b : GCCBuiltin<"__builtin_ia32_pabsb256">,
   1495               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty], [IntrNoMem]>;
   1496   def int_x86_avx2_pabs_w : GCCBuiltin<"__builtin_ia32_pabsw256">,
   1497               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty], [IntrNoMem]>;
   1498   def int_x86_avx2_pabs_d : GCCBuiltin<"__builtin_ia32_pabsd256">,
   1499               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty], [IntrNoMem]>;
   1500 }
   1501 
   1502 // Horizontal arithmetic ops
   1503 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1504   def int_x86_avx2_phadd_w : GCCBuiltin<"__builtin_ia32_phaddw256">,
   1505               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1506                          llvm_v16i16_ty], [IntrNoMem]>;
   1507   def int_x86_avx2_phadd_d : GCCBuiltin<"__builtin_ia32_phaddd256">,
   1508               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1509                          llvm_v8i32_ty], [IntrNoMem]>;
   1510   def int_x86_avx2_phadd_sw : GCCBuiltin<"__builtin_ia32_phaddsw256">,
   1511               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1512                          llvm_v16i16_ty], [IntrNoMem]>;
   1513   def int_x86_avx2_phsub_w : GCCBuiltin<"__builtin_ia32_phsubw256">,
   1514               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1515                          llvm_v16i16_ty], [IntrNoMem]>;
   1516   def int_x86_avx2_phsub_d : GCCBuiltin<"__builtin_ia32_phsubd256">,
   1517               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1518                          llvm_v8i32_ty], [IntrNoMem]>;
   1519   def int_x86_avx2_phsub_sw : GCCBuiltin<"__builtin_ia32_phsubsw256">,
   1520               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1521                          llvm_v16i16_ty], [IntrNoMem]>;
   1522   def int_x86_avx2_pmadd_ub_sw : GCCBuiltin<"__builtin_ia32_pmaddubsw256">,
   1523               Intrinsic<[llvm_v16i16_ty], [llvm_v32i8_ty,
   1524                          llvm_v32i8_ty], [IntrNoMem]>;
   1525 }
   1526 
   1527 // Sign ops
   1528 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1529   def int_x86_avx2_psign_b : GCCBuiltin<"__builtin_ia32_psignb256">,
   1530               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1531                          llvm_v32i8_ty], [IntrNoMem]>;
   1532   def int_x86_avx2_psign_w : GCCBuiltin<"__builtin_ia32_psignw256">,
   1533               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1534                          llvm_v16i16_ty], [IntrNoMem]>;
   1535   def int_x86_avx2_psign_d : GCCBuiltin<"__builtin_ia32_psignd256">,
   1536               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty,
   1537                          llvm_v8i32_ty], [IntrNoMem]>;
   1538 }
   1539 
   1540 // Packed multiply high with round and scale
   1541 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1542   def int_x86_avx2_pmul_hr_sw : GCCBuiltin<"__builtin_ia32_pmulhrsw256">,
   1543               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty,
   1544                          llvm_v16i16_ty], [IntrNoMem, Commutative]>;
   1545 }
   1546 
   1547 // Vector sign and zero extend
   1548 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1549   def int_x86_avx2_pmovsxbd : GCCBuiltin<"__builtin_ia32_pmovsxbd256">,
   1550               Intrinsic<[llvm_v8i32_ty], [llvm_v16i8_ty],
   1551                         [IntrNoMem]>;
   1552   def int_x86_avx2_pmovsxbq : GCCBuiltin<"__builtin_ia32_pmovsxbq256">,
   1553               Intrinsic<[llvm_v4i64_ty], [llvm_v16i8_ty],
   1554                         [IntrNoMem]>;
   1555   def int_x86_avx2_pmovsxbw : GCCBuiltin<"__builtin_ia32_pmovsxbw256">,
   1556               Intrinsic<[llvm_v16i16_ty], [llvm_v16i8_ty],
   1557                         [IntrNoMem]>;
   1558   def int_x86_avx2_pmovsxdq : GCCBuiltin<"__builtin_ia32_pmovsxdq256">,
   1559               Intrinsic<[llvm_v4i64_ty], [llvm_v4i32_ty],
   1560                         [IntrNoMem]>;
   1561   def int_x86_avx2_pmovsxwd : GCCBuiltin<"__builtin_ia32_pmovsxwd256">,
   1562               Intrinsic<[llvm_v8i32_ty], [llvm_v8i16_ty],
   1563                         [IntrNoMem]>;
   1564   def int_x86_avx2_pmovsxwq : GCCBuiltin<"__builtin_ia32_pmovsxwq256">,
   1565               Intrinsic<[llvm_v4i64_ty], [llvm_v8i16_ty],
   1566                         [IntrNoMem]>;
   1567   def int_x86_avx2_pmovzxbd : GCCBuiltin<"__builtin_ia32_pmovzxbd256">,
   1568               Intrinsic<[llvm_v8i32_ty], [llvm_v16i8_ty],
   1569                         [IntrNoMem]>;
   1570   def int_x86_avx2_pmovzxbq : GCCBuiltin<"__builtin_ia32_pmovzxbq256">,
   1571               Intrinsic<[llvm_v4i64_ty], [llvm_v16i8_ty],
   1572                         [IntrNoMem]>;
   1573   def int_x86_avx2_pmovzxbw : GCCBuiltin<"__builtin_ia32_pmovzxbw256">,
   1574               Intrinsic<[llvm_v16i16_ty], [llvm_v16i8_ty],
   1575                         [IntrNoMem]>;
   1576   def int_x86_avx2_pmovzxdq : GCCBuiltin<"__builtin_ia32_pmovzxdq256">,
   1577               Intrinsic<[llvm_v4i64_ty], [llvm_v4i32_ty],
   1578                         [IntrNoMem]>;
   1579   def int_x86_avx2_pmovzxwd : GCCBuiltin<"__builtin_ia32_pmovzxwd256">,
   1580               Intrinsic<[llvm_v8i32_ty], [llvm_v8i16_ty],
   1581                         [IntrNoMem]>;
   1582   def int_x86_avx2_pmovzxwq : GCCBuiltin<"__builtin_ia32_pmovzxwq256">,
   1583               Intrinsic<[llvm_v4i64_ty], [llvm_v8i16_ty],
   1584                         [IntrNoMem]>;
   1585 }
   1586 
   1587 // Vector blend
   1588 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1589   def int_x86_avx2_pblendvb : GCCBuiltin<"__builtin_ia32_pblendvb256">,
   1590               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty, llvm_v32i8_ty,
   1591                          llvm_v32i8_ty], [IntrNoMem]>;
   1592   def int_x86_avx2_pblendw : GCCBuiltin<"__builtin_ia32_pblendw256">,
   1593               Intrinsic<[llvm_v16i16_ty], [llvm_v16i16_ty, llvm_v16i16_ty,
   1594                          llvm_i32_ty], [IntrNoMem]>;
   1595   def int_x86_avx2_pblendd_128 : GCCBuiltin<"__builtin_ia32_pblendd128">,
   1596               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty,
   1597                          llvm_i32_ty], [IntrNoMem]>;
   1598   def int_x86_avx2_pblendd_256 : GCCBuiltin<"__builtin_ia32_pblendd256">,
   1599               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty,
   1600                          llvm_i32_ty], [IntrNoMem]>;
   1601 }
   1602 
   1603 // Vector load with broadcast
   1604 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1605   def int_x86_avx2_vbroadcast_ss_ps :
   1606               GCCBuiltin<"__builtin_ia32_vbroadcastss_ps">,
   1607               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
   1608   def int_x86_avx2_vbroadcast_sd_pd_256 :
   1609               GCCBuiltin<"__builtin_ia32_vbroadcastsd_pd256">,
   1610               Intrinsic<[llvm_v4f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
   1611   def int_x86_avx2_vbroadcast_ss_ps_256 :
   1612               GCCBuiltin<"__builtin_ia32_vbroadcastss_ps256">,
   1613               Intrinsic<[llvm_v8f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
   1614   def int_x86_avx2_vbroadcasti128 :
   1615               GCCBuiltin<"__builtin_ia32_vbroadcastsi256">,
   1616               Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1617   def int_x86_avx2_pbroadcastb_128 :
   1618               GCCBuiltin<"__builtin_ia32_pbroadcastb128">,
   1619               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   1620   def int_x86_avx2_pbroadcastb_256 :
   1621               GCCBuiltin<"__builtin_ia32_pbroadcastb256">,
   1622               Intrinsic<[llvm_v32i8_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   1623   def int_x86_avx2_pbroadcastw_128 :
   1624               GCCBuiltin<"__builtin_ia32_pbroadcastw128">,
   1625               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   1626   def int_x86_avx2_pbroadcastw_256 :
   1627               GCCBuiltin<"__builtin_ia32_pbroadcastw256">,
   1628               Intrinsic<[llvm_v16i16_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   1629   def int_x86_avx2_pbroadcastd_128 :
   1630               GCCBuiltin<"__builtin_ia32_pbroadcastd128">,
   1631               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
   1632   def int_x86_avx2_pbroadcastd_256 :
   1633               GCCBuiltin<"__builtin_ia32_pbroadcastd256">,
   1634               Intrinsic<[llvm_v8i32_ty], [llvm_v4i32_ty], [IntrNoMem]>;
   1635   def int_x86_avx2_pbroadcastq_128 :
   1636               GCCBuiltin<"__builtin_ia32_pbroadcastq128">,
   1637               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
   1638   def int_x86_avx2_pbroadcastq_256 :
   1639               GCCBuiltin<"__builtin_ia32_pbroadcastq256">,
   1640               Intrinsic<[llvm_v4i64_ty], [llvm_v2i64_ty], [IntrNoMem]>;
   1641 }
   1642 
   1643 // Vector permutation
   1644 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1645   def int_x86_avx2_permd : GCCBuiltin<"__builtin_ia32_permvarsi256">,
   1646               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
   1647                         [IntrNoMem]>;
   1648   def int_x86_avx2_permps : GCCBuiltin<"__builtin_ia32_permvarsf256">,
   1649               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty],
   1650                         [IntrNoMem]>;
   1651   def int_x86_avx2_vperm2i128 : GCCBuiltin<"__builtin_ia32_permti256">,
   1652               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1653                          llvm_v4i64_ty, llvm_i8_ty], [IntrNoMem]>;
   1654 }
   1655 
   1656 // Vector extract and insert
   1657 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1658   def int_x86_avx2_vextracti128 : GCCBuiltin<"__builtin_ia32_extract128i256">,
   1659               Intrinsic<[llvm_v2i64_ty], [llvm_v4i64_ty,
   1660                          llvm_i8_ty], [IntrNoMem]>;
   1661   def int_x86_avx2_vinserti128 : GCCBuiltin<"__builtin_ia32_insert128i256">,
   1662               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty,
   1663                          llvm_v2i64_ty, llvm_i8_ty], [IntrNoMem]>;
   1664 }
   1665 
   1666 // Conditional load ops
   1667 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1668   def int_x86_avx2_maskload_d : GCCBuiltin<"__builtin_ia32_maskloadd">,
   1669         Intrinsic<[llvm_v4i32_ty], [llvm_ptr_ty, llvm_v4i32_ty], [IntrReadMem]>;
   1670   def int_x86_avx2_maskload_q : GCCBuiltin<"__builtin_ia32_maskloadq">,
   1671         Intrinsic<[llvm_v2i64_ty], [llvm_ptr_ty, llvm_v2i64_ty], [IntrReadMem]>;
   1672   def int_x86_avx2_maskload_d_256 : GCCBuiltin<"__builtin_ia32_maskloadd256">,
   1673         Intrinsic<[llvm_v8i32_ty], [llvm_ptr_ty, llvm_v8i32_ty], [IntrReadMem]>;
   1674   def int_x86_avx2_maskload_q_256 : GCCBuiltin<"__builtin_ia32_maskloadq256">,
   1675         Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty, llvm_v4i64_ty], [IntrReadMem]>;
   1676 }
   1677 
   1678 // Conditional store ops
   1679 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1680   def int_x86_avx2_maskstore_d : GCCBuiltin<"__builtin_ia32_maskstored">,
   1681         Intrinsic<[], [llvm_ptr_ty, llvm_v4i32_ty, llvm_v4i32_ty], []>;
   1682   def int_x86_avx2_maskstore_q : GCCBuiltin<"__builtin_ia32_maskstoreq">,
   1683         Intrinsic<[], [llvm_ptr_ty, llvm_v2i64_ty, llvm_v2i64_ty], []>;
   1684   def int_x86_avx2_maskstore_d_256 :
   1685         GCCBuiltin<"__builtin_ia32_maskstored256">,
   1686         Intrinsic<[], [llvm_ptr_ty, llvm_v8i32_ty, llvm_v8i32_ty], []>;
   1687   def int_x86_avx2_maskstore_q_256 :
   1688         GCCBuiltin<"__builtin_ia32_maskstoreq256">,
   1689         Intrinsic<[], [llvm_ptr_ty, llvm_v4i64_ty, llvm_v4i64_ty], []>;
   1690 }
   1691 
   1692 // Variable bit shift ops
   1693 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1694   def int_x86_avx2_psllv_d : GCCBuiltin<"__builtin_ia32_psllv4si">,
   1695               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1696                         [IntrNoMem]>;
   1697   def int_x86_avx2_psllv_d_256 : GCCBuiltin<"__builtin_ia32_psllv8si">,
   1698               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
   1699                         [IntrNoMem]>;
   1700   def int_x86_avx2_psllv_q : GCCBuiltin<"__builtin_ia32_psllv2di">,
   1701               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   1702                         [IntrNoMem]>;
   1703   def int_x86_avx2_psllv_q_256 : GCCBuiltin<"__builtin_ia32_psllv4di">,
   1704               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
   1705                         [IntrNoMem]>;
   1706 
   1707   def int_x86_avx2_psrlv_d : GCCBuiltin<"__builtin_ia32_psrlv4si">,
   1708               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1709                         [IntrNoMem]>;
   1710   def int_x86_avx2_psrlv_d_256 : GCCBuiltin<"__builtin_ia32_psrlv8si">,
   1711               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
   1712                         [IntrNoMem]>;
   1713   def int_x86_avx2_psrlv_q : GCCBuiltin<"__builtin_ia32_psrlv2di">,
   1714               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   1715                         [IntrNoMem]>;
   1716   def int_x86_avx2_psrlv_q_256 : GCCBuiltin<"__builtin_ia32_psrlv4di">,
   1717               Intrinsic<[llvm_v4i64_ty], [llvm_v4i64_ty, llvm_v4i64_ty],
   1718                         [IntrNoMem]>;
   1719 
   1720   def int_x86_avx2_psrav_d : GCCBuiltin<"__builtin_ia32_psrav4si">,
   1721               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1722                         [IntrNoMem]>;
   1723   def int_x86_avx2_psrav_d_256 : GCCBuiltin<"__builtin_ia32_psrav8si">,
   1724               Intrinsic<[llvm_v8i32_ty], [llvm_v8i32_ty, llvm_v8i32_ty],
   1725                         [IntrNoMem]>;
   1726 }
   1727 
   1728 // Misc.
   1729 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1730   def int_x86_avx2_pmovmskb : GCCBuiltin<"__builtin_ia32_pmovmskb256">,
   1731               Intrinsic<[llvm_i32_ty], [llvm_v32i8_ty], [IntrNoMem]>;
   1732   def int_x86_avx2_pshuf_b : GCCBuiltin<"__builtin_ia32_pshufb256">,
   1733               Intrinsic<[llvm_v32i8_ty], [llvm_v32i8_ty,
   1734                          llvm_v32i8_ty], [IntrNoMem]>;
   1735   def int_x86_avx2_mpsadbw : GCCBuiltin<"__builtin_ia32_mpsadbw256">,
   1736               Intrinsic<[llvm_v16i16_ty], [llvm_v32i8_ty, llvm_v32i8_ty,
   1737                          llvm_i32_ty], [IntrNoMem, Commutative]>;
   1738   def int_x86_avx2_movntdqa : GCCBuiltin<"__builtin_ia32_movntdqa256">,
   1739               Intrinsic<[llvm_v4i64_ty], [llvm_ptr_ty], [IntrReadMem]>;
   1740 }
   1741 
   1742 //===----------------------------------------------------------------------===//
   1743 // FMA4
   1744 
   1745 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   1746   def int_x86_fma4_vfmadd_ss : GCCBuiltin<"__builtin_ia32_vfmaddss">,
   1747               Intrinsic<[llvm_v4f32_ty],
   1748                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1749                         [IntrNoMem]>;
   1750   def int_x86_fma4_vfmadd_sd : GCCBuiltin<"__builtin_ia32_vfmaddsd">,
   1751               Intrinsic<[llvm_v2f64_ty],
   1752                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1753                         [IntrNoMem]>;
   1754   def int_x86_fma4_vfmadd_ps : GCCBuiltin<"__builtin_ia32_vfmaddps">,
   1755               Intrinsic<[llvm_v4f32_ty],
   1756                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1757                         [IntrNoMem]>;
   1758   def int_x86_fma4_vfmadd_pd : GCCBuiltin<"__builtin_ia32_vfmaddpd">,
   1759               Intrinsic<[llvm_v2f64_ty],
   1760                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1761                         [IntrNoMem]>;
   1762   def int_x86_fma4_vfmadd_ps_256 : GCCBuiltin<"__builtin_ia32_vfmaddps256">,
   1763               Intrinsic<[llvm_v8f32_ty],
   1764                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
   1765                         [IntrNoMem]>;
   1766   def int_x86_fma4_vfmadd_pd_256 : GCCBuiltin<"__builtin_ia32_vfmaddpd256">,
   1767               Intrinsic<[llvm_v4f64_ty],
   1768                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
   1769                         [IntrNoMem]>;
   1770   def int_x86_fma4_vfmsub_ss : GCCBuiltin<"__builtin_ia32_vfmsubss">,
   1771               Intrinsic<[llvm_v4f32_ty],
   1772                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1773                         [IntrNoMem]>;
   1774   def int_x86_fma4_vfmsub_sd : GCCBuiltin<"__builtin_ia32_vfmsubsd">,
   1775               Intrinsic<[llvm_v2f64_ty],
   1776                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1777                         [IntrNoMem]>;
   1778   def int_x86_fma4_vfmsub_ps : GCCBuiltin<"__builtin_ia32_vfmsubps">,
   1779               Intrinsic<[llvm_v4f32_ty],
   1780                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1781                         [IntrNoMem]>;
   1782   def int_x86_fma4_vfmsub_pd : GCCBuiltin<"__builtin_ia32_vfmsubpd">,
   1783               Intrinsic<[llvm_v2f64_ty],
   1784                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1785                         [IntrNoMem]>;
   1786   def int_x86_fma4_vfmsub_ps_256 : GCCBuiltin<"__builtin_ia32_vfmsubps256">,
   1787               Intrinsic<[llvm_v8f32_ty],
   1788                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
   1789                         [IntrNoMem]>;
   1790   def int_x86_fma4_vfmsub_pd_256 : GCCBuiltin<"__builtin_ia32_vfmsubpd256">,
   1791               Intrinsic<[llvm_v4f64_ty],
   1792                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
   1793                         [IntrNoMem]>;
   1794   def int_x86_fma4_vfnmadd_ss : GCCBuiltin<"__builtin_ia32_vfnmaddss">,
   1795               Intrinsic<[llvm_v4f32_ty],
   1796                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1797                         [IntrNoMem]>;
   1798   def int_x86_fma4_vfnmadd_sd : GCCBuiltin<"__builtin_ia32_vfnmaddsd">,
   1799               Intrinsic<[llvm_v2f64_ty],
   1800                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1801                         [IntrNoMem]>;
   1802   def int_x86_fma4_vfnmadd_ps : GCCBuiltin<"__builtin_ia32_vfnmaddps">,
   1803               Intrinsic<[llvm_v4f32_ty],
   1804                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1805                         [IntrNoMem]>;
   1806   def int_x86_fma4_vfnmadd_pd : GCCBuiltin<"__builtin_ia32_vfnmaddpd">,
   1807               Intrinsic<[llvm_v2f64_ty],
   1808                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1809                         [IntrNoMem]>;
   1810   def int_x86_fma4_vfnmadd_ps_256 : GCCBuiltin<"__builtin_ia32_vfnmaddps256">,
   1811               Intrinsic<[llvm_v8f32_ty],
   1812                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
   1813                         [IntrNoMem]>;
   1814   def int_x86_fma4_vfnmadd_pd_256 : GCCBuiltin<"__builtin_ia32_vfnmaddpd256">,
   1815               Intrinsic<[llvm_v4f64_ty],
   1816                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
   1817                         [IntrNoMem]>;
   1818   def int_x86_fma4_vfnmsub_ss : GCCBuiltin<"__builtin_ia32_vfnmsubss">,
   1819               Intrinsic<[llvm_v4f32_ty],
   1820                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1821                         [IntrNoMem]>;
   1822   def int_x86_fma4_vfnmsub_sd : GCCBuiltin<"__builtin_ia32_vfnmsubsd">,
   1823               Intrinsic<[llvm_v2f64_ty],
   1824                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1825                         [IntrNoMem]>;
   1826   def int_x86_fma4_vfnmsub_ps : GCCBuiltin<"__builtin_ia32_vfnmsubps">,
   1827               Intrinsic<[llvm_v4f32_ty],
   1828                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1829                         [IntrNoMem]>;
   1830   def int_x86_fma4_vfnmsub_pd : GCCBuiltin<"__builtin_ia32_vfnmsubpd">,
   1831               Intrinsic<[llvm_v2f64_ty],
   1832                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1833                         [IntrNoMem]>;
   1834   def int_x86_fma4_vfnmsub_ps_256 : GCCBuiltin<"__builtin_ia32_vfnmsubps256">,
   1835               Intrinsic<[llvm_v8f32_ty],
   1836                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
   1837                         [IntrNoMem]>;
   1838   def int_x86_fma4_vfnmsub_pd_256 : GCCBuiltin<"__builtin_ia32_vfnmsubpd256">,
   1839               Intrinsic<[llvm_v4f64_ty],
   1840                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
   1841                         [IntrNoMem]>;
   1842   def int_x86_fma4_vfmaddsub_ps : GCCBuiltin<"__builtin_ia32_vfmaddsubps">,
   1843               Intrinsic<[llvm_v4f32_ty],
   1844                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1845                         [IntrNoMem]>;
   1846   def int_x86_fma4_vfmaddsub_pd : GCCBuiltin<"__builtin_ia32_vfmaddsubpd">,
   1847               Intrinsic<[llvm_v2f64_ty],
   1848                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1849                         [IntrNoMem]>;
   1850   def int_x86_fma4_vfmaddsub_ps_256 :
   1851                GCCBuiltin<"__builtin_ia32_vfmaddsubps256">,
   1852               Intrinsic<[llvm_v8f32_ty],
   1853                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
   1854                         [IntrNoMem]>;
   1855   def int_x86_fma4_vfmaddsub_pd_256 :
   1856               GCCBuiltin<"__builtin_ia32_vfmaddsubpd256">,
   1857               Intrinsic<[llvm_v4f64_ty],
   1858                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
   1859                         [IntrNoMem]>;
   1860   def int_x86_fma4_vfmsubadd_ps : GCCBuiltin<"__builtin_ia32_vfmsubaddps">,
   1861               Intrinsic<[llvm_v4f32_ty],
   1862                         [llvm_v4f32_ty, llvm_v4f32_ty, llvm_v4f32_ty],
   1863                         [IntrNoMem]>;
   1864   def int_x86_fma4_vfmsubadd_pd : GCCBuiltin<"__builtin_ia32_vfmsubaddpd">,
   1865               Intrinsic<[llvm_v2f64_ty],
   1866                         [llvm_v2f64_ty, llvm_v2f64_ty, llvm_v2f64_ty],
   1867                         [IntrNoMem]>;
   1868   def int_x86_fma4_vfmsubadd_ps_256 :
   1869               GCCBuiltin<"__builtin_ia32_vfmsubaddps256">,
   1870               Intrinsic<[llvm_v8f32_ty],
   1871                         [llvm_v8f32_ty, llvm_v8f32_ty, llvm_v8f32_ty],
   1872                         [IntrNoMem]>;
   1873   def int_x86_fma4_vfmsubadd_pd_256 :
   1874               GCCBuiltin<"__builtin_ia32_vfmsubaddpd256">,
   1875               Intrinsic<[llvm_v4f64_ty],
   1876                         [llvm_v4f64_ty, llvm_v4f64_ty, llvm_v4f64_ty],
   1877                         [IntrNoMem]>;
   1878 }
   1879 
   1880 //===----------------------------------------------------------------------===//
   1881 // XOP
   1882 
   1883   def int_x86_xop_vpermil2pd : GCCBuiltin<"__builtin_ia32_vpermil2pd">,
   1884               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty,
   1885                                           llvm_v2f64_ty, llvm_i8_ty],
   1886                         [IntrNoMem]>;
   1887 
   1888   def int_x86_xop_vpermil2pd_256 :
   1889               GCCBuiltin<"__builtin_ia32_vpermil2pd256">,
   1890               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty, llvm_v4f64_ty,
   1891                                           llvm_v4f64_ty, llvm_i8_ty],
   1892                         [IntrNoMem]>;
   1893 
   1894   def int_x86_xop_vpermil2ps : GCCBuiltin<"__builtin_ia32_vpermil2ps">,
   1895               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty,
   1896                                           llvm_v4f32_ty, llvm_i8_ty],
   1897                         [IntrNoMem]>;
   1898   def int_x86_xop_vpermil2ps_256 :
   1899               GCCBuiltin<"__builtin_ia32_vpermil2ps256">,
   1900               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty, llvm_v8f32_ty,
   1901                                           llvm_v8f32_ty, llvm_i8_ty],
   1902                         [IntrNoMem]>;
   1903 
   1904   def int_x86_xop_vfrcz_pd :
   1905               GCCBuiltin<"__builtin_ia32_vfrczpd">,
   1906               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty], [IntrNoMem]>;
   1907   def int_x86_xop_vfrcz_ps :
   1908               GCCBuiltin<"__builtin_ia32_vfrczps">,
   1909               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty], [IntrNoMem]>;
   1910   def int_x86_xop_vfrcz_sd :
   1911               GCCBuiltin<"__builtin_ia32_vfrczsd">,
   1912               Intrinsic<[llvm_v2f64_ty], [llvm_v2f64_ty, llvm_v2f64_ty],
   1913                         [IntrNoMem]>;
   1914   def int_x86_xop_vfrcz_ss :
   1915               GCCBuiltin<"__builtin_ia32_vfrczss">,
   1916               Intrinsic<[llvm_v4f32_ty], [llvm_v4f32_ty, llvm_v4f32_ty],
   1917                         [IntrNoMem]>;
   1918   def int_x86_xop_vfrcz_pd_256 :
   1919               GCCBuiltin<"__builtin_ia32_vfrczpd256">,
   1920               Intrinsic<[llvm_v4f64_ty], [llvm_v4f64_ty], [IntrNoMem]>;
   1921   def int_x86_xop_vfrcz_ps_256 :
   1922               GCCBuiltin<"__builtin_ia32_vfrczps256">,
   1923               Intrinsic<[llvm_v8f32_ty], [llvm_v8f32_ty], [IntrNoMem]>;
   1924   def int_x86_xop_vpcmov :
   1925               GCCBuiltin<"__builtin_ia32_vpcmov">,
   1926               Intrinsic<[llvm_v2i64_ty],
   1927                         [llvm_v2i64_ty, llvm_v2i64_ty, llvm_v2i64_ty],
   1928                         [IntrNoMem]>;
   1929   def int_x86_xop_vpcmov_256 :
   1930               GCCBuiltin<"__builtin_ia32_vpcmov_256">,
   1931               Intrinsic<[llvm_v4i64_ty],
   1932                         [llvm_v4i64_ty, llvm_v4i64_ty, llvm_v4i64_ty],
   1933                         [IntrNoMem]>;
   1934   def int_x86_xop_vpcomeqb :
   1935               GCCBuiltin<"__builtin_ia32_vpcomeqb">,
   1936               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   1937                         [IntrNoMem]>;
   1938   def int_x86_xop_vpcomeqw :
   1939               GCCBuiltin<"__builtin_ia32_vpcomeqw">,
   1940               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   1941                         [IntrNoMem]>;
   1942   def int_x86_xop_vpcomeqd :
   1943               GCCBuiltin<"__builtin_ia32_vpcomeqd">,
   1944               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1945                         [IntrNoMem]>;
   1946   def int_x86_xop_vpcomeqq :
   1947               GCCBuiltin<"__builtin_ia32_vpcomeqq">,
   1948               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   1949                         [IntrNoMem]>;
   1950   def int_x86_xop_vpcomequb :
   1951               GCCBuiltin<"__builtin_ia32_vpcomequb">,
   1952               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   1953                         [IntrNoMem]>;
   1954   def int_x86_xop_vpcomequd :
   1955               GCCBuiltin<"__builtin_ia32_vpcomequd">,
   1956               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1957                         [IntrNoMem]>;
   1958   def int_x86_xop_vpcomequq :
   1959               GCCBuiltin<"__builtin_ia32_vpcomequq">,
   1960               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   1961                         [IntrNoMem]>;
   1962   def int_x86_xop_vpcomequw :
   1963               GCCBuiltin<"__builtin_ia32_vpcomequw">,
   1964               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   1965                         [IntrNoMem]>;
   1966   def int_x86_xop_vpcomfalseb :
   1967               GCCBuiltin<"__builtin_ia32_vpcomfalseb">,
   1968               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   1969                         [IntrNoMem]>;
   1970   def int_x86_xop_vpcomfalsed :
   1971               GCCBuiltin<"__builtin_ia32_vpcomfalsed">,
   1972               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1973                         [IntrNoMem]>;
   1974   def int_x86_xop_vpcomfalseq :
   1975               GCCBuiltin<"__builtin_ia32_vpcomfalseq">,
   1976               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   1977                         [IntrNoMem]>;
   1978   def int_x86_xop_vpcomfalseub :
   1979               GCCBuiltin<"__builtin_ia32_vpcomfalseub">,
   1980               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   1981                         [IntrNoMem]>;
   1982   def int_x86_xop_vpcomfalseud :
   1983               GCCBuiltin<"__builtin_ia32_vpcomfalseud">,
   1984               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   1985                         [IntrNoMem]>;
   1986   def int_x86_xop_vpcomfalseuq :
   1987               GCCBuiltin<"__builtin_ia32_vpcomfalseuq">,
   1988               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   1989                         [IntrNoMem]>;
   1990   def int_x86_xop_vpcomfalseuw :
   1991               GCCBuiltin<"__builtin_ia32_vpcomfalseuw">,
   1992               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   1993                         [IntrNoMem]>;
   1994   def int_x86_xop_vpcomfalsew :
   1995               GCCBuiltin<"__builtin_ia32_vpcomfalsew">,
   1996               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   1997                         [IntrNoMem]>;
   1998   def int_x86_xop_vpcomgeb :
   1999               GCCBuiltin<"__builtin_ia32_vpcomgeb">,
   2000               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2001                         [IntrNoMem]>;
   2002   def int_x86_xop_vpcomged :
   2003               GCCBuiltin<"__builtin_ia32_vpcomged">,
   2004               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2005                         [IntrNoMem]>;
   2006   def int_x86_xop_vpcomgeq :
   2007               GCCBuiltin<"__builtin_ia32_vpcomgeq">,
   2008               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2009                         [IntrNoMem]>;
   2010   def int_x86_xop_vpcomgeub :
   2011               GCCBuiltin<"__builtin_ia32_vpcomgeub">,
   2012               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2013                         [IntrNoMem]>;
   2014   def int_x86_xop_vpcomgeud :
   2015               GCCBuiltin<"__builtin_ia32_vpcomgeud">,
   2016               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2017                         [IntrNoMem]>;
   2018   def int_x86_xop_vpcomgeuq :
   2019               GCCBuiltin<"__builtin_ia32_vpcomgeuq">,
   2020               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2021                         [IntrNoMem]>;
   2022   def int_x86_xop_vpcomgeuw :
   2023               GCCBuiltin<"__builtin_ia32_vpcomgeuw">,
   2024               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2025                         [IntrNoMem]>;
   2026   def int_x86_xop_vpcomgew :
   2027               GCCBuiltin<"__builtin_ia32_vpcomgew">,
   2028               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2029                         [IntrNoMem]>;
   2030   def int_x86_xop_vpcomgtb :
   2031               GCCBuiltin<"__builtin_ia32_vpcomgtb">,
   2032               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2033                         [IntrNoMem]>;
   2034   def int_x86_xop_vpcomgtd :
   2035               GCCBuiltin<"__builtin_ia32_vpcomgtd">,
   2036               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2037                         [IntrNoMem]>;
   2038   def int_x86_xop_vpcomgtq :
   2039               GCCBuiltin<"__builtin_ia32_vpcomgtq">,
   2040               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2041                         [IntrNoMem]>;
   2042   def int_x86_xop_vpcomgtub :
   2043               GCCBuiltin<"__builtin_ia32_vpcomgtub">,
   2044               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2045                         [IntrNoMem]>;
   2046   def int_x86_xop_vpcomgtud :
   2047               GCCBuiltin<"__builtin_ia32_vpcomgtud">,
   2048               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2049                         [IntrNoMem]>;
   2050   def int_x86_xop_vpcomgtuq :
   2051               GCCBuiltin<"__builtin_ia32_vpcomgtuq">,
   2052               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2053                         [IntrNoMem]>;
   2054   def int_x86_xop_vpcomgtuw :
   2055               GCCBuiltin<"__builtin_ia32_vpcomgtuw">,
   2056               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2057                         [IntrNoMem]>;
   2058   def int_x86_xop_vpcomgtw :
   2059               GCCBuiltin<"__builtin_ia32_vpcomgtw">,
   2060               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2061                         [IntrNoMem]>;
   2062   def int_x86_xop_vpcomleb :
   2063               GCCBuiltin<"__builtin_ia32_vpcomleb">,
   2064               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2065                         [IntrNoMem]>;
   2066   def int_x86_xop_vpcomled :
   2067               GCCBuiltin<"__builtin_ia32_vpcomled">,
   2068               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2069                         [IntrNoMem]>;
   2070   def int_x86_xop_vpcomleq :
   2071               GCCBuiltin<"__builtin_ia32_vpcomleq">,
   2072               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2073                         [IntrNoMem]>;
   2074   def int_x86_xop_vpcomleub :
   2075               GCCBuiltin<"__builtin_ia32_vpcomleub">,
   2076               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2077                         [IntrNoMem]>;
   2078   def int_x86_xop_vpcomleud :
   2079               GCCBuiltin<"__builtin_ia32_vpcomleud">,
   2080               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2081                         [IntrNoMem]>;
   2082   def int_x86_xop_vpcomleuq :
   2083               GCCBuiltin<"__builtin_ia32_vpcomleuq">,
   2084               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2085                         [IntrNoMem]>;
   2086   def int_x86_xop_vpcomleuw :
   2087               GCCBuiltin<"__builtin_ia32_vpcomleuw">,
   2088               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2089                         [IntrNoMem]>;
   2090   def int_x86_xop_vpcomlew :
   2091               GCCBuiltin<"__builtin_ia32_vpcomlew">,
   2092               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2093                         [IntrNoMem]>;
   2094   def int_x86_xop_vpcomltb :
   2095               GCCBuiltin<"__builtin_ia32_vpcomltb">,
   2096               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2097                         [IntrNoMem]>;
   2098   def int_x86_xop_vpcomltd :
   2099               GCCBuiltin<"__builtin_ia32_vpcomltd">,
   2100               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2101                         [IntrNoMem]>;
   2102   def int_x86_xop_vpcomltq :
   2103               GCCBuiltin<"__builtin_ia32_vpcomltq">,
   2104               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2105                         [IntrNoMem]>;
   2106   def int_x86_xop_vpcomltub :
   2107               GCCBuiltin<"__builtin_ia32_vpcomltub">,
   2108               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2109                         [IntrNoMem]>;
   2110   def int_x86_xop_vpcomltud :
   2111               GCCBuiltin<"__builtin_ia32_vpcomltud">,
   2112               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2113                         [IntrNoMem]>;
   2114   def int_x86_xop_vpcomltuq :
   2115               GCCBuiltin<"__builtin_ia32_vpcomltuq">,
   2116               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2117                         [IntrNoMem]>;
   2118   def int_x86_xop_vpcomltuw :
   2119               GCCBuiltin<"__builtin_ia32_vpcomltuw">,
   2120               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2121                         [IntrNoMem]>;
   2122   def int_x86_xop_vpcomltw :
   2123               GCCBuiltin<"__builtin_ia32_vpcomltw">,
   2124               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2125                         [IntrNoMem]>;
   2126   def int_x86_xop_vpcomneb :
   2127               GCCBuiltin<"__builtin_ia32_vpcomneb">,
   2128               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2129                         [IntrNoMem]>;
   2130   def int_x86_xop_vpcomned :
   2131               GCCBuiltin<"__builtin_ia32_vpcomned">,
   2132               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2133                         [IntrNoMem]>;
   2134   def int_x86_xop_vpcomneq :
   2135               GCCBuiltin<"__builtin_ia32_vpcomneq">,
   2136               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2137                         [IntrNoMem]>;
   2138   def int_x86_xop_vpcomneub :
   2139               GCCBuiltin<"__builtin_ia32_vpcomneub">,
   2140               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2141                         [IntrNoMem]>;
   2142   def int_x86_xop_vpcomneud :
   2143               GCCBuiltin<"__builtin_ia32_vpcomneud">,
   2144               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2145                         [IntrNoMem]>;
   2146   def int_x86_xop_vpcomneuq :
   2147               GCCBuiltin<"__builtin_ia32_vpcomneuq">,
   2148               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2149                         [IntrNoMem]>;
   2150   def int_x86_xop_vpcomneuw :
   2151               GCCBuiltin<"__builtin_ia32_vpcomneuw">,
   2152               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2153                         [IntrNoMem]>;
   2154   def int_x86_xop_vpcomnew :
   2155               GCCBuiltin<"__builtin_ia32_vpcomnew">,
   2156               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2157                         [IntrNoMem]>;
   2158   def int_x86_xop_vpcomtrueb :
   2159               GCCBuiltin<"__builtin_ia32_vpcomtrueb">,
   2160               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2161                         [IntrNoMem]>;
   2162   def int_x86_xop_vpcomtrued :
   2163               GCCBuiltin<"__builtin_ia32_vpcomtrued">,
   2164               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2165                         [IntrNoMem]>;
   2166   def int_x86_xop_vpcomtrueq :
   2167               GCCBuiltin<"__builtin_ia32_vpcomtrueq">,
   2168               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2169                         [IntrNoMem]>;
   2170   def int_x86_xop_vpcomtrueub :
   2171               GCCBuiltin<"__builtin_ia32_vpcomtrueub">,
   2172               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2173                         [IntrNoMem]>;
   2174   def int_x86_xop_vpcomtrueud :
   2175               GCCBuiltin<"__builtin_ia32_vpcomtrueud">,
   2176               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2177                         [IntrNoMem]>;
   2178   def int_x86_xop_vpcomtrueuq :
   2179               GCCBuiltin<"__builtin_ia32_vpcomtrueuq">,
   2180               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2181                         [IntrNoMem]>;
   2182   def int_x86_xop_vpcomtrueuw :
   2183               GCCBuiltin<"__builtin_ia32_vpcomtrueuw">,
   2184               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2185                         [IntrNoMem]>;
   2186   def int_x86_xop_vpcomtruew :
   2187               GCCBuiltin<"__builtin_ia32_vpcomtruew">,
   2188               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2189                         [IntrNoMem]>;
   2190   def int_x86_xop_vphaddbd :
   2191               GCCBuiltin<"__builtin_ia32_vphaddbd">,
   2192               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2193   def int_x86_xop_vphaddbq :
   2194               GCCBuiltin<"__builtin_ia32_vphaddbq">,
   2195               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2196   def int_x86_xop_vphaddbw :
   2197               GCCBuiltin<"__builtin_ia32_vphaddbw">,
   2198               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2199   def int_x86_xop_vphadddq :
   2200               GCCBuiltin<"__builtin_ia32_vphadddq">,
   2201               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
   2202   def int_x86_xop_vphaddubd :
   2203               GCCBuiltin<"__builtin_ia32_vphaddubd">,
   2204               Intrinsic<[llvm_v4i32_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2205   def int_x86_xop_vphaddubq :
   2206               GCCBuiltin<"__builtin_ia32_vphaddubq">,
   2207               Intrinsic<[llvm_v2i64_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2208   def int_x86_xop_vphaddubw :
   2209               GCCBuiltin<"__builtin_ia32_vphaddubw">,
   2210               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2211   def int_x86_xop_vphaddudq :
   2212               GCCBuiltin<"__builtin_ia32_vphaddudq">,
   2213               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
   2214   def int_x86_xop_vphadduwd :
   2215               GCCBuiltin<"__builtin_ia32_vphadduwd">,
   2216               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2217   def int_x86_xop_vphadduwq :
   2218               GCCBuiltin<"__builtin_ia32_vphadduwq">,
   2219               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2220   def int_x86_xop_vphaddwd :
   2221               GCCBuiltin<"__builtin_ia32_vphaddwd">,
   2222               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2223   def int_x86_xop_vphaddwq :
   2224               GCCBuiltin<"__builtin_ia32_vphaddwq">,
   2225               Intrinsic<[llvm_v2i64_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2226   def int_x86_xop_vphsubbw :
   2227               GCCBuiltin<"__builtin_ia32_vphsubbw">,
   2228               Intrinsic<[llvm_v8i16_ty], [llvm_v16i8_ty], [IntrNoMem]>;
   2229   def int_x86_xop_vphsubdq :
   2230               GCCBuiltin<"__builtin_ia32_vphsubdq">,
   2231               Intrinsic<[llvm_v2i64_ty], [llvm_v4i32_ty], [IntrNoMem]>;
   2232   def int_x86_xop_vphsubwd :
   2233               GCCBuiltin<"__builtin_ia32_vphsubwd">,
   2234               Intrinsic<[llvm_v4i32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2235   def int_x86_xop_vpmacsdd :
   2236               GCCBuiltin<"__builtin_ia32_vpmacsdd">,
   2237               Intrinsic<[llvm_v4i32_ty],
   2238                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
   2239                         [IntrNoMem]>;
   2240   def int_x86_xop_vpmacsdqh :
   2241               GCCBuiltin<"__builtin_ia32_vpmacsdqh">,
   2242               Intrinsic<[llvm_v2i64_ty],
   2243                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
   2244                         [IntrNoMem]>;
   2245   def int_x86_xop_vpmacsdql :
   2246               GCCBuiltin<"__builtin_ia32_vpmacsdql">,
   2247               Intrinsic<[llvm_v2i64_ty],
   2248                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
   2249                         [IntrNoMem]>;
   2250   def int_x86_xop_vpmacssdd :
   2251               GCCBuiltin<"__builtin_ia32_vpmacssdd">,
   2252               Intrinsic<[llvm_v4i32_ty],
   2253                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v4i32_ty],
   2254                         [IntrNoMem]>;
   2255   def int_x86_xop_vpmacssdqh :
   2256               GCCBuiltin<"__builtin_ia32_vpmacssdqh">,
   2257               Intrinsic<[llvm_v2i64_ty],
   2258                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
   2259                         [IntrNoMem]>;
   2260   def int_x86_xop_vpmacssdql :
   2261               GCCBuiltin<"__builtin_ia32_vpmacssdql">,
   2262               Intrinsic<[llvm_v2i64_ty],
   2263                         [llvm_v4i32_ty, llvm_v4i32_ty, llvm_v2i64_ty],
   2264                         [IntrNoMem]>;
   2265   def int_x86_xop_vpmacsswd :
   2266               GCCBuiltin<"__builtin_ia32_vpmacsswd">,
   2267               Intrinsic<[llvm_v4i32_ty],
   2268                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
   2269                         [IntrNoMem]>;
   2270   def int_x86_xop_vpmacssww :
   2271               GCCBuiltin<"__builtin_ia32_vpmacssww">,
   2272               Intrinsic<[llvm_v8i16_ty],
   2273                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
   2274                         [IntrNoMem]>;
   2275   def int_x86_xop_vpmacswd :
   2276               GCCBuiltin<"__builtin_ia32_vpmacswd">,
   2277               Intrinsic<[llvm_v4i32_ty],
   2278                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
   2279                         [IntrNoMem]>;
   2280   def int_x86_xop_vpmacsww :
   2281               GCCBuiltin<"__builtin_ia32_vpmacsww">,
   2282               Intrinsic<[llvm_v8i16_ty],
   2283                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v8i16_ty],
   2284                         [IntrNoMem]>;
   2285   def int_x86_xop_vpmadcsswd :
   2286               GCCBuiltin<"__builtin_ia32_vpmadcsswd">,
   2287               Intrinsic<[llvm_v4i32_ty],
   2288                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
   2289                         [IntrNoMem]>;
   2290   def int_x86_xop_vpmadcswd :
   2291               GCCBuiltin<"__builtin_ia32_vpmadcswd">,
   2292               Intrinsic<[llvm_v4i32_ty],
   2293                         [llvm_v8i16_ty, llvm_v8i16_ty, llvm_v4i32_ty],
   2294                         [IntrNoMem]>;
   2295   def int_x86_xop_vpperm :
   2296               GCCBuiltin<"__builtin_ia32_vpperm">,
   2297               Intrinsic<[llvm_v16i8_ty],
   2298                         [llvm_v16i8_ty, llvm_v16i8_ty, llvm_v16i8_ty],
   2299                         [IntrNoMem]>;
   2300   def int_x86_xop_vprotb :
   2301               GCCBuiltin<"__builtin_ia32_vprotb">,
   2302               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2303                         [IntrNoMem]>;
   2304   def int_x86_xop_vprotd :
   2305               GCCBuiltin<"__builtin_ia32_vprotd">,
   2306               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2307                         [IntrNoMem]>;
   2308   def int_x86_xop_vprotq :
   2309               GCCBuiltin<"__builtin_ia32_vprotq">,
   2310               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2311                         [IntrNoMem]>;
   2312   def int_x86_xop_vprotw :
   2313               GCCBuiltin<"__builtin_ia32_vprotw">,
   2314               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2315                         [IntrNoMem]>;
   2316   def int_x86_xop_vpshab :
   2317               GCCBuiltin<"__builtin_ia32_vpshab">,
   2318               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2319                         [IntrNoMem]>;
   2320   def int_x86_xop_vpshad :
   2321               GCCBuiltin<"__builtin_ia32_vpshad">,
   2322               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2323                         [IntrNoMem]>;
   2324   def int_x86_xop_vpshaq :
   2325               GCCBuiltin<"__builtin_ia32_vpshaq">,
   2326               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2327                         [IntrNoMem]>;
   2328   def int_x86_xop_vpshaw :
   2329               GCCBuiltin<"__builtin_ia32_vpshaw">,
   2330               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2331                         [IntrNoMem]>;
   2332   def int_x86_xop_vpshlb :
   2333               GCCBuiltin<"__builtin_ia32_vpshlb">,
   2334               Intrinsic<[llvm_v16i8_ty], [llvm_v16i8_ty, llvm_v16i8_ty],
   2335                         [IntrNoMem]>;
   2336   def int_x86_xop_vpshld :
   2337               GCCBuiltin<"__builtin_ia32_vpshld">,
   2338               Intrinsic<[llvm_v4i32_ty], [llvm_v4i32_ty, llvm_v4i32_ty],
   2339                         [IntrNoMem]>;
   2340   def int_x86_xop_vpshlq :
   2341               GCCBuiltin<"__builtin_ia32_vpshlq">,
   2342               Intrinsic<[llvm_v2i64_ty], [llvm_v2i64_ty, llvm_v2i64_ty],
   2343                         [IntrNoMem]>;
   2344   def int_x86_xop_vpshlw :
   2345               GCCBuiltin<"__builtin_ia32_vpshlw">,
   2346               Intrinsic<[llvm_v8i16_ty], [llvm_v8i16_ty, llvm_v8i16_ty],
   2347                         [IntrNoMem]>;
   2348 
   2349 //===----------------------------------------------------------------------===//
   2350 // MMX
   2351 
   2352 // Empty MMX state op.
   2353 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2354   def int_x86_mmx_emms  : GCCBuiltin<"__builtin_ia32_emms">,
   2355               Intrinsic<[], [], []>;
   2356   def int_x86_mmx_femms : GCCBuiltin<"__builtin_ia32_femms">,
   2357               Intrinsic<[], [], []>;
   2358 }
   2359 
   2360 // Integer arithmetic ops.
   2361 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2362   // Addition
   2363   def int_x86_mmx_padd_b : GCCBuiltin<"__builtin_ia32_paddb">,
   2364               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2365                         [IntrNoMem]>;
   2366   def int_x86_mmx_padd_w : GCCBuiltin<"__builtin_ia32_paddw">,
   2367               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2368                         [IntrNoMem]>;
   2369   def int_x86_mmx_padd_d : GCCBuiltin<"__builtin_ia32_paddd">,
   2370               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2371                         [IntrNoMem]>;
   2372   def int_x86_mmx_padd_q : GCCBuiltin<"__builtin_ia32_paddq">,
   2373               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2374                         [IntrNoMem]>;
   2375 
   2376   def int_x86_mmx_padds_b : GCCBuiltin<"__builtin_ia32_paddsb">,
   2377               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2378                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2379   def int_x86_mmx_padds_w : GCCBuiltin<"__builtin_ia32_paddsw">,
   2380               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2381                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2382 
   2383   def int_x86_mmx_paddus_b : GCCBuiltin<"__builtin_ia32_paddusb">,
   2384               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2385                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2386   def int_x86_mmx_paddus_w : GCCBuiltin<"__builtin_ia32_paddusw">,
   2387               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2388                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2389 
   2390   // Subtraction
   2391   def int_x86_mmx_psub_b : GCCBuiltin<"__builtin_ia32_psubb">,
   2392               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2393                         [IntrNoMem]>;
   2394   def int_x86_mmx_psub_w : GCCBuiltin<"__builtin_ia32_psubw">,
   2395               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2396                         [IntrNoMem]>;
   2397   def int_x86_mmx_psub_d : GCCBuiltin<"__builtin_ia32_psubd">,
   2398               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2399                         [IntrNoMem]>;
   2400   def int_x86_mmx_psub_q : GCCBuiltin<"__builtin_ia32_psubq">,
   2401               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2402                         [IntrNoMem]>;
   2403 
   2404   def int_x86_mmx_psubs_b : GCCBuiltin<"__builtin_ia32_psubsb">,
   2405               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2406                          llvm_x86mmx_ty], [IntrNoMem]>;
   2407   def int_x86_mmx_psubs_w : GCCBuiltin<"__builtin_ia32_psubsw">,
   2408               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2409                          llvm_x86mmx_ty], [IntrNoMem]>;
   2410 
   2411   def int_x86_mmx_psubus_b : GCCBuiltin<"__builtin_ia32_psubusb">,
   2412               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2413                          llvm_x86mmx_ty], [IntrNoMem]>;
   2414   def int_x86_mmx_psubus_w : GCCBuiltin<"__builtin_ia32_psubusw">,
   2415               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2416                          llvm_x86mmx_ty], [IntrNoMem]>;
   2417 
   2418   // Multiplication
   2419   def int_x86_mmx_pmulh_w : GCCBuiltin<"__builtin_ia32_pmulhw">,
   2420               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2421                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2422   def int_x86_mmx_pmull_w : GCCBuiltin<"__builtin_ia32_pmullw">,
   2423               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2424                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2425   def int_x86_mmx_pmulhu_w : GCCBuiltin<"__builtin_ia32_pmulhuw">,
   2426               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2427                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2428   def int_x86_mmx_pmulu_dq : GCCBuiltin<"__builtin_ia32_pmuludq">,
   2429               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2430                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2431   def int_x86_mmx_pmadd_wd : GCCBuiltin<"__builtin_ia32_pmaddwd">,
   2432               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2433                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2434 
   2435   // Bitwise operations
   2436   def int_x86_mmx_pand : GCCBuiltin<"__builtin_ia32_pand">,
   2437               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2438                         [IntrNoMem]>;
   2439   def int_x86_mmx_pandn : GCCBuiltin<"__builtin_ia32_pandn">,
   2440               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2441                         [IntrNoMem]>;
   2442   def int_x86_mmx_por : GCCBuiltin<"__builtin_ia32_por">,
   2443               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2444                         [IntrNoMem]>;
   2445   def int_x86_mmx_pxor : GCCBuiltin<"__builtin_ia32_pxor">,
   2446               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2447                         [IntrNoMem]>;
   2448 
   2449   // Averages
   2450   def int_x86_mmx_pavg_b : GCCBuiltin<"__builtin_ia32_pavgb">,
   2451               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2452                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2453   def int_x86_mmx_pavg_w : GCCBuiltin<"__builtin_ia32_pavgw">,
   2454               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2455                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2456 
   2457   // Maximum
   2458   def int_x86_mmx_pmaxu_b : GCCBuiltin<"__builtin_ia32_pmaxub">,
   2459               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2460                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2461   def int_x86_mmx_pmaxs_w : GCCBuiltin<"__builtin_ia32_pmaxsw">,
   2462               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2463                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2464 
   2465   // Minimum
   2466   def int_x86_mmx_pminu_b : GCCBuiltin<"__builtin_ia32_pminub">,
   2467               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2468                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2469   def int_x86_mmx_pmins_w : GCCBuiltin<"__builtin_ia32_pminsw">,
   2470               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2471                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2472 
   2473   // Packed sum of absolute differences
   2474   def int_x86_mmx_psad_bw : GCCBuiltin<"__builtin_ia32_psadbw">,
   2475               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2476                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2477 }
   2478 
   2479 // Integer shift ops.
   2480 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2481   // Shift left logical
   2482   def int_x86_mmx_psll_w : GCCBuiltin<"__builtin_ia32_psllw">,
   2483               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2484                          llvm_x86mmx_ty], [IntrNoMem]>;
   2485   def int_x86_mmx_psll_d : GCCBuiltin<"__builtin_ia32_pslld">,
   2486               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2487                          llvm_x86mmx_ty], [IntrNoMem]>;
   2488   def int_x86_mmx_psll_q : GCCBuiltin<"__builtin_ia32_psllq">,
   2489               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2490                          llvm_x86mmx_ty], [IntrNoMem]>;
   2491 
   2492   def int_x86_mmx_psrl_w : GCCBuiltin<"__builtin_ia32_psrlw">,
   2493               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2494                          llvm_x86mmx_ty], [IntrNoMem]>;
   2495   def int_x86_mmx_psrl_d : GCCBuiltin<"__builtin_ia32_psrld">,
   2496               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2497                          llvm_x86mmx_ty], [IntrNoMem]>;
   2498   def int_x86_mmx_psrl_q : GCCBuiltin<"__builtin_ia32_psrlq">,
   2499               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2500                          llvm_x86mmx_ty], [IntrNoMem]>;
   2501 
   2502   def int_x86_mmx_psra_w : GCCBuiltin<"__builtin_ia32_psraw">,
   2503               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2504                          llvm_x86mmx_ty], [IntrNoMem]>;
   2505   def int_x86_mmx_psra_d : GCCBuiltin<"__builtin_ia32_psrad">,
   2506               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2507                          llvm_x86mmx_ty], [IntrNoMem]>;
   2508 
   2509   def int_x86_mmx_pslli_w : GCCBuiltin<"__builtin_ia32_psllwi">,
   2510               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2511                          llvm_i32_ty], [IntrNoMem]>;
   2512   def int_x86_mmx_pslli_d : GCCBuiltin<"__builtin_ia32_pslldi">,
   2513               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2514                          llvm_i32_ty], [IntrNoMem]>;
   2515   def int_x86_mmx_pslli_q : GCCBuiltin<"__builtin_ia32_psllqi">,
   2516               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2517                          llvm_i32_ty], [IntrNoMem]>;
   2518 
   2519   def int_x86_mmx_psrli_w : GCCBuiltin<"__builtin_ia32_psrlwi">,
   2520               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2521                          llvm_i32_ty], [IntrNoMem]>;
   2522   def int_x86_mmx_psrli_d : GCCBuiltin<"__builtin_ia32_psrldi">,
   2523               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2524                          llvm_i32_ty], [IntrNoMem]>;
   2525   def int_x86_mmx_psrli_q : GCCBuiltin<"__builtin_ia32_psrlqi">,
   2526               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2527                          llvm_i32_ty], [IntrNoMem]>;
   2528 
   2529   def int_x86_mmx_psrai_w : GCCBuiltin<"__builtin_ia32_psrawi">,
   2530               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2531                          llvm_i32_ty], [IntrNoMem]>;
   2532   def int_x86_mmx_psrai_d : GCCBuiltin<"__builtin_ia32_psradi">,
   2533               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2534                          llvm_i32_ty], [IntrNoMem]>;
   2535 }
   2536 
   2537 // Pack ops.
   2538 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2539   def int_x86_mmx_packsswb : GCCBuiltin<"__builtin_ia32_packsswb">,
   2540               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2541                          llvm_x86mmx_ty], [IntrNoMem]>;
   2542   def int_x86_mmx_packssdw : GCCBuiltin<"__builtin_ia32_packssdw">,
   2543               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2544                          llvm_x86mmx_ty], [IntrNoMem]>;
   2545   def int_x86_mmx_packuswb : GCCBuiltin<"__builtin_ia32_packuswb">,
   2546               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2547                          llvm_x86mmx_ty], [IntrNoMem]>;
   2548 }
   2549 
   2550 // Unpacking ops.
   2551 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2552   def int_x86_mmx_punpckhbw : GCCBuiltin<"__builtin_ia32_punpckhbw">,
   2553               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2554                         [IntrNoMem]>;
   2555   def int_x86_mmx_punpckhwd : GCCBuiltin<"__builtin_ia32_punpckhwd">,
   2556               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2557                         [IntrNoMem]>;
   2558   def int_x86_mmx_punpckhdq : GCCBuiltin<"__builtin_ia32_punpckhdq">,
   2559               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2560                         [IntrNoMem]>;
   2561   def int_x86_mmx_punpcklbw : GCCBuiltin<"__builtin_ia32_punpcklbw">,
   2562               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2563                         [IntrNoMem]>;
   2564   def int_x86_mmx_punpcklwd : GCCBuiltin<"__builtin_ia32_punpcklwd">,
   2565               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2566                         [IntrNoMem]>;
   2567   def int_x86_mmx_punpckldq : GCCBuiltin<"__builtin_ia32_punpckldq">,
   2568               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty, llvm_x86mmx_ty],
   2569                         [IntrNoMem]>;
   2570 }
   2571 
   2572 // Integer comparison ops
   2573 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2574   def int_x86_mmx_pcmpeq_b : GCCBuiltin<"__builtin_ia32_pcmpeqb">,
   2575               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2576                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2577   def int_x86_mmx_pcmpeq_w : GCCBuiltin<"__builtin_ia32_pcmpeqw">,
   2578               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2579                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2580   def int_x86_mmx_pcmpeq_d : GCCBuiltin<"__builtin_ia32_pcmpeqd">,
   2581               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2582                          llvm_x86mmx_ty], [IntrNoMem, Commutative]>;
   2583 
   2584   def int_x86_mmx_pcmpgt_b : GCCBuiltin<"__builtin_ia32_pcmpgtb">,
   2585               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2586                          llvm_x86mmx_ty], [IntrNoMem]>;
   2587   def int_x86_mmx_pcmpgt_w : GCCBuiltin<"__builtin_ia32_pcmpgtw">,
   2588               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2589                          llvm_x86mmx_ty], [IntrNoMem]>;
   2590   def int_x86_mmx_pcmpgt_d : GCCBuiltin<"__builtin_ia32_pcmpgtd">,
   2591               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2592                          llvm_x86mmx_ty], [IntrNoMem]>;
   2593 }
   2594 
   2595 // Misc.
   2596 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2597   def int_x86_mmx_maskmovq : GCCBuiltin<"__builtin_ia32_maskmovq">,
   2598               Intrinsic<[], [llvm_x86mmx_ty, llvm_x86mmx_ty, llvm_ptr_ty], []>;
   2599 
   2600   def int_x86_mmx_pmovmskb : GCCBuiltin<"__builtin_ia32_pmovmskb">,
   2601               Intrinsic<[llvm_i32_ty], [llvm_x86mmx_ty], [IntrNoMem]>;
   2602 
   2603   def int_x86_mmx_movnt_dq : GCCBuiltin<"__builtin_ia32_movntq">,
   2604               Intrinsic<[], [llvm_ptrx86mmx_ty, llvm_x86mmx_ty], []>;
   2605 
   2606   def int_x86_mmx_palignr_b : GCCBuiltin<"__builtin_ia32_palignr">,
   2607               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2608                         llvm_x86mmx_ty, llvm_i8_ty], [IntrNoMem]>;
   2609 
   2610   def int_x86_mmx_pextr_w : GCCBuiltin<"__builtin_ia32_vec_ext_v4hi">,
   2611               Intrinsic<[llvm_i32_ty], [llvm_x86mmx_ty, llvm_i32_ty],
   2612                         [IntrNoMem]>;
   2613 
   2614   def int_x86_mmx_pinsr_w : GCCBuiltin<"__builtin_ia32_vec_set_v4hi">,
   2615               Intrinsic<[llvm_x86mmx_ty], [llvm_x86mmx_ty,
   2616                         llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
   2617 }
   2618 
   2619 //===----------------------------------------------------------------------===//
   2620 // BMI
   2621 
   2622 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2623   def int_x86_bmi_bextr_32 : GCCBuiltin<"__builtin_ia32_bextr_u32">,
   2624               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
   2625   def int_x86_bmi_bextr_64 : GCCBuiltin<"__builtin_ia32_bextr_u64">,
   2626               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
   2627   def int_x86_bmi_bzhi_32 : GCCBuiltin<"__builtin_ia32_bzhi_si">,
   2628               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
   2629   def int_x86_bmi_bzhi_64 : GCCBuiltin<"__builtin_ia32_bzhi_di">,
   2630               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
   2631   def int_x86_bmi_pdep_32 : GCCBuiltin<"__builtin_ia32_pdep_si">,
   2632               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
   2633   def int_x86_bmi_pdep_64 : GCCBuiltin<"__builtin_ia32_pdep_di">,
   2634               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
   2635   def int_x86_bmi_pext_32 : GCCBuiltin<"__builtin_ia32_pext_si">,
   2636               Intrinsic<[llvm_i32_ty], [llvm_i32_ty, llvm_i32_ty], [IntrNoMem]>;
   2637   def int_x86_bmi_pext_64 : GCCBuiltin<"__builtin_ia32_pext_di">,
   2638               Intrinsic<[llvm_i64_ty], [llvm_i64_ty, llvm_i64_ty], [IntrNoMem]>;
   2639 }
   2640 
   2641 //===----------------------------------------------------------------------===//
   2642 // FS/GS Base
   2643 
   2644 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2645   def int_x86_rdfsbase_32 : GCCBuiltin<"__builtin_ia32_rdfsbase32">,
   2646               Intrinsic<[llvm_i32_ty], []>;
   2647   def int_x86_rdgsbase_32 : GCCBuiltin<"__builtin_ia32_rdgsbase32">,
   2648               Intrinsic<[llvm_i32_ty], []>;
   2649   def int_x86_rdfsbase_64 : GCCBuiltin<"__builtin_ia32_rdfsbase64">,
   2650               Intrinsic<[llvm_i64_ty], []>;
   2651   def int_x86_rdgsbase_64 : GCCBuiltin<"__builtin_ia32_rdgsbase64">,
   2652               Intrinsic<[llvm_i64_ty], []>;
   2653   def int_x86_wrfsbase_32 : GCCBuiltin<"__builtin_ia32_wrfsbase32">,
   2654               Intrinsic<[], [llvm_i32_ty]>;
   2655   def int_x86_wrgsbase_32 : GCCBuiltin<"__builtin_ia32_wrgsbase32">,
   2656               Intrinsic<[], [llvm_i32_ty]>;
   2657   def int_x86_wrfsbase_64 : GCCBuiltin<"__builtin_ia32_wrfsbase64">,
   2658               Intrinsic<[], [llvm_i64_ty]>;
   2659   def int_x86_wrgsbase_64 : GCCBuiltin<"__builtin_ia32_wrgsbase64">,
   2660               Intrinsic<[], [llvm_i64_ty]>;
   2661 }
   2662 
   2663 //===----------------------------------------------------------------------===//
   2664 // Half float conversion
   2665 
   2666 let TargetPrefix = "x86" in {  // All intrinsics start with "llvm.x86.".
   2667   def int_x86_vcvtph2ps_128 : GCCBuiltin<"__builtin_ia32_vcvtph2ps">,
   2668               Intrinsic<[llvm_v4f32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2669   def int_x86_vcvtph2ps_256 : GCCBuiltin<"__builtin_ia32_vcvtph2ps256">,
   2670               Intrinsic<[llvm_v8f32_ty], [llvm_v8i16_ty], [IntrNoMem]>;
   2671   def int_x86_vcvtps2ph_128 : GCCBuiltin<"__builtin_ia32_vcvtps2ph">,
   2672               Intrinsic<[llvm_v8i16_ty], [llvm_v4f32_ty, llvm_i32_ty],
   2673                         [IntrNoMem]>;
   2674   def int_x86_vcvtps2ph_256 : GCCBuiltin<"__builtin_ia32_vcvtps2ph256">,
   2675               Intrinsic<[llvm_v8i16_ty], [llvm_v8f32_ty, llvm_i32_ty],
   2676                         [IntrNoMem]>;
   2677 }
   2678