From: Hal Finkel Date: Wed, 28 Oct 2015 22:25:52 +0000 (+0000) Subject: [PowerPC] Cleanly reject asm crbit constraint with -crbits X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=16624bec2f7d679beb71c8d8ed1a9f0d010b9ff3;p=oota-llvm.git [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 --- diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index b1f87831860..ce6f3a6e75d 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -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") { diff --git a/test/CodeGen/PowerPC/crbit-asm-disabled.ll b/test/CodeGen/PowerPC/crbit-asm-disabled.ll new file mode 100644 index 00000000000..56ec8ecb85d --- /dev/null +++ b/test/CodeGen/PowerPC/crbit-asm-disabled.ll @@ -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" } +