92 lines · c
1// REQUIRES: powerpc-registered-target2// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu \3// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s4// RUN: %clang_cc1 -triple powerpc64le-unknown-linux-gnu \5// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s6// RUN: %clang_cc1 -triple powerpc64-unknown-aix \7// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s8// RUN: %clang_cc1 -triple powerpc-unknown-linux-gnu \9// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s10// RUN: %clang_cc1 -triple powerpcle-unknown-linux-gnu \11// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s12// RUN: %clang_cc1 -triple powerpc-unknown-aix \13// RUN: -emit-llvm %s -o - -target-cpu pwr8 | FileCheck %s14 15// All of these cipher builtins are only for Power 8 and up.16 17// CHECK-LABEL: @testvcipher(18// CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vcipher19// CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>20// CHECK-NEXT: ret <16 x i8> [[TMP5]]21//22vector unsigned char testvcipher(vector unsigned char state_array, vector unsigned char round_key) {23 return __vcipher(state_array, round_key);24}25 26// CHECK-LABEL: @testvcipherlast(27// CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vcipherlast28// CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>29// CHECK-NEXT: ret <16 x i8> [[TMP5]]30//31vector unsigned char testvcipherlast(vector unsigned char state_array, vector unsigned char round_key) {32 return __vcipherlast(state_array, round_key);33}34 35// CHECK-LABEL: @testvncipher(36// CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vncipher37// CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>38// CHECK-NEXT: ret <16 x i8> [[TMP5]]39//40vector unsigned char testvncipher(vector unsigned char state_array, vector unsigned char round_key) {41 return __vncipher(state_array, round_key);42}43 44// CHECK-LABEL: @testvncipherlast(45// CHECK: [[TMP4:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vncipherlast46// CHECK-NEXT: [[TMP5:%.*]] = bitcast <2 x i64> [[TMP4]] to <16 x i8>47// CHECK-NEXT: ret <16 x i8> [[TMP5]]48//49vector unsigned char testvncipherlast(vector unsigned char state_array, vector unsigned char round_key) {50 return __vncipherlast(state_array, round_key);51}52 53// CHECK-LABEL: @testvpermxor(54// CHECK: [[TMP3:%.*]] = call <16 x i8> @llvm.ppc.altivec.crypto.vpermxor55// CHECK-NEXT: ret <16 x i8> [[TMP3]]56//57vector unsigned char testvpermxor(vector unsigned char a, vector unsigned char b, vector unsigned char mask) {58 return __vpermxor(a, b, mask);59}60 61// CHECK-LABEL: @testvpmsumb(62// CHECK: [[TMP2:%.*]] = call <16 x i8> @llvm.ppc.altivec.crypto.vpmsumb63// CHECK-NEXT: ret <16 x i8> [[TMP2]]64//65vector unsigned char testvpmsumb(vector unsigned char a, vector unsigned char b) {66 return __vpmsumb(a, b);67}68 69// CHECK-LABEL: @testvpmsumd(70// CHECK: [[TMP2:%.*]] = call <2 x i64> @llvm.ppc.altivec.crypto.vpmsumd71// CHECK-NEXT: ret <2 x i64> [[TMP2]]72//73vector unsigned long long testvpmsumd(vector unsigned long long a, vector unsigned long long b) {74 return __vpmsumd(a, b);75}76 77// CHECK-LABEL: @testvpmsumh(78// CHECK: [[TMP2:%.*]] = call <8 x i16> @llvm.ppc.altivec.crypto.vpmsumh79// CHECK-NEXT: ret <8 x i16> [[TMP2]]80//81vector unsigned short testvpmsumh(vector unsigned short a, vector unsigned short b) {82 return __vpmsumh(a, b);83}84 85// CHECK-LABEL: @testvpmsumw(86// CHECK: [[TMP2:%.*]] = call <4 x i32> @llvm.ppc.altivec.crypto.vpmsumw87// CHECK-NEXT: ret <4 x i32> [[TMP2]]88//89vector unsigned int testvpmsumw(vector unsigned int a, vector unsigned int b) {90 return __vpmsumw(a, b);91}92