diff options
author | John Brawn <john.brawn@arm.com> | 2018-11-22 11:45:23 +0000 |
---|---|---|
committer | John Brawn <john.brawn@arm.com> | 2018-11-22 11:45:23 +0000 |
commit | d6e0ebea1054f6026ae4830f04a66eda9460572c (patch) | |
tree | f888de3edae8f7c633d1601024577cd2eeade1d1 /llvm/test/CodeGen/AArch64/arm64-build-vector.ll | |
parent | 94a16cb6111c0e10681f2047e043ff19882473e0 (diff) | |
download | bcm5719-llvm-d6e0ebea1054f6026ae4830f04a66eda9460572c.tar.gz bcm5719-llvm-d6e0ebea1054f6026ae4830f04a66eda9460572c.zip |
[AArch64] Fix SelectionDAG infinite loop for v1i64 SCALAR_TO_VECTOR
A consequence of r347274 is that SCALAR_TO_VECTOR can be converted into
BUILD_VECTOR by SimplifyDemandedBits, but LowerBUILD_VECTOR can turn
BUILD_VECTOR into SCALAR_TO_VECTOR so we get an infinite loop.
Fix this by making LowerBUILD_VECTOR not do this transformation for those
vectors that would get transformed back, i.e. BUILD_VECTOR of a single-element
constant vector. Doing that means we get a DUP, which we then need to recognise
in ISel as a copy.
llvm-svn: 347456
Diffstat (limited to 'llvm/test/CodeGen/AArch64/arm64-build-vector.ll')
-rw-r--r-- | llvm/test/CodeGen/AArch64/arm64-build-vector.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/arm64-build-vector.ll b/llvm/test/CodeGen/AArch64/arm64-build-vector.ll index d7fe9c6d68b..d268f761c9a 100644 --- a/llvm/test/CodeGen/AArch64/arm64-build-vector.ll +++ b/llvm/test/CodeGen/AArch64/arm64-build-vector.ll @@ -53,3 +53,25 @@ define void @widen_f16_build_vector(half* %addr) { store <2 x half> <half 0xH33EE, half 0xH33EE>, <2 x half>* %1, align 2 ret void } + +; Check that a single element vector is constructed with a mov +define <1 x i64> @single_element_vector_i64(<1 x i64> %arg) { +; CHECK-LABEL: single_element_vector_i64 +; CHECK: orr w[[GREG:[0-9]+]], wzr, #0x1 +; CHECK: fmov d[[DREG:[0-9]+]], x[[GREG]] +; CHECK: add d0, d0, d[[DREG]] +; CHECK: ret +entry: + %add = add <1 x i64> %arg, <i64 1> + ret <1 x i64> %add +} + +define <1 x double> @single_element_vector_double(<1 x double> %arg) { +; CHECK-LABEL: single_element_vector_double +; CHECK: fmov d[[DREG:[0-9]+]], #1.00000000 +; CHECK: fadd d0, d0, d[[DREG]] +; CHECK: ret +entry: + %add = fadd <1 x double> %arg, <double 1.0> + ret <1 x double> %add +} |