reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
  162
  163
  164
  165
  166
  167
  168
  169
  170
  171
  172
  173
  174
  175
  176
  177
  178
  179
  180
  181
  182
  183
  184
  185
  186
  187
  188
  189
  190
  191
  192
  193
  194
  195
  196
  197
  198
  199
  200
  201
  202
  203
  204
  205
  206
  207
  208
  209
  210
  211
  212
  213
  214
  215
  216
  217
  218
  219
  220
  221
  222
  223
  224
  225
  226
  227
  228
  229
  230
  231
  232
  233
  234
  235
  236
  237
  238
  239
  240
  241
  242
  243
  244
  245
  246
  247
  248
  249
  250
  251
  252
  253
  254
  255
  256
  257
  258
  259
  260
  261
  262
  263
  264
  265
  266
  267
  268
  269
  270
  271
  272
  273
  274
  275
  276
  277
  278
  279
  280
  281
  282
  283
  284
  285
  286
  287
  288
  289
  290
  291
  292
  293
  294
  295
  296
  297
  298
  299
  300
  301
  302
  303
  304
  305
  306
  307
  308
  309
  310
  311
  312
  313
  314
  315
  316
  317
  318
  319
  320
  321
  322
  323
  324
  325
  326
  327
  328
  329
  330
  331
  332
  333
  334
  335
  336
  337
  338
  339
  340
  341
  342
  343
  344
  345
  346
  347
  348
  349
  350
  351
  352
  353
  354
  355
  356
  357
  358
  359
  360
  361
  362
  363
  364
  365
  366
  367
  368
  369
  370
  371
  372
  373
  374
  375
  376
  377
  378
  379
  380
  381
  382
  383
  384
  385
  386
  387
  388
  389
  390
  391
  392
  393
  394
  395
  396
  397
  398
  399
  400
  401
  402
  403
  404
  405
  406
  407
  408
  409
  410
  411
  412
  413
  414
  415
  416
  417
  418
  419
  420
// REQUIRES: powerpc-registered-target
// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64le-unknown-unknown \
// RUN: -target-feature +crypto -target-feature +power8-vector \
// RUN: -emit-llvm %s -o - | FileCheck %s

// RUN: %clang_cc1 -target-feature +altivec -triple powerpc64-unknown-unknown \
// RUN: -target-feature +crypto -target-feature +power8-vector \
// RUN: -emit-llvm %s -o - | FileCheck %s
#include <altivec.h>
#define B_INIT1 { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, \
                  0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10 };
#define B_INIT2 { 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, \
                  0x79, 0x7A, 0x7B, 0x7C, 0x7D, 0x7E, 0x7F, 0x70 };
#define H_INIT1 { 0x0102, 0x0304, 0x0506, 0x0708, \
                  0x090A, 0x0B0C, 0x0D0E, 0x0F10 };
#define H_INIT2 { 0x7172, 0x7374, 0x7576, 0x7778, \
                  0x797A, 0x7B7C, 0x7D7E, 0x7F70 };
#define W_INIT1 { 0x01020304, 0x05060708, \
                  0x090A0B0C, 0x0D0E0F10 };
#define W_INIT2 { 0x71727374, 0x75767778, \
                  0x797A7B7C, 0x7D7E7F70 };
#define D_INIT1 { 0x0102030405060708, \
                  0x090A0B0C0D0E0F10 };
#define D_INIT2 { 0x7172737475767778, \
                  0x797A7B7C7D7E7F70 };

// CHECK-LABEL: define <16 x i8> @test_vpmsumb
vector unsigned char test_vpmsumb(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return __builtin_altivec_crypto_vpmsumb(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumb
}

// CHECK-LABEL: define <8 x i16> @test_vpmsumh
vector unsigned short test_vpmsumh(void)
{
  vector unsigned short a = H_INIT1
  vector unsigned short b = H_INIT2
  return __builtin_altivec_crypto_vpmsumh(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumh
}

// CHECK-LABEL: define <4 x i32> @test_vpmsumw
vector unsigned int test_vpmsumw(void)
{
  vector unsigned int a = W_INIT1
  vector unsigned int b = W_INIT2
  return __builtin_altivec_crypto_vpmsumw(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumw
}

// CHECK-LABEL: define <2 x i64> @test_vpmsumd
vector unsigned long long test_vpmsumd(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_altivec_crypto_vpmsumd(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumd
}

// CHECK-LABEL: define <2 x i64> @test_vsbox
vector unsigned long long test_vsbox(void)
{
  vector unsigned long long a = D_INIT1
  return __builtin_altivec_crypto_vsbox(a);
// CHECK: @llvm.ppc.altivec.crypto.vsbox
}

// CHECK-LABEL: define <16 x i8> @test_vpermxorb
vector unsigned char test_vpermxorb(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  vector unsigned char c = B_INIT2
  return __builtin_altivec_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <8 x i16> @test_vpermxorh
vector unsigned short test_vpermxorh(void)
{
  vector unsigned short a = H_INIT1
  vector unsigned short b = H_INIT2
  vector unsigned short c = H_INIT2
  return __builtin_altivec_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <4 x i32> @test_vpermxorw
vector unsigned int test_vpermxorw(void)
{
  vector unsigned int a = W_INIT1
  vector unsigned int b = W_INIT2
  vector unsigned int c = W_INIT2
  return __builtin_altivec_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <2 x i64> @test_vpermxord
vector unsigned long long test_vpermxord(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  vector unsigned long long c = D_INIT2
  return __builtin_altivec_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: test_vpermxorbc
vector bool char test_vpermxorbc(vector bool char a,
                                vector bool char b,
                                vector bool char c) {
  return vec_permxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: test_vpermxorsc
vector signed char test_vpermxorsc(vector signed char a,
                                   vector signed char b,
                                   vector signed char c) {
  return vec_permxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: test_vpermxoruc
vector unsigned char test_vpermxoruc(vector unsigned char a,
                                     vector unsigned char b,
                                     vector unsigned char c) {
  return vec_permxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <2 x i64> @test_vcipher
vector unsigned long long test_vcipher(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_altivec_crypto_vcipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipher
}

// CHECK-LABEL: define <2 x i64> @test_vcipherlast
vector unsigned long long test_vcipherlast(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_altivec_crypto_vcipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
}

// CHECK-LABEL: @test_vncipher
vector unsigned long long test_vncipher(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_altivec_crypto_vncipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipher
}

// CHECK-LABEL: define <2 x i64> @test_vncipherlast
vector unsigned long long test_vncipherlast(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_altivec_crypto_vncipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
}

// CHECK-LABEL: define <4 x i32> @test_vshasigmaw
vector unsigned int test_vshasigmaw(void)
{
  vector unsigned int a = W_INIT1
  return __builtin_altivec_crypto_vshasigmaw(a, 1, 15);
// CHECK: @llvm.ppc.altivec.crypto.vshasigmaw
}

// CHECK-LABEL: define <2 x i64> @test_vshasigmad
vector unsigned long long test_vshasigmad(void)
{
  vector unsigned long long a = D_INIT2
  return __builtin_altivec_crypto_vshasigmad(a, 1, 15);
// CHECK: @llvm.ppc.altivec.crypto.vshasigmad
}

// Test cases for the builtins the way they are exposed to
// users through altivec.h
// CHECK-LABEL: define <16 x i8> @test_vpmsumb_e
vector unsigned char test_vpmsumb_e(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return __builtin_crypto_vpmsumb(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumb
}

// CHECK-LABEL: define <8 x i16> @test_vpmsumh_e
vector unsigned short test_vpmsumh_e(void)
{
  vector unsigned short a = H_INIT1
  vector unsigned short b = H_INIT2
  return __builtin_crypto_vpmsumb(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumh
}

// CHECK-LABEL: define <4 x i32> @test_vpmsumw_e
vector unsigned int test_vpmsumw_e(void)
{
  vector unsigned int a = W_INIT1
  vector unsigned int b = W_INIT2
  return __builtin_crypto_vpmsumb(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumw
}

// CHECK-LABEL: define <2 x i64> @test_vpmsumd_e
vector unsigned long long test_vpmsumd_e(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_crypto_vpmsumb(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumd
}

// CHECK-LABEL: define <2 x i64> @test_vsbox_e
vector unsigned long long test_vsbox_e(void)
{
  vector unsigned long long a = D_INIT1
  return __builtin_crypto_vsbox(a);
// CHECK: @llvm.ppc.altivec.crypto.vsbox
}

// CHECK-LABEL: define <16 x i8> @test_vpermxorb_e
vector unsigned char test_vpermxorb_e(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  vector unsigned char c = B_INIT2
  return __builtin_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <8 x i16> @test_vpermxorh_e
vector unsigned short test_vpermxorh_e(void)
{
  vector unsigned short a = H_INIT1
  vector unsigned short b = H_INIT2
  vector unsigned short c = H_INIT2
  return __builtin_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <4 x i32> @test_vpermxorw_e
vector unsigned int test_vpermxorw_e(void)
{
  vector unsigned int a = W_INIT1
  vector unsigned int b = W_INIT2
  vector unsigned int c = W_INIT2
  return __builtin_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <2 x i64> @test_vpermxord_e
vector unsigned long long test_vpermxord_e(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  vector unsigned long long c = D_INIT2
  return __builtin_crypto_vpermxor(a, b, c);
// CHECK: @llvm.ppc.altivec.crypto.vpermxor
}

// CHECK-LABEL: define <2 x i64> @test_vcipher_e
vector unsigned long long test_vcipher_e(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_crypto_vcipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipher
}

// CHECK-LABEL: define <2 x i64> @test_vcipherlast_e
vector unsigned long long test_vcipherlast_e(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_crypto_vcipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
}

// CHECK-LABEL: define <2 x i64> @test_vncipher_e
vector unsigned long long test_vncipher_e(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_crypto_vncipher(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipher
}

// CHECK-LABEL: define <2 x i64> @test_vncipherlast_e
vector unsigned long long test_vncipherlast_e(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return __builtin_crypto_vncipherlast(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
}

// CHECK-LABEL: define <4 x i32> @test_vshasigmaw_e
vector unsigned int test_vshasigmaw_e(void)
{
  vector unsigned int a = W_INIT1
  return __builtin_crypto_vshasigmaw(a, 1, 15);
// CHECK: @llvm.ppc.altivec.crypto.vshasigmaw
}

// CHECK-LABEL: define <2 x i64> @test_vshasigmad_e
vector unsigned long long test_vshasigmad_e(void)
{
  vector unsigned long long a = D_INIT2
  return __builtin_crypto_vshasigmad(a, 0, 15);
// CHECK: @llvm.ppc.altivec.crypto.vshasigmad
}

// CHECK-LABEL: @test_vec_sbox_be
vector unsigned char test_vec_sbox_be(void)
{
  vector unsigned char a = B_INIT1
  return vec_sbox_be(a);
// CHECK: @llvm.ppc.altivec.crypto.vsbox
}

// CHECK-LABEL: @test_vec_cipher_be
vector unsigned char test_vec_cipher_be(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return vec_cipher_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipher
}

// CHECK-LABEL: @test_vec_cipherlast_be
vector unsigned char test_vec_cipherlast_be(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return vec_cipherlast_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vcipherlast
}

// CHECK-LABEL: @test_vec_ncipher_be
vector unsigned char test_vec_ncipher_be(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return vec_ncipher_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipher
}

// CHECK-LABEL: @test_vec_ncipherlast_be
vector unsigned char test_vec_ncipherlast_be(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return vec_ncipherlast_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vncipherlast
}

// CHECK-LABEL: @test_vec_shasigma_bew
vector unsigned int test_vec_shasigma_bew(void)
{
  vector unsigned int a = W_INIT1
  return vec_shasigma_be(a, 1, 15);
// CHECK: @llvm.ppc.altivec.crypto.vshasigmaw
}

// CHECK-LABEL: @test_vec_shasigma_bed
vector unsigned long long test_vec_shasigma_bed(void)
{
  vector unsigned long long a = D_INIT2
  return vec_shasigma_be(a, 1, 15);
// CHECK: @llvm.ppc.altivec.crypto.vshasigmad
}

// CHECK-LABEL: @test_vec_pmsum_beb
vector unsigned short test_vec_pmsum_beb(void)
{
  vector unsigned char a = B_INIT1
  vector unsigned char b = B_INIT2
  return vec_pmsum_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumb
}

// CHECK-LABEL: @test_vec_pmsum_beh
vector unsigned int test_vec_pmsum_beh(void)
{
  vector unsigned short a = H_INIT1
  vector unsigned short b = H_INIT2
  return vec_pmsum_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumh
}

// CHECK-LABEL: @test_vec_pmsum_bew
vector unsigned long long test_vec_pmsum_bew(void)
{
  vector unsigned int a = W_INIT1
  vector unsigned int b = W_INIT2
  return vec_pmsum_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumw
}

// CHECK-LABEL: @test_vec_pmsum_bed
vector unsigned __int128 test_vec_pmsum_bed(void)
{
  vector unsigned long long a = D_INIT1
  vector unsigned long long b = D_INIT2
  return vec_pmsum_be(a, b);
// CHECK: @llvm.ppc.altivec.crypto.vpmsumd
}