|
4 | 4 | ; check that here. Additionally do a small handful of smoke tests that work
|
5 | 5 | ; well cross-platform.
|
6 | 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 |
| -; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=arm64ec-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK %} |
11 |
| -; 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 |
| -; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,BAD %} |
19 |
| -; RUN: %if directx-registered-target %{ llc %s -o - -mtriple=dxil-pc-shadermodel6.3-library | FileCheck %s --check-prefixes=NOCRASH %} |
20 |
| -; RUN: %if hexagon-registered-target %{ llc %s -o - -mtriple=hexagon-unknown-linux-musl | FileCheck %s --check-prefixes=ALL,CHECK %} |
21 |
| -; 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 |
| -; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
27 |
| -; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips64-unknown-linux-gnuabi64 | FileCheck %s --check-prefixes=ALL,CHECK %} |
28 |
| -; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips64el-unknown-linux-gnuabi64 | FileCheck %s --check-prefixes=ALL,CHECK %} |
29 |
| -; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mipsel-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
30 |
| -; RUN: %if msp430-registered-target %{ llc %s -o - -mtriple=msp430-none-elf | FileCheck %s --check-prefixes=ALL,CHECK %} |
31 |
| -; RUN: %if nvptx-registered-target %{ llc %s -o - -mtriple=nvptx64-nvidia-cuda | FileCheck %s --check-prefixes=NOCRASH %} |
32 |
| -; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
33 |
| -; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
34 |
| -; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD %} |
35 |
| -; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
36 |
| -; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
37 |
| -; RUN: %if sparc-registered-target %{ llc %s -o - -mtriple=sparc-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
38 |
| -; RUN: %if sparc-registered-target %{ llc %s -o - -mtriple=sparc64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
39 |
| -; RUN: %if spirv-registered-target %{ llc %s -o - -mtriple=spirv-unknown-unknown | FileCheck %s --check-prefixes=NOCRASH %} |
40 |
| -; RUN: %if systemz-registered-target %{ llc %s -o - -mtriple=s390x-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
41 |
| -; RUN: %if ve-registered-target %{ llc %s -o - -mtriple=ve-unknown-unknown | FileCheck %s --check-prefixes=ALL,BAD %} |
42 |
| -; RUN: %if webassembly-registered-target %{ llc %s -o - -mtriple=wasm32-unknown-unknown | FileCheck %s --check-prefixes=ALL,BAD %} |
43 |
| -; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
44 |
| -; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK %} |
45 |
| -; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK %} |
46 |
| -; RUN: %if xcore-registered-target %{ llc %s -o - -mtriple=xcore-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK %} |
47 |
| -; RUN: %if xtensa-registered-target %{ llc %s -o - -mtriple=xtensa-none-elf | FileCheck %s --check-prefixes=ALL,CHECK %} |
| 7 | +; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=aarch64-apple-darwin | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 8 | +; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=aarch64-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 9 | +; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=aarch64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 10 | +; RUN: %if aarch64-registered-target %{ llc %s -o - -mtriple=arm64ec-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 11 | +; RUN: %if amdgpu-registered-target %{ llc %s -o - -mtriple=amdgcn-amd-amdhsa | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 12 | +; RUN: %if arc-registered-target %{ llc %s -o - -mtriple=arc-elf | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 13 | +; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=arm-unknown-linux-gnueabi | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 14 | +; RUN: %if arm-registered-target %{ llc %s -o - -mtriple=thumbv7em-none-eabi | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 15 | +; RUN: %if avr-registered-target %{ llc %s -o - -mtriple=avr-none | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 16 | +; BPF errors on some operations, so has its own separate `half.ll` test. |
| 17 | +; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 18 | +; RUN: %if csky-registered-target %{ llc %s -o - -mtriple=csky-unknown-linux-gnuabiv2 -mcpu=ck860fv -mattr=+hard-float | FileCheck %s --check-prefixes=ALL,BAD,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 19 | +; DirectX errors on some operations, so has its own separate `half.ll` test. |
| 20 | +; RUN: %if hexagon-registered-target %{ llc %s -o - -mtriple=hexagon-unknown-linux-musl | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 21 | +; RUN: %if lanai-registered-target %{ llc %s -o - -mtriple=lanai-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 22 | +; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 23 | +; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 24 | +; RUN: %if loongarch-registered-target %{ llc %s -o - -mtriple=loongarch64-unknown-linux-gnu -mattr=+f | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 25 | +; RUN: %if m68k-registered-target %{ llc %s -o - -mtriple=m68k-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 26 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 27 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips64-unknown-linux-gnuabi64 | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 28 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mips64el-unknown-linux-gnuabi64 | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 29 | +; RUN: %if mips-registered-target %{ llc %s -o - -mtriple=mipsel-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 30 | +; RUN: %if msp430-registered-target %{ llc %s -o - -mtriple=msp430-none-elf | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 31 | +; RUN: %if nvptx-registered-target %{ llc %s -o - -mtriple=nvptx64-nvidia-cuda | FileCheck %s --check-prefixes=NOCRASH %} |
| 32 | +; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 33 | +; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 34 | +; RUN: %if powerpc-registered-target %{ llc %s -o - -mtriple=powerpc64le-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,BAD,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 35 | +; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv32-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 36 | +; RUN: %if riscv-registered-target %{ llc %s -o - -mtriple=riscv64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 37 | +; RUN: %if sparc-registered-target %{ llc %s -o - -mtriple=sparc-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 38 | +; RUN: %if sparc-registered-target %{ llc %s -o - -mtriple=sparc64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
| 39 | +; RUN: %if spirv-registered-target %{ llc %s -o - -mtriple=spirv-unknown-unknown | FileCheck %s --check-prefixes=NOCRASH %} |
| 40 | +; RUN: %if systemz-registered-target %{ llc %s -o - -mtriple=s390x-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 41 | +; RUN: %if ve-registered-target %{ llc %s -o - -mtriple=ve-unknown-unknown | FileCheck %s --check-prefixes=ALL,BAD,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 42 | +; RUN: %if webassembly-registered-target %{ llc %s -o - -mtriple=wasm32-unknown-unknown | FileCheck %s --check-prefixes=ALL,BAD,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 43 | +; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=i686-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 44 | +; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-pc-windows-msvc | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 45 | +; RUN: %if x86-registered-target %{ llc %s -o - -mtriple=x86_64-unknown-linux-gnu | FileCheck %s --check-prefixes=ALL,CHECK,CHECK-NEG-ABS,CHECK-COPYSIGN %} |
| 46 | +; RUN: %if xcore-registered-target %{ llc %s -o - -mtriple=xcore-unknown-unknown | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,BAD-COPYSIGN %} |
| 47 | +; RUN: %if xtensa-registered-target %{ llc %s -o - -mtriple=xtensa-none-elf | FileCheck %s --check-prefixes=ALL,CHECK,BAD-NEG-ABS,CHECK-COPYSIGN %} |
48 | 48 |
|
49 | 49 | ; Note that arm64ec labels are quoted, hence the `{{"?}}:`.
|
50 | 50 |
|
@@ -86,3 +86,47 @@ define half @check_freeze(half %f) nounwind {
|
86 | 86 | %t0 = freeze half %f
|
87 | 87 | ret half %t0
|
88 | 88 | }
|
| 89 | + |
| 90 | +; fneg, fabs and copysign all need to not quieten signalling NaNs, so should not call any conversion functions which do. |
| 91 | +; These tests won't catch cases where the everything is done using native instructions instead of builtins. |
| 92 | +; See https://github.com/llvm/llvm-project/issues/104915 |
| 93 | + |
| 94 | +define void @test_fneg(ptr %p1, ptr %p2) #0 { |
| 95 | +; ALL-LABEL: test_fneg{{"?}}: |
| 96 | +; CHECK-NEG-ABS-NOT: __extend |
| 97 | +; CHECK-NEG-ABS-NOT: __trunc |
| 98 | +; CHECK-NEG-ABS-NOT: __gnu |
| 99 | +; CHECK-NEG-ABS-NOT: __aeabi |
| 100 | +; BAD-NEG-ABS: {{__extendhfsf2|__gnu_h2f_ieee|__aeabi_h2f}} |
| 101 | + %v = load half, ptr %p1 |
| 102 | + %res = fneg half %v |
| 103 | + store half %res, ptr %p2 |
| 104 | + ret void |
| 105 | +} |
| 106 | + |
| 107 | +define void @test_fabs(ptr %p1, ptr %p2) { |
| 108 | +; ALL-LABEL: test_fabs{{"?}}: |
| 109 | +; CHECK-NEG-ABS-NOT: __extend |
| 110 | +; CHECK-NEG-ABS-NOT: __trunc |
| 111 | +; CHECK-NEG-ABS-NOT: __gnu |
| 112 | +; CHECK-NEG-ABS-NOT: __aeabi |
| 113 | +; BAD-NEG-ABS: {{__extendhfsf2|__gnu_h2f_ieee|__aeabi_h2f}} |
| 114 | + %a = load half, ptr %p1 |
| 115 | + %r = call half @llvm.fabs.f16(half %a) |
| 116 | + store half %r, ptr %p2 |
| 117 | + ret void |
| 118 | +} |
| 119 | + |
| 120 | +define void @test_copysign(ptr %p1, ptr %p2, ptr %p3) { |
| 121 | +; ALL-LABEL: test_copysign{{"?}}: |
| 122 | +; CHECK-COPYSIGN-NOT: __extend |
| 123 | +; CHECK-COPYSIGN-NOT: __trunc |
| 124 | +; CHECK-COPYSIGN-NOT: __gnu |
| 125 | +; CHECK-COPYSIGN-NOT: __aeabi |
| 126 | +; BAD-COPYSIGN: {{__extendhfsf2|__gnu_h2f_ieee}} |
| 127 | + %a = load half, ptr %p1 |
| 128 | + %b = load half, ptr %p2 |
| 129 | + %r = call half @llvm.copysign.f16(half %a, half %b) |
| 130 | + store half %r, ptr %p3 |
| 131 | + ret void |
| 132 | +} |
0 commit comments