1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -disable-O0-optnone -emit-llvm \
2 // RUN: %s -o - | opt -S -passes=mem2reg | FileCheck %s
4 // CHECK-LABEL: define dso_local half @test_convert_from_bf16_to_fp16(
5 // CHECK-SAME: bfloat noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
7 // CHECK-NEXT: [[FPEXT:%.*]] = fpext bfloat [[A]] to float
8 // CHECK-NEXT: [[FPTRUNC:%.*]] = fptrunc float [[FPEXT]] to half
9 // CHECK-NEXT: ret half [[FPTRUNC]]
11 _Float16
test_convert_from_bf16_to_fp16(__bf16 a
) {
15 // CHECK-LABEL: define dso_local bfloat @test_convert_from_fp16_to_bf16(
16 // CHECK-SAME: half noundef [[A:%.*]]) #[[ATTR0]] {
18 // CHECK-NEXT: [[FPEXT:%.*]] = fpext half [[A]] to float
19 // CHECK-NEXT: [[FPTRUNC:%.*]] = fptrunc float [[FPEXT]] to bfloat
20 // CHECK-NEXT: ret bfloat [[FPTRUNC]]
22 __bf16
test_convert_from_fp16_to_bf16(_Float16 a
) {