Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIR][CIRGen][Builtin][Neon] Lower neon_vaeseq_u8 #1112

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2472,6 +2472,10 @@ mlir::Value CIRGenFunction::emitCommonNeonBuiltinExpr(
argTypes.push_back(vTy);
break;
}
case NEON::BI__builtin_neon_vaeseq_u8: {
intrincsName = "aarch64.crypto.aese";
break;
}
case NEON::BI__builtin_neon_vpadd_v:
case NEON::BI__builtin_neon_vpaddq_v: {
intrincsName = mlir::isa<mlir::FloatType>(vTy.getEltType())
Expand Down
13 changes: 12 additions & 1 deletion clang/test/CIR/CodeGen/AArch64/neon-crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// RUN: FileCheck --check-prefix=CIR --input-file=%t.cir %s

// RUN: %clang_cc1 -triple arm64-none-linux-gnu -target-feature +neon \
// RUN: -target-feature +sha2 -target-feature +aes \
// RUN: -fclangir -target-feature +sha2 -target-feature +aes \
// RUN: -disable-O0-optnone -emit-llvm -o - %s \
// RUN: | opt -S -passes=mem2reg,simplifycfg -o %t.ll
// RUN: FileCheck --check-prefix=LLVM --input-file=%t.ll %s
Expand All @@ -23,3 +23,14 @@ uint8x16_t test_vaesmcq_u8(uint8x16_t data) {
// LLVM: [[RES:%.*]] = call <16 x i8> @llvm.aarch64.crypto.aesmc(<16 x i8> [[DATA]])
// LLVM: ret <16 x i8> [[RES]]
}

uint8x16_t test_vaeseq_u8(uint8x16_t data, uint8x16_t key) {
return vaeseq_u8(data, key);

// CIR-LABEL: vaeseq_u8
// {{%.*}} = cir.llvm.intrinsic "aarch64.crypto.aese" {{%.*}} : (!cir.vector<!u8i x 16>) -> !cir.vector<!u8i x 16>

// LLVM: {{.*}}vaeseq_u8(<16 x i8>{{.*}}[[DATA:%.*]], <16 x i8>{{.*}}[[KEY:%.*]])
// LLVM: [[RES:%.*]] = call <16 x i8> @llvm.aarch64.crypto.aese(<16 x i8> [[DATA]], <16 x i8> [[KEY]])
// LLVM: ret <16 x i8> [[RES]]
}