[clang] [clang] fix half && bfloat16 convert node expr codegen (PR #89051)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 17 06:54:45 PDT 2024
================
@@ -0,0 +1,14 @@
+// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 4
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature +fullbf16 -S -emit-llvm %s -o - | FileCheck %s
+// CHECK-LABEL: define dso_local half @test_convert(
+// CHECK-SAME: bfloat noundef [[A:%.*]]) #[[ATTR0:[0-9]+]] {
+// CHECK-NEXT: entry:
+// CHECK-NEXT: [[A_ADDR:%.*]] = alloca bfloat, align 2
+// CHECK-NEXT: store bfloat [[A]], ptr [[A_ADDR]], align 2
+// CHECK-NEXT: [[TMP0:%.*]] = load bfloat, ptr [[A_ADDR]], align 2
+// CHECK-NEXT: [[CONV:%.*]] = bitcast bfloat [[TMP0]] to half
+// CHECK-NEXT: ret half [[CONV]]
+//
+_Float16 test_convert(__bf16 a) {
+ return (_Float16)a;
+}
----------------
arsenm wrote:
Can you also test some vector cases?
https://github.com/llvm/llvm-project/pull/89051
More information about the cfe-commits
mailing list