76 lines · plain
1; Simple cross-platform smoke checks for basic bf16 operations.2;3; There shouldn't be any architectures that crash when trying to use `bfloat`;4; check that here. Additionally do a small handful of smoke tests that work5; well cross-platform.6 7; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=aarch64-apple-darwin | FileCheck %s --check-prefixes=ALL,CHECK %}8; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=aarch64-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK %}9; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=aarch64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}10; FIXME: arm64ec crashes when passing/returning bfloat11; RUN: %if amdgpu-registered-target %{ llc %s -o - -mtriple=amdgcn-amd-amdhsa | FileCheck %s --check-prefixes=ALL,CHECK %}12; RUN: %if arc-registered-target %{ llc %s -o - -mtriple=arc-elf | FileCheck %s --check-prefixes=ALL,CHECK %}13; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=arm-unknown-linux-gnueabi | FileCheck %s --check-prefixes=ALL,CHECK %}14; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=thumbv7em-none-eabi | FileCheck %s --check-prefixes=ALL,CHECK %}15; RUN: %if avr-registered-target %{ llc %s -o - -mtriple=avr-none | FileCheck %s --check-prefixes=ALL,CHECK %}16; RUN: %if bpf-registered-target %{ llc %s -o - -mtriple=bpfel | FileCheck %s --check-prefixes=ALL,CHECK %}17; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 | FileCheck %s --check-prefixes=ALL,CHECK %}18; FIXME: hard float csky crashes19; RUN: %if directx-registered-target %{ llc %s -o - -mtriple=dxil-pc-shadermodel6.3-library | FileCheck %s --check-prefixes=NOCRASH %}20; FIXME: hexagon crashes21; RUN: %if lanai-registered-target %{ llc %s -o - -mtriple=lanai-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK %}22; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}23; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}24; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch64-unknown-linux-gnu -mattr=+f | FileCheck %s --check-prefixes=ALL,CHECK %}25; RUN: %if m68k-registered-target %{ llc %s -o - -mtriple=m68k-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}26; FIXME: mips crashes27; RUN: %if msp430-registered-target %{ llc %s -o - -mtriple=msp430-none-elf | FileCheck %s --check-prefixes=ALL,CHECK %}28; RUN: %if nvptx-registered-target %{ llc %s -o - -mtriple=nvptx64-nvidia-cuda | FileCheck %s --check-prefixes=NOCRASH %}29; FIXME: powerpc crashes30; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}31; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}32; FIXME: sparc crashes33; FIXME: spirv crashes34; FIXME: s390x crashes35; FIXME: ve crashes36; FIXME: wasm crashes37; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %}38; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK %}39; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %}40; RUN: %if xcore-registered-target %{ llc %s -o - -mtriple=xcore-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK %}41; RUN: %if xtensa-registered-target %{ llc %s -o - -mtriple=xtensa-none-elf | FileCheck %s --check-prefixes=ALL,CHECK %}42 43; Note that arm64ec labels are quoted, hence the `{{"?}}:`.44 45; Codegen tests don't work the same for graphics targets. Add a dummy directive46; for filecheck, just make sure we don't crash.47; NOCRASH: {{.*}}48 49; All backends need to be able to bitcast without converting to another format,50; so we assert against libcalls (specifically __truncsfbf2). This won't catch hardware conversions.51 52define bfloat @from_bits(i16 %bits) nounwind {53; ALL-LABEL: from_bits{{"?}}:54; ALL-NOT: __extend55; ALL-NOT: __trunc56; ALL-NOT: __gnu57 %f = bitcast i16 %bits to bfloat58 ret bfloat %f59}60 61define i16 @to_bits(bfloat %f) nounwind {62; ALL-LABEL: to_bits{{"?}}:63; CHECK-NOT: __extend64; CHECK-NOT: __trunc65; CHECK-NOT: __gnu66; BAD: __truncsfbf267 %bits = bitcast bfloat %f to i1668 ret i16 %bits69}70 71define bfloat @check_freeze(bfloat %f) nounwind {72; ALL-LABEL: check_freeze{{"?}}:73 %t0 = freeze bfloat %f74 ret bfloat %t075}76