// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py
// RUN: %clang_cc1 -triple riscv32 -target-feature +xandesbfhcvt -emit-llvm %s -o - \
// RUN:   -disable-O0-optnone | opt -S -passes=mem2reg | FileCheck %s
// RUN: %clang_cc1 -triple riscv64 -target-feature +xandesbfhcvt -emit-llvm %s -o - \
// RUN:   -disable-O0-optnone | opt -S -passes=mem2reg | FileCheck %s

#include <riscv_nds.h>

// CHECK-LABEL: @test_fcvt_s_bf16(
// CHECK-NEXT:  entry:
// CHECK-NEXT:    [[TMP0:%.*]] = fpext bfloat [[BF:%.*]] to float
// CHECK-NEXT:    ret float [[TMP0]]
//
float test_fcvt_s_bf16(__bf16 bf) {
  return __riscv_nds_fcvt_s_bf16(bf);
}

// CHECK-LABEL: @test_fcvt_bf16_s(
// CHECK-NEXT:  entry:
// CHECK-NEXT:    [[TMP0:%.*]] = fptrunc float [[SF:%.*]] to bfloat
// CHECK-NEXT:    ret bfloat [[TMP0]]
//
__bf16 test_fcvt_bf16_s(float sf) {
  return __riscv_nds_fcvt_bf16_s(sf);
}
