[llvm-dev] [cfe-dev] ARM float16 intrinsic test

Sjoerd Meijer via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 12 01:29:18 PDT 2019


Hello,

The compiler really shouldn't crash, we should raise a bug report for that, but I think this is an options problem.

Looks like you want to target FP16 because you're using -target-feature +fullfp16. FP16 is an extension to Armv8.2-A, and so something like this worked for me:

    clang++ --target=arm-arm-eabihf -march=armv8.2a+fp16 arm.cpp -S -o - -O3

and gives:

    _Z18test_vst4_lane_f16PDh13float16x4x4_t:
          vst4.16 {d0[3], d1[3], d2[3], d3[3]}, [r0]
          bx lr

Is that what you were looking for?
Cheers,
Sjoerd.




________________________________
From: llvm-dev <llvm-dev-bounces at lists.llvm.org> on behalf of Nancy via llvm-dev <llvm-dev at lists.llvm.org>
Sent: 12 July 2019 06:59
To: cfe-dev at lists.llvm.org; LLVM Developers Mailing List
Subject: [llvm-dev] [cfe-dev] ARM float16 intrinsic test

Dear list,

git checkout llvmorg-8.0.0 -b llvm8.0
cmake -G "Unix Makefiles" ../llvm-project/llvm -DCMAKE_BUILD_TYPE=Debug -DLLVM_ENABLE_PROJECTS="clang;lld" -DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU;ARM;AArch64"

[arm.cpp]
#define vst4_lane_f16(__p0, __p1, __p2) __extension__ ({ \
  float16x4x4_t __s1 = __p1; \
  __builtin_neon_vst4_lane_v(__p0, __s1.val[0], __s1.val[1], __s1.val[2], __s1.val[3], __p2, 8); \
})
typedef __fp16 float16_t;
typedef __attribute__((neon_vector_type(4))) float16_t float16x4_t;
typedef struct float16x4x4_t {
  float16x4_t val[4];
} float16x4x4_t;
void test_vst4_lane_f16(float16_t * a, float16x4x4_t b) {
  vst4_lane_f16(a, b, 3);
}

I tried:
$$COMP_ROOT/clang -cc1 -triple thumbv7s-apple-darwin -target-abi apcs-gnu -target-cpu swift -fallow-half-arguments-and-returns -target-feature +fullfp16 -ffreestanding -disable-O0-optnone -emit-llvm -o arm.ll arm.cpp
$cat arm.ll | grep llvm.arm
  call void @llvm.arm.neon.vst4lane.p0i8.v4f16(i8* %4, <4 x half> %13, <4 x half> %14, <4 x half> %15, <4 x half> %16, i32 3, i32 2)
declare void @llvm.arm.neon.vst4lane.p0i8.v4f16(i8*, <4 x half>, <4 x half>, <4 x half>, <4 x half>, i32, i32) #1
$$COMP_ROOT/llc arm.ll
unhandled vld/vst lane type
UNREACHABLE executed at /home/nancy/rpp_llvm/llvm-project/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp:2072!

May I know how to compile this .cpp correctly from FE to BE?


--
Best Regards,
Yu Rong Tan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190712/9b590bdf/attachment.html>


More information about the llvm-dev mailing list