From aa08c8b2ba8d684b144ca016de91ad43e033c7c4 Mon Sep 17 00:00:00 2001 From: Richard Osborne Date: Wed, 13 Jun 2012 17:59:12 +0000 Subject: [PATCH] Fix pattern for MKMSK instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158409 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/XCore/XCoreInstrInfo.td | 2 +- test/CodeGen/XCore/mkmsk.ll | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/CodeGen/XCore/mkmsk.ll diff --git a/lib/Target/XCore/XCoreInstrInfo.td b/lib/Target/XCore/XCoreInstrInfo.td index b25a08d25c1..b2f06037768 100644 --- a/lib/Target/XCore/XCoreInstrInfo.td +++ b/lib/Target/XCore/XCoreInstrInfo.td @@ -796,7 +796,7 @@ def MKMSK_rus : _FRUS<(outs GRRegs:$dst), (ins i32imm:$size), def MKMSK_2r : _FRUS<(outs GRRegs:$dst), (ins GRRegs:$size), "mkmsk $dst, $size", - [(set GRRegs:$dst, (add (shl 1, GRRegs:$size), 0xffffffff))]>; + [(set GRRegs:$dst, (add (shl 1, GRRegs:$size), -1))]>; def GETR_rus : _FRUS<(outs GRRegs:$dst), (ins i32imm:$type), "getr $dst, $type", diff --git a/test/CodeGen/XCore/mkmsk.ll b/test/CodeGen/XCore/mkmsk.ll new file mode 100644 index 00000000000..377612b7d21 --- /dev/null +++ b/test/CodeGen/XCore/mkmsk.ll @@ -0,0 +1,11 @@ +; RUN: llc < %s -march=xcore | FileCheck %s + +define i32 @f(i32) nounwind { +; CHECK: f: +; CHECK: mkmsk r0, r0 +; CHECK-NEXT: retsp 0 +entry: + %1 = shl i32 1, %0 + %2 = add i32 %1, -1 + ret i32 %2 +}