1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00
llvm-mirror/test/Assembler/bfloat.ll
Ties Stuij 745a9668d4 [IR][BFloat] Add BFloat IR type
Summary:
The BFloat IR type is introduced to provide support for, initially, the BFloat16
datatype introduced with the Armv8.6 architecture (optional from Armv8.2
onwards). It has an 8-bit exponent and a 7-bit mantissa and behaves like an IEEE
754 floating point IR type.

This is part of a patch series upstreaming Armv8.6 features. Subsequent patches
will upstream intrinsics support and C-lang support for BFloat.

Reviewers: SjoerdMeijer, rjmccall, rsmith, liutianle, RKSimon, craig.topper, jfb, LukeGeeson, sdesmalen, deadalnix, ctetreau

Subscribers: hiraditya, llvm-commits, danielkiss, arphaman, kristof.beyls, dexonsmith

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78190
2020-05-15 14:43:43 +01:00

39 lines
959 B
LLVM

; RUN: llvm-as < %s | llvm-dis | FileCheck %s --check-prefix=ASSEM-DISASS
; RUN: opt < %s -O3 -S | FileCheck %s --check-prefix=OPT
; RUN: verify-uselistorder %s
; Basic smoke tests for bfloat type.
define bfloat @check_bfloat(bfloat %A) {
; ASSEM-DISASS: ret bfloat %A
ret bfloat %A
}
define bfloat @check_bfloat_literal() {
; ASSEM-DISASS: ret bfloat 0xR3149
ret bfloat 0xR3149
}
define <4 x bfloat> @check_fixed_vector() {
; ASSEM-DISASS: ret <4 x bfloat> %tmp
%tmp = fadd <4 x bfloat> undef, undef
ret <4 x bfloat> %tmp
}
define <vscale x 4 x bfloat> @check_vector() {
; ASSEM-DISASS: ret <vscale x 4 x bfloat> %tmp
%tmp = fadd <vscale x 4 x bfloat> undef, undef
ret <vscale x 4 x bfloat> %tmp
}
define bfloat @check_bfloat_constprop() {
%tmp = fadd bfloat 0xR40C0, 0xR40C0
; OPT: 0xR4140
ret bfloat %tmp
}
define float @check_bfloat_convert() {
%tmp = fpext bfloat 0xR4C8D to float
; OPT: 0x4191A00000000000
ret float %tmp
}