[PowerPC] Cleanly reject asm crbit constraint with -crbits

When crbits are disabled, cleanly reject the constraint (return the register
class only to cause an assert later).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251566 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Hal Finkel 2015-10-28 22:25:52 +00:00
parent 5b601e1cf0
commit 16624bec2f
2 changed files with 18 additions and 1 deletions

View File

@ -10927,7 +10927,8 @@ PPCTargetLowering::getRegForInlineAsmConstraint(const TargetRegisterInfo *TRI,
case 'y': // crrc
return std::make_pair(0U, &PPC::CRRCRegClass);
}
} else if (Constraint == "wc") { // an individual CR bit.
} else if (Constraint == "wc" && Subtarget.useCRBits()) {
// An individual CR bit.
return std::make_pair(0U, &PPC::CRBITRCRegClass);
} else if (Constraint == "wa" || Constraint == "wd" ||
Constraint == "wf") {

View File

@ -0,0 +1,16 @@
; RUN: not llc -mcpu=pwr7 -o /dev/null %s 2>&1 | FileCheck %s
target datalayout = "E-m:e-i64:64-n32:64"
target triple = "powerpc64-unknown-linux-gnu"
define zeroext i1 @testi1(i1 zeroext %b1, i1 zeroext %b2) #0 {
entry:
%0 = tail call i8 asm "crand $0, $1, $2", "=^wc,^wc,^wc"(i1 %b1, i1 %b2) #0
%1 = and i8 %0, 1
%tobool3 = icmp ne i8 %1, 0
ret i1 %tobool3
; CHECK: error: couldn't allocate output register for constraint 'wc'
}
attributes #0 = { nounwind "target-features"="-crbits" }