|
| 1 | +; Simple cross-platform smoke checks for basic f16 operations. |
| 2 | +; |
| 3 | +; There shouldn't be any architectures that crash when trying to use `half`; |
| 4 | +; check that here. Additionally do a small handful of smoke tests that work |
| 5 | +; 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(#94434) unsupported on arm64ec |
| 11 | +; RUN: %if aarch64-registered-target %{ ! llc %s -o - -mtriple=arm64ec-pc-windows-msvc -filetype=null %} |
| 12 | +; RUN: %if amdgpu-registered-target %{ llc %s -o - -mtriple=amdgcn-amd-amdhsa | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 13 | +; RUN: %if arc-registered-target %{ llc %s -o - -mtriple=arc-elf | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 14 | +; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=arm-unknown-linux-gnueabi | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 15 | +; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=thumbv7em-none-eabi | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 16 | +; RUN: %if avr-registered-target %{ llc %s -o - -mtriple=avr-none | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 17 | +; RUN: %if bpf-registered-target %{ llc %s -o - -mtriple=bpfel | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 18 | +; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 19 | +; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,BAD %} |
| 20 | +; RUN: %if directx-registered-target %{ llc %s -o - -mtriple=dxil-pc-shadermodel6.3-library | FileCheck %s --check-prefixes=NOCRASH %} |
| 21 | +; RUN: %if hexagon-registered-target %{ llc %s -o - -mtriple=hexagon-unknown-linux-musl | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 22 | +; RUN: %if lanai-registered-target %{ llc %s -o - -mtriple=lanai-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 23 | +; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 24 | +; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 25 | +; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch64-unknown-linux-gnu -mattr=+f | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 26 | +; RUN: %if m68k-registered-target %{ llc %s -o - -mtriple=m68k-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 27 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 28 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips64-unknown-linux-gnuabi64 | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 29 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips64el-unknown-linux-gnuabi64 | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 30 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mipsel-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 31 | +; RUN: %if msp430-registered-target %{ llc %s -o - -mtriple=msp430-none-elf | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 32 | +; RUN: %if nvptx-registered-target %{ llc %s -o - -mtriple=nvptx64-nvidia-cuda | FileCheck %s --check-prefixes=NOCRASH %} |
| 33 | +; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
| 34 | +; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
| 35 | +; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
| 36 | +; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 37 | +; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 38 | +; RUN: %if sparc-registered-target %{ llc %s -o - -mtriple=sparc-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
| 39 | +; RUN: %if sparc-registered-target %{ llc %s -o - -mtriple=sparc64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
| 40 | +; RUN: %if spirv-registered-target %{ llc %s -o - -mtriple=spirv-unknown-unknown | FileCheck %s --check-prefixes=NOCRASH %} |
| 41 | +; RUN: %if systemz-registered-target %{ llc %s -o - -mtriple=s390x-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 42 | +; RUN: %if ve-registered-target %{ llc %s -o - -mtriple=ve-unknown-unknown | FileCheck %s --check-prefixes=ALL,BAD %} |
| 43 | +; RUN: %if webassembly-registered-target %{ llc %s -o - -mtriple=wasm32-unknown-unknown | FileCheck %s --check-prefixes=ALL,BAD %} |
| 44 | +; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 45 | +; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 46 | +; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 47 | +; RUN: %if xcore-registered-target %{ llc %s -o - -mtriple=xcore-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 48 | +; RUN: %if xtensa-registered-target %{ llc %s -o - -mtriple=xtensa-none-elf | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 49 | + |
| 50 | +; Codegen tests don't work the same for graphics targets. Add a dummy directive |
| 51 | +; for filecheck, just make sure we don't crash. |
| 52 | +; NOCRASH: {{.*}} |
| 53 | + |
| 54 | +; All backends need to be able to bitcast without converting to another format, |
| 55 | +; so we assert against __extendhfsf2, __truncsfhf2, __gnu_{h2f,f2h}_ieee. This |
| 56 | +; doesn't catch issues on platforms with hardware f32<->f16, but those tend to |
| 57 | +; work better anyway. |
| 58 | +; Regression test for https://github.com/llvm/llvm-project/issues/97981. |
| 59 | + |
| 60 | +define half @from_bits(i16 %bits) nounwind { |
| 61 | +; ALL-LABEL: from_bits: |
| 62 | +; CHECK-NOT: __extend |
| 63 | +; CHECK-NOT: __trunc |
| 64 | +; CHECK-NOT: __gnu |
| 65 | +; BAD: __extendhfsf2 |
| 66 | + %f = bitcast i16 %bits to half |
| 67 | + ret half %f |
| 68 | +} |
| 69 | + |
| 70 | +define i16 @to_bits(half %f) nounwind { |
| 71 | +; ALL-LABEL: to_bits: |
| 72 | +; CHECK-NOT: __extend |
| 73 | +; CHECK-NOT: __trunc |
| 74 | +; CHECK-NOT: __gnu |
| 75 | +; BAD: __truncsfhf2 |
| 76 | + %bits = bitcast half %f to i16 |
| 77 | + ret i16 %bits |
| 78 | +} |
| 79 | + |
| 80 | +; Some platforms have had problems freezing. Regression test for |
| 81 | +; https://github.com/llvm/llvm-project/issues/117337 and similar issues. |
| 82 | + |
| 83 | +define half @check_freeze(half %f) nounwind { |
| 84 | +; ALL-LABEL: check_freeze: |
| 85 | + %t0 = freeze half %f |
| 86 | + ret half %t0 |
| 87 | +} |
0 commit comments