// Copyright (c) 2025 Huawei Technologies Co., Ltd.
// This program is free software, you can redistribute it and/or modify it under the terms and conditions of
// CANN Open Software License Agreement Version 2.0 (the "License").
// Please refer to the License for details. You may not use this file except in compliance with the License.
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
// See LICENSE in the root of the software repository for the full text of the License.

// RUN: ascir-translate -mlir-to-ascendc %s | FileCheck %s

// CHECK-LABEL:void emit_vector_ternary_scalar_l0_ops(AscendC::LocalTensor<float> v1, AscendC::LocalTensor<float> v2, int32_t v3, int32_t v4, int32_t v5, AscendC::UnaryRepeatParams v6) {
// CHECK-NEXT:   AscendC::Axpy<float, float, 0>(v1, v2, v3, v4, v5, v6);
// CHECK-NEXT:   return;
// CHECK-NEXT: }
func.func @emit_vector_ternary_scalar_l0_ops(%dst: !ascendc.local_tensor<1024xf32>, %src: !ascendc.local_tensor<1024xf32>, %scalar : i32, %c1_i32 : i32, %c2_i32 : i32, %params: !ascendc.unary_repeat_params) {
  ascendc.axpy_l0 %dst, %src, %scalar, %c1_i32, %c2_i32, %params : !ascendc.local_tensor<1024xf32>, !ascendc.local_tensor<1024xf32>, i32, i32, i32, !ascendc.unary_repeat_params
  return
}

// CHECK-LABEL:void emit_vector_ternary_scalar_l2_ops(AscendC::LocalTensor<float> v1, AscendC::LocalTensor<float> v2, int32_t v3, int32_t v4) {
// CHECK-NEXT:   AscendC::Axpy(v1, v2, v3, v4);
// CHECK-NEXT:   return;
// CHECK-NEXT: }
func.func @emit_vector_ternary_scalar_l2_ops(%dst: !ascendc.local_tensor<1024xf32>, %src: !ascendc.local_tensor<1024xf32>, %scalar : i32, %c1_i32 : i32) {
  ascendc.axpy_l2 %dst, %src, %scalar, %c1_i32 : !ascendc.local_tensor<1024xf32>, !ascendc.local_tensor<1024xf32>, i32, i32
  return
}