Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 %s -O3 -triple=x86_64-apple-darwin -target-feature +xop -emit-llvm -o - | FileCheck %s
      2 
      3 // Don't include mm_malloc.h, it's system specific.
      4 #define __MM_MALLOC_H
      5 
      6 #include <x86intrin.h>
      7 
      8 __m128i test_mm_maccs_epi16(__m128i a, __m128i b, __m128i c) {
      9   // CHECK: @llvm.x86.xop.vpmacssww
     10   return _mm_maccs_epi16(a, b, c);
     11 }
     12 
     13 __m128i test_mm_macc_epi16(__m128i a, __m128i b, __m128i c) {
     14   // CHECK: @llvm.x86.xop.vpmacsww
     15   return _mm_macc_epi16(a, b, c);
     16 }
     17 
     18 __m128i test_mm_maccsd_epi16(__m128i a, __m128i b, __m128i c) {
     19   // CHECK: @llvm.x86.xop.vpmacsswd
     20   return _mm_maccsd_epi16(a, b, c);
     21 }
     22 
     23 __m128i test_mm_maccd_epi16(__m128i a, __m128i b, __m128i c) {
     24   // CHECK: @llvm.x86.xop.vpmacswd
     25   return _mm_maccd_epi16(a, b, c);
     26 }
     27 
     28 __m128i test_mm_maccs_epi32(__m128i a, __m128i b, __m128i c) {
     29   // CHECK: @llvm.x86.xop.vpmacssdd
     30   return _mm_maccs_epi32(a, b, c);
     31 }
     32 
     33 __m128i test_mm_macc_epi32(__m128i a, __m128i b, __m128i c) {
     34   // CHECK: @llvm.x86.xop.vpmacsdd
     35   return _mm_macc_epi32(a, b, c);
     36 }
     37 
     38 __m128i test_mm_maccslo_epi32(__m128i a, __m128i b, __m128i c) {
     39   // CHECK: @llvm.x86.xop.vpmacssdql
     40   return _mm_maccslo_epi32(a, b, c);
     41 }
     42 
     43 __m128i test_mm_macclo_epi32(__m128i a, __m128i b, __m128i c) {
     44   // CHECK: @llvm.x86.xop.vpmacsdql
     45   return _mm_macclo_epi32(a, b, c);
     46 }
     47 
     48 __m128i test_mm_maccshi_epi32(__m128i a, __m128i b, __m128i c) {
     49   // CHECK: @llvm.x86.xop.vpmacssdqh
     50   return _mm_maccshi_epi32(a, b, c);
     51 }
     52 
     53 __m128i test_mm_macchi_epi32(__m128i a, __m128i b, __m128i c) {
     54   // CHECK: @llvm.x86.xop.vpmacsdqh
     55   return _mm_macchi_epi32(a, b, c);
     56 }
     57 
     58 __m128i test_mm_maddsd_epi16(__m128i a, __m128i b, __m128i c) {
     59   // CHECK: @llvm.x86.xop.vpmadcsswd
     60   return _mm_maddsd_epi16(a, b, c);
     61 }
     62 
     63 __m128i test_mm_maddd_epi16(__m128i a, __m128i b, __m128i c) {
     64   // CHECK: @llvm.x86.xop.vpmadcswd
     65   return _mm_maddd_epi16(a, b, c);
     66 }
     67 
     68 __m128i test_mm_haddw_epi8(__m128i a) {
     69   // CHECK: @llvm.x86.xop.vphaddbw
     70   return _mm_haddw_epi8(a);
     71 }
     72 
     73 __m128i test_mm_haddd_epi8(__m128i a) {
     74   // CHECK: @llvm.x86.xop.vphaddbd
     75   return _mm_haddd_epi8(a);
     76 }
     77 
     78 __m128i test_mm_haddq_epi8(__m128i a) {
     79   // CHECK: @llvm.x86.xop.vphaddbq
     80   return _mm_haddq_epi8(a);
     81 }
     82 
     83 __m128i test_mm_haddd_epi16(__m128i a) {
     84   // CHECK: @llvm.x86.xop.vphaddwd
     85   return _mm_haddd_epi16(a);
     86 }
     87 
     88 __m128i test_mm_haddq_epi16(__m128i a) {
     89   // CHECK: @llvm.x86.xop.vphaddwq
     90   return _mm_haddq_epi16(a);
     91 }
     92 
     93 __m128i test_mm_haddq_epi32(__m128i a) {
     94   // CHECK: @llvm.x86.xop.vphadddq
     95   return _mm_haddq_epi32(a);
     96 }
     97 
     98 __m128i test_mm_haddw_epu8(__m128i a) {
     99   // CHECK: @llvm.x86.xop.vphaddubw
    100   return _mm_haddw_epu8(a);
    101 }
    102 
    103 __m128i test_mm_haddd_epu8(__m128i a) {
    104   // CHECK: @llvm.x86.xop.vphaddubd
    105   return _mm_haddd_epu8(a);
    106 }
    107 
    108 __m128i test_mm_haddq_epu8(__m128i a) {
    109   // CHECK: @llvm.x86.xop.vphaddubq
    110   return _mm_haddq_epu8(a);
    111 }
    112 
    113 __m128i test_mm_haddd_epu16(__m128i a) {
    114   // CHECK: @llvm.x86.xop.vphadduwd
    115   return _mm_haddd_epu16(a);
    116 }
    117 
    118 __m128i test_mm_haddq_epu16(__m128i a) {
    119   // CHECK: @llvm.x86.xop.vphadduwq
    120   return _mm_haddq_epu16(a);
    121 }
    122 
    123 __m128i test_mm_haddq_epu32(__m128i a) {
    124   // CHECK: @llvm.x86.xop.vphaddudq
    125   return _mm_haddq_epu32(a);
    126 }
    127 
    128 __m128i test_mm_hsubw_epi8(__m128i a) {
    129   // CHECK: @llvm.x86.xop.vphsubbw
    130   return _mm_hsubw_epi8(a);
    131 }
    132 
    133 __m128i test_mm_hsubd_epi16(__m128i a) {
    134   // CHECK: @llvm.x86.xop.vphsubwd
    135   return _mm_hsubd_epi16(a);
    136 }
    137 
    138 __m128i test_mm_hsubq_epi32(__m128i a) {
    139   // CHECK: @llvm.x86.xop.vphsubdq
    140   return _mm_hsubq_epi32(a);
    141 }
    142 
    143 __m128i test_mm_cmov_si128(__m128i a, __m128i b, __m128i c) {
    144   // CHECK: @llvm.x86.xop.vpcmov
    145   return _mm_cmov_si128(a, b, c);
    146 }
    147 
    148 __m256i test_mm256_cmov_si256(__m256i a, __m256i b, __m256i c) {
    149   // CHECK: @llvm.x86.xop.vpcmov.256
    150   return _mm256_cmov_si256(a, b, c);
    151 }
    152 
    153 __m128i test_mm_perm_epi8(__m128i a, __m128i b, __m128i c) {
    154   // CHECK: @llvm.x86.xop.vpperm
    155   return _mm_perm_epi8(a, b, c);
    156 }
    157 
    158 __m128i test_mm_rot_epi8(__m128i a, __m128i b) {
    159   // CHECK: @llvm.x86.xop.vprotb
    160   return _mm_rot_epi8(a, b);
    161 }
    162 
    163 __m128i test_mm_rot_epi16(__m128i a, __m128i b) {
    164   // CHECK: @llvm.x86.xop.vprotw
    165   return _mm_rot_epi16(a, b);
    166 }
    167 
    168 __m128i test_mm_rot_epi32(__m128i a, __m128i b) {
    169   // CHECK: @llvm.x86.xop.vprotd
    170   return _mm_rot_epi32(a, b);
    171 }
    172 
    173 __m128i test_mm_rot_epi64(__m128i a, __m128i b) {
    174   // CHECK: @llvm.x86.xop.vprotq
    175   return _mm_rot_epi64(a, b);
    176 }
    177 
    178 __m128i test_mm_roti_epi8(__m128i a) {
    179   // CHECK: @llvm.x86.xop.vprotbi
    180   return _mm_roti_epi8(a, 1);
    181 }
    182 
    183 __m128i test_mm_roti_epi16(__m128i a) {
    184   // CHECK: @llvm.x86.xop.vprotwi
    185   return _mm_roti_epi16(a, 50);
    186 }
    187 
    188 __m128i test_mm_roti_epi32(__m128i a) {
    189   // CHECK: @llvm.x86.xop.vprotdi
    190   return _mm_roti_epi32(a, -30);
    191 }
    192 
    193 __m128i test_mm_roti_epi64(__m128i a) {
    194   // CHECK: @llvm.x86.xop.vprotqi
    195   return _mm_roti_epi64(a, 100);
    196 }
    197 
    198 __m128i test_mm_shl_epi8(__m128i a, __m128i b) {
    199   // CHECK: @llvm.x86.xop.vpshlb
    200   return _mm_shl_epi8(a, b);
    201 }
    202 
    203 __m128i test_mm_shl_epi16(__m128i a, __m128i b) {
    204   // CHECK: @llvm.x86.xop.vpshlw
    205   return _mm_shl_epi16(a, b);
    206 }
    207 
    208 __m128i test_mm_shl_epi32(__m128i a, __m128i b) {
    209   // CHECK: @llvm.x86.xop.vpshld
    210   return _mm_shl_epi32(a, b);
    211 }
    212 
    213 __m128i test_mm_shl_epi64(__m128i a, __m128i b) {
    214   // CHECK: @llvm.x86.xop.vpshlq
    215   return _mm_shl_epi64(a, b);
    216 }
    217 
    218 __m128i test_mm_sha_epi8(__m128i a, __m128i b) {
    219   // CHECK: @llvm.x86.xop.vpshab
    220   return _mm_sha_epi8(a, b);
    221 }
    222 
    223 __m128i test_mm_sha_epi16(__m128i a, __m128i b) {
    224   // CHECK: @llvm.x86.xop.vpshaw
    225   return _mm_sha_epi16(a, b);
    226 }
    227 
    228 __m128i test_mm_sha_epi32(__m128i a, __m128i b) {
    229   // CHECK: @llvm.x86.xop.vpshad
    230   return _mm_sha_epi32(a, b);
    231 }
    232 
    233 __m128i test_mm_sha_epi64(__m128i a, __m128i b) {
    234   // CHECK: @llvm.x86.xop.vpshaq
    235   return _mm_sha_epi64(a, b);
    236 }
    237 
    238 __m128i test_mm_com_epu8(__m128i a, __m128i b) {
    239   // CHECK: @llvm.x86.xop.vpcomub
    240   return _mm_com_epu8(a, b, 0);
    241 }
    242 
    243 __m128i test_mm_com_epu16(__m128i a, __m128i b) {
    244   // CHECK: @llvm.x86.xop.vpcomuw
    245   return _mm_com_epu16(a, b, 0);
    246 }
    247 
    248 __m128i test_mm_com_epu32(__m128i a, __m128i b) {
    249   // CHECK: @llvm.x86.xop.vpcomud
    250   return _mm_com_epu32(a, b, 0);
    251 }
    252 
    253 __m128i test_mm_com_epu64(__m128i a, __m128i b) {
    254   // CHECK: @llvm.x86.xop.vpcomuq
    255   return _mm_com_epu64(a, b, 0);
    256 }
    257 
    258 __m128i test_mm_com_epi8(__m128i a, __m128i b) {
    259   // CHECK: @llvm.x86.xop.vpcomb
    260   return _mm_com_epi8(a, b, 0);
    261 }
    262 
    263 __m128i test_mm_com_epi16(__m128i a, __m128i b) {
    264   // CHECK: @llvm.x86.xop.vpcomw
    265   return _mm_com_epi16(a, b, 0);
    266 }
    267 
    268 __m128i test_mm_com_epi32(__m128i a, __m128i b) {
    269   // CHECK: @llvm.x86.xop.vpcomd
    270   return _mm_com_epi32(a, b, 0);
    271 }
    272 
    273 __m128i test_mm_com_epi64(__m128i a, __m128i b) {
    274   // CHECK: @llvm.x86.xop.vpcomq
    275   return _mm_com_epi64(a, b, 0);
    276 }
    277 
    278 __m128d test_mm_permute2_pd(__m128d a, __m128d b, __m128i c) {
    279   // CHECK: @llvm.x86.xop.vpermil2pd
    280   return _mm_permute2_pd(a, b, c, 0);
    281 }
    282 
    283 __m256d test_mm256_permute2_pd(__m256d a, __m256d b, __m256i c) {
    284   // CHECK: @llvm.x86.xop.vpermil2pd.256
    285   return _mm256_permute2_pd(a, b, c, 0);
    286 }
    287 
    288 __m128 test_mm_permute2_ps(__m128 a, __m128 b, __m128i c) {
    289   // CHECK: @llvm.x86.xop.vpermil2ps
    290   return _mm_permute2_ps(a, b, c, 0);
    291 }
    292 
    293 __m256 test_mm256_permute2_ps(__m256 a, __m256 b, __m256i c) {
    294   // CHECK: @llvm.x86.xop.vpermil2ps.256
    295   return _mm256_permute2_ps(a, b, c, 0);
    296 }
    297 
    298 __m128 test_mm_frcz_ss(__m128 a) {
    299   // CHECK: @llvm.x86.xop.vfrcz.ss
    300   return _mm_frcz_ss(a);
    301 }
    302 
    303 __m128d test_mm_frcz_sd(__m128d a) {
    304   // CHECK: @llvm.x86.xop.vfrcz.sd
    305   return _mm_frcz_sd(a);
    306 }
    307 
    308 __m128 test_mm_frcz_ps(__m128 a) {
    309   // CHECK: @llvm.x86.xop.vfrcz.ps
    310   return _mm_frcz_ps(a);
    311 }
    312 
    313 __m128d test_mm_frcz_pd(__m128d a) {
    314   // CHECK: @llvm.x86.xop.vfrcz.pd
    315   return _mm_frcz_pd(a);
    316 }
    317 
    318 __m256 test_mm256_frcz_ps(__m256 a) {
    319   // CHECK: @llvm.x86.xop.vfrcz.ps.256
    320   return _mm256_frcz_ps(a);
    321 }
    322 
    323 __m256d test_mm256_frcz_pd(__m256d a) {
    324   // CHECK: @llvm.x86.xop.vfrcz.pd.256
    325   return _mm256_frcz_pd(a);
    326 }
    327