Compiler projects using llvm
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -no-opaque-pointers -triple riscv64 -target-feature +zknd -emit-llvm %s -o - \
// RUN:     | FileCheck %s  -check-prefix=RV64ZKND-ZKNE
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -no-opaque-pointers -triple riscv64 -target-feature +zkne -emit-llvm %s -o - \
// RUN:     | FileCheck %s  -check-prefix=RV64ZKND-ZKNE

// RV64ZKND-ZKNE-LABEL: @aes64ks1i(
// RV64ZKND-ZKNE-NEXT:  entry:
// RV64ZKND-ZKNE-NEXT:    [[RS1_ADDR:%.*]] = alloca i32, align 4
// RV64ZKND-ZKNE-NEXT:    store i32 [[RS1:%.*]], i32* [[RS1_ADDR]], align 4
// RV64ZKND-ZKNE-NEXT:    [[TMP0:%.*]] = load i32, i32* [[RS1_ADDR]], align 4
// RV64ZKND-ZKNE-NEXT:    [[CONV:%.*]] = sext i32 [[TMP0]] to i64
// RV64ZKND-ZKNE-NEXT:    [[TMP1:%.*]] = call i64 @llvm.riscv.aes64ks1i(i64 [[CONV]], i32 0)
// RV64ZKND-ZKNE-NEXT:    [[CONV1:%.*]] = trunc i64 [[TMP1]] to i32
// RV64ZKND-ZKNE-NEXT:    ret i32 [[CONV1]]
//
int aes64ks1i(int rs1) {
  return __builtin_riscv_aes64ks1i_64(rs1, 0);
}

// RV64ZKND-ZKNE-LABEL: @aes64ks2(
// RV64ZKND-ZKNE-NEXT:  entry:
// RV64ZKND-ZKNE-NEXT:    [[RS1_ADDR:%.*]] = alloca i32, align 4
// RV64ZKND-ZKNE-NEXT:    [[RS2_ADDR:%.*]] = alloca i32, align 4
// RV64ZKND-ZKNE-NEXT:    store i32 [[RS1:%.*]], i32* [[RS1_ADDR]], align 4
// RV64ZKND-ZKNE-NEXT:    store i32 [[RS2:%.*]], i32* [[RS2_ADDR]], align 4
// RV64ZKND-ZKNE-NEXT:    [[TMP0:%.*]] = load i32, i32* [[RS1_ADDR]], align 4
// RV64ZKND-ZKNE-NEXT:    [[CONV:%.*]] = sext i32 [[TMP0]] to i64
// RV64ZKND-ZKNE-NEXT:    [[TMP1:%.*]] = load i32, i32* [[RS2_ADDR]], align 4
// RV64ZKND-ZKNE-NEXT:    [[CONV1:%.*]] = sext i32 [[TMP1]] to i64
// RV64ZKND-ZKNE-NEXT:    [[TMP2:%.*]] = call i64 @llvm.riscv.aes64ks2(i64 [[CONV]], i64 [[CONV1]])
// RV64ZKND-ZKNE-NEXT:    [[CONV2:%.*]] = trunc i64 [[TMP2]] to i32
// RV64ZKND-ZKNE-NEXT:    ret i32 [[CONV2]]
//
int aes64ks2(int rs1, int rs2) {
  return __builtin_riscv_aes64ks2_64(rs1, rs2);
}