aboutsummaryrefslogtreecommitdiff
path: root/clang/test/CodeGen/RISCV/riscv-xandesbfhcvt.c
blob: 2f5e754d3870464a3c0e805cc95cc1295f56262e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// 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

// 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 __builtin_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 __builtin_riscv_nds_fcvt_bf16_s(sf);
}