From 43e43f7d8bfc748973feb781fc304f8d23ab88ba Mon Sep 17 00:00:00 2001 From: Akira Hatanaka Date: Mon, 3 Oct 2011 21:23:18 +0000 Subject: [PATCH] Add support for 64-bit logical NOR. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141029 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/Mips/Mips64InstrInfo.td | 7 +++++++ test/CodeGen/Mips/mips64instrs.ll | 8 ++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/Target/Mips/Mips64InstrInfo.td b/lib/Target/Mips/Mips64InstrInfo.td index 3f52e9ebfd3..cd185f6a3c5 100644 --- a/lib/Target/Mips/Mips64InstrInfo.td +++ b/lib/Target/Mips/Mips64InstrInfo.td @@ -72,6 +72,12 @@ class LogicI64 op, string instr_asm, SDNode OpNode>: !strconcat(instr_asm, "\t$dst, $b, $c"), [(set CPU64Regs:$dst, (OpNode CPU64Regs:$b, immZExt16:$c))], IIAlu>; +let isCommutable = 1 in +class LogicNOR64 op, bits<6> func, string instr_asm>: + FR; + // Shifts class LogicR_shift_rotate_imm64 func, bits<5> _rs, string instr_asm, SDNode OpNode, PatFrag PF>: @@ -141,6 +147,7 @@ def DSUBu : ArithR64<0x00, 0x2f, "dsubu", sub, IIAlu>; def DAND : LogicR64<0x24, "and", and>; def DOR : LogicR64<0x25, "or", or>; def DXOR : LogicR64<0x26, "xor", xor>; +def DNOR : LogicNOR64<0x00, 0x27, "nor">; /// Shift Instructions def DSLL : LogicR_shift_rotate_imm64<0x38, 0x00, "dsll", shl, immZExt5>; diff --git a/test/CodeGen/Mips/mips64instrs.ll b/test/CodeGen/Mips/mips64instrs.ll index 16bca0fbbf7..8c02a2dcbb8 100644 --- a/test/CodeGen/Mips/mips64instrs.ll +++ b/test/CodeGen/Mips/mips64instrs.ll @@ -133,3 +133,11 @@ entry: ret i64 %tmp1 } +define i64 @f20(i64 %a, i64 %b) nounwind readnone { +entry: +; CHECK: nor + %or = or i64 %b, %a + %neg = xor i64 %or, -1 + ret i64 %neg +} +