Files
clang-p2996/llvm/test/CodeGen/AMDGPU/bf16-ops.ll
Pierre van Houtryve 678d8946ba [AMDGPU] Add bf16 storage support
- [Clang] Declare AMDGPU target as supporting BF16 for storage-only purposes on amdgcn
  - Add Sema & CodeGen tests cases.
  - Also add cases that D138651 would have covered as this patch replaces it.
- [AMDGPU] Add BF16 storage-only support
  - Support legalization/dealing with bf16 operations in DAGIsel.
  - bf16 as a type remains illegal and is represented as i16 for storage purposes.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D139398
2022-12-13 10:34:26 -05:00

33 lines
1011 B
LLVM

; RUN: not llc < %s -march=amdgcn -mcpu=hawaii
; RUN: not llc < %s -march=amdgcn -mcpu=tonga
; RUN: not llc < %s -march=amdgcn -mcpu=gfx900
; RUN: not llc < %s -march=amdgcn -mcpu=gfx1010
; TODO: Add GlobalISel tests, currently it silently miscompiles as GISel does not handle BF16 at all.
; We only have storage-only BF16 support so check codegen fails if we attempt to do operations on bfloats.
define void @test_fneg(bfloat %a, ptr addrspace(1) %out) {
%result = fneg bfloat %a
store bfloat %result, ptr addrspace(1) %out
ret void
}
define void @test_fabs(bfloat %a, ptr addrspace(1) %out) {
%result = fabs bfloat %a
store bfloat %result, ptr addrspace(1) %out
ret void
}
define void @test_add(bfloat %a, bfloat %b, ptr addrspace(1) %out) {
%result = fadd bfloat %a, %b
store bfloat %result, ptr addrspace(1) %out
ret void
}
define void @test_mul(bfloat %a, bfloat %b, ptr addrspace(1) %out) {
%result = fmul bfloat %a, %b
store bfloat %result, ptr addrspace(1) %out
ret void
}