Skip to content

Commit

Permalink
[AArch64][GlobalISel] Don't try to use GISel if subtarget doesn't hav…
Browse files Browse the repository at this point in the history
…e neon or fp.

Throughout the legalizerinfo we currently make the assumption that the target
has neon and FP target features available. Fixing it will require a refactor of
the whole thing, so until then make sure we fall back.

Works around PR42734

Differential Revision: https://reviews.llvm.org/D65244

llvm-svn: 366957
  • Loading branch information
aemerson committed Jul 24, 2019
1 parent 86814bf commit de81bd0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/lib/Target/AArch64/AArch64LegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ AArch64LegalizerInfo::AArch64LegalizerInfo(const AArch64Subtarget &ST) {
const LLT v2s64 = LLT::vector(2, 64);
const LLT v2p0 = LLT::vector(2, p0);

// FIXME: support subtargets which have neon/fp-armv8 disabled.
if (!ST.hasNEON() || !ST.hasFPARMv8()) {
computeTables();
return;
}

getActionDefinitionsBuilder(G_IMPLICIT_DEF)
.legalFor({p0, s1, s8, s16, s32, s64, v4s32, v2s64})
.clampScalar(0, s1, s64)
Expand Down
13 changes: 13 additions & 0 deletions llvm/test/CodeGen/AArch64/GlobalISel/no-neon-no-fp.ll
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
; RUN: not llc -o - -verify-machineinstrs -global-isel -global-isel-abort=1 -stop-after=legalizer %s 2>&1 | FileCheck %s
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-unknown"

; CHECK: unable to legalize instruction: G_STORE %1:_(s128), %0:_(p0) :: (store 16 into %ir.ptr) (in function: foo)
define void @foo(i128 *%ptr) #0 align 2 {
entry:
store i128 0, i128* %ptr, align 16
ret void
}

attributes #0 = { "use-soft-float"="false" "target-features"="-fp-armv8,-neon" }

0 comments on commit de81bd0

Please sign in to comment.