1 // REQUIRES: powerpc-registered-target
2 // RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \
3 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
4 // RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \
5 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
6 // RUN: %clang_cc1 -triple powerpc64-unknown-aix \
7 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
8 // RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu \
9 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
10 // RUN: %clang_cc1 -triple powerpcle-unknown-linux-gnu \
11 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
12 // RUN: %clang_cc1 -triple powerpc-unknown-aix \
13 // RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s
15 // All of these cipher builtins are only for Power 8 and up.
17 // CHECK-LABEL: @testvcipher(
18 // CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vcipher
19 // CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>
20 // CHECK-NEXT: ret <16 x i8> [[TMP5]]
22 vector
unsigned char testvcipher(vector
unsigned char state_array
, vector
unsigned char round_key
) {
23 return __vcipher(state_array
, round_key
);
26 // CHECK-LABEL: @testvcipherlast(
27 // CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vcipherlast
28 // CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>
29 // CHECK-NEXT: ret <16 x i8> [[TMP5]]
31 vector
unsigned char testvcipherlast(vector
unsigned char state_array
, vector
unsigned char round_key
) {
32 return __vcipherlast(state_array
, round_key
);
35 // CHECK-LABEL: @testvncipher(
36 // CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vncipher
37 // CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>
38 // CHECK-NEXT: ret <16 x i8> [[TMP5]]
40 vector
unsigned char testvncipher(vector
unsigned char state_array
, vector
unsigned char round_key
) {
41 return __vncipher(state_array
, round_key
);
44 // CHECK-LABEL: @testvncipherlast(
45 // CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vncipherlast
46 // CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>
47 // CHECK-NEXT: ret <16 x i8> [[TMP5]]
49 vector
unsigned char testvncipherlast(vector
unsigned char state_array
, vector
unsigned char round_key
) {
50 return __vncipherlast(state_array
, round_key
);
53 // CHECK-LABEL: @testvpermxor(
54 // CHECK: [[TMP3:%.*]] = call <16 x i8> @llvm.ppc.altivec.crypto.vpermxor
55 // CHECK-NEXT: ret <16 x i8> [[TMP3]]
57 vector
unsigned char testvpermxor(vector
unsigned char a
, vector
unsigned char b
, vector
unsigned char mask
) {
58 return __vpermxor(a
, b
, mask
);
61 // CHECK-LABEL: @testvpmsumb(
62 // CHECK: [[TMP2:%.*]] = call <16 x i8> @llvm.ppc.altivec.crypto.vpmsumb
63 // CHECK-NEXT: ret <16 x i8> [[TMP2]]
65 vector
unsigned char testvpmsumb(vector
unsigned char a
, vector
unsigned char b
) {
66 return __vpmsumb(a
, b
);
69 // CHECK-LABEL: @testvpmsumd(
70 // CHECK: [[TMP2:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vpmsumd
71 // CHECK-NEXT: ret <2 x i64> [[TMP2]]
73 vector
unsigned long long testvpmsumd(vector
unsigned long long a
, vector
unsigned long long b
) {
74 return __vpmsumd(a
, b
);
77 // CHECK-LABEL: @testvpmsumh(
78 // CHECK: [[TMP2:%.*]] = call <8 x i16> @llvm.ppc.altivec.crypto.vpmsumh
79 // CHECK-NEXT: ret <8 x i16> [[TMP2]]
81 vector
unsigned short testvpmsumh(vector
unsigned short a
, vector
unsigned short b
) {
82 return __vpmsumh(a
, b
);
85 // CHECK-LABEL: @testvpmsumw(
86 // CHECK: [[TMP2:%.*]] = call <4 x i32> @llvm.ppc.altivec.crypto.vpmsumw
87 // CHECK-NEXT: ret <4 x i32> [[TMP2]]
89 vector
unsigned int testvpmsumw(vector
unsigned int a
, vector
unsigned int b
) {
90 return __vpmsumw(a
, b
);