blob: 8567f23a5fed027f2d59424d8c327bfa49e45dbb [file] [log] [blame] [edit]
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 6
; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
define bfloat @bfloat_to_half() {
; CHECK-LABEL: define bfloat @bfloat_to_half() {
; CHECK-NEXT: ret bfloat 0xR7C00
;
%val = bitcast half 0xH7C00 to bfloat
ret bfloat %val
}
define <2 x bfloat> @bfloat_to_half_vec() {
; CHECK-LABEL: define <2 x bfloat> @bfloat_to_half_vec() {
; CHECK-NEXT: ret <2 x bfloat> splat (bfloat 0xR7C00)
;
%val = bitcast <2 x half> splat (half 0xH7C00) to <2 x bfloat>
ret <2 x bfloat> %val
}
define half @half_to_bfloat() {
; CHECK-LABEL: define half @half_to_bfloat() {
; CHECK-NEXT: ret half 0xH7C00
;
%val = bitcast bfloat 0xR7C00 to half
ret half %val
}
define <2 x half> @half_to_bfloat_vec() {
; CHECK-LABEL: define <2 x half> @half_to_bfloat_vec() {
; CHECK-NEXT: ret <2 x half> splat (half 0xH7C00)
;
%val = bitcast <2 x bfloat> splat (bfloat 0xR7C00) to <2 x half>
ret <2 x half> %val
}
define half @recursive() {
; CHECK-LABEL: define half @recursive() {
; CHECK-NEXT: ret half 0xH7C00
;
%first = bitcast bfloat 0xR7C00 to half
%second = bitcast half %first to bfloat
%third = bitcast bfloat %second to half
ret half %third
}