1 ; RUN: opt -S -instcombine < %s | FileCheck %s
2 ; ARM64 AES intrinsic variants
4 define <16 x i8> @combineXorAeseZeroARM64(<16 x i8> %data, <16 x i8> %key) {
5 ; CHECK-LABEL: @combineXorAeseZeroARM64(
6 ; CHECK-NEXT: %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8> %data, <16 x i8> %key)
7 ; CHECK-NEXT: ret <16 x i8> %data.aes
8 %data.xor = xor <16 x i8> %data, %key
9 %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8> %data.xor, <16 x i8> zeroinitializer)
10 ret <16 x i8> %data.aes
13 define <16 x i8> @combineXorAeseNonZeroARM64(<16 x i8> %data, <16 x i8> %key) {
14 ; CHECK-LABEL: @combineXorAeseNonZeroARM64(
15 ; CHECK-NEXT: %data.xor = xor <16 x i8> %data, %key
16 ; CHECK-NEXT: %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8> %data.xor, <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>)
17 ; CHECK-NEXT: ret <16 x i8> %data.aes
18 %data.xor = xor <16 x i8> %data, %key
19 %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8> %data.xor, <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>)
20 ret <16 x i8> %data.aes
23 define <16 x i8> @combineXorAesdZeroARM64(<16 x i8> %data, <16 x i8> %key) {
24 ; CHECK-LABEL: @combineXorAesdZeroARM64(
25 ; CHECK-NEXT: %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aesd(<16 x i8> %data, <16 x i8> %key)
26 ; CHECK-NEXT: ret <16 x i8> %data.aes
27 %data.xor = xor <16 x i8> %data, %key
28 %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aesd(<16 x i8> %data.xor, <16 x i8> zeroinitializer)
29 ret <16 x i8> %data.aes
32 define <16 x i8> @combineXorAesdNonZeroARM64(<16 x i8> %data, <16 x i8> %key) {
33 ; CHECK-LABEL: @combineXorAesdNonZeroARM64(
34 ; CHECK-NEXT: %data.xor = xor <16 x i8> %data, %key
35 ; CHECK-NEXT: %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aesd(<16 x i8> %data.xor, <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>)
36 ; CHECK-NEXT: ret <16 x i8> %data.aes
37 %data.xor = xor <16 x i8> %data, %key
38 %data.aes = tail call <16 x i8> @llvm.aarch64.crypto.aesd(<16 x i8> %data.xor, <16 x i8> <i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1>)
39 ret <16 x i8> %data.aes
42 declare <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8>, <16 x i8>) #0
43 declare <16 x i8> @llvm.aarch64.crypto.aesd(<16 x i8>, <16 x i8>) #0