From 7b7cb8d9ddc095c5f1fc9159bd487b3754c03ec5 Mon Sep 17 00:00:00 2001 From: Simon Dardis Date: Wed, 16 Nov 2016 11:04:49 +0000 Subject: [PATCH] [mips] not instruction alias This patch adds the single operand form of the not alias to microMIPS and MIPS along with additional tests. This partially resolves PR/30381. Thanks to Sean Bruno for reporting the issue! llvm-svn: 287097 --- llvm/lib/Target/Mips/MicroMipsInstrInfo.td | 2 ++ llvm/lib/Target/Mips/MipsInstrInfo.td | 3 +++ llvm/test/MC/Mips/micromips/valid.s | 1 + llvm/test/MC/Mips/micromips32r6/valid.s | 1 + llvm/test/MC/Mips/micromips64r6/valid.s | 1 + llvm/test/MC/Mips/mips1/valid.s | 2 ++ llvm/test/MC/Mips/mips2/valid.s | 2 ++ llvm/test/MC/Mips/mips3/valid.s | 2 ++ llvm/test/MC/Mips/mips32/valid.s | 2 ++ llvm/test/MC/Mips/mips32r2/valid.s | 2 ++ llvm/test/MC/Mips/mips32r3/valid.s | 2 ++ llvm/test/MC/Mips/mips32r5/valid.s | 2 ++ llvm/test/MC/Mips/mips32r6/valid.s | 2 ++ llvm/test/MC/Mips/mips4/valid.s | 2 ++ llvm/test/MC/Mips/mips5/valid.s | 2 ++ llvm/test/MC/Mips/mips64/valid.s | 2 ++ llvm/test/MC/Mips/mips64r2/valid.s | 2 ++ llvm/test/MC/Mips/mips64r3/valid.s | 2 ++ llvm/test/MC/Mips/mips64r5/valid.s | 2 ++ llvm/test/MC/Mips/mips64r6/valid.s | 2 ++ 20 files changed, 38 insertions(+) diff --git a/llvm/lib/Target/Mips/MicroMipsInstrInfo.td b/llvm/lib/Target/Mips/MicroMipsInstrInfo.td index 66c2d8b..c55c19b 100644 --- a/llvm/lib/Target/Mips/MicroMipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MicroMipsInstrInfo.td @@ -1177,6 +1177,8 @@ let Predicates = [InMicroMips] in { (XORi_MM GPR32Opnd:$rs, GPR32Opnd:$rs, uimm16:$imm), 0>; def : MipsInstAlias<"not $rt, $rs", (NOR_MM GPR32Opnd:$rt, GPR32Opnd:$rs, ZERO), 0>; + def : MipsInstAlias<"not $rt", + (NOR_MM GPR32Opnd:$rt, GPR32Opnd:$rt, ZERO), 0>; def : MipsInstAlias<"bnez $rs,$offset", (BNE_MM GPR32Opnd:$rs, ZERO, brtarget:$offset), 0>; def : MipsInstAlias<"beqz $rs,$offset", diff --git a/llvm/lib/Target/Mips/MipsInstrInfo.td b/llvm/lib/Target/Mips/MipsInstrInfo.td index 0c2ca67..22060df 100644 --- a/llvm/lib/Target/Mips/MipsInstrInfo.td +++ b/llvm/lib/Target/Mips/MipsInstrInfo.td @@ -2348,6 +2348,9 @@ let AdditionalPredicates = [NotInMicroMips] in { def : MipsInstAlias< "not $rt, $rs", (NOR GPR32Opnd:$rt, GPR32Opnd:$rs, ZERO), 0>; + def : MipsInstAlias< + "not $rt", + (NOR GPR32Opnd:$rt, GPR32Opnd:$rt, ZERO), 0>; def : MipsInstAlias<"nop", (SLL ZERO, ZERO, 0), 1>; } def : MipsInstAlias<"mfc0 $rt, $rd", (MFC0 GPR32Opnd:$rt, COP0Opnd:$rd, 0), 0>; diff --git a/llvm/test/MC/Mips/micromips/valid.s b/llvm/test/MC/Mips/micromips/valid.s index 7fd1f57..4f8e5ae 100644 --- a/llvm/test/MC/Mips/micromips/valid.s +++ b/llvm/test/MC/Mips/micromips/valid.s @@ -74,6 +74,7 @@ xor $3, $3, $5 # CHECK: xor $3, $3, $5 # encoding: [0x00,0x xori $9, $6, 17767 # CHECK: xori $9, $6, 17767 # encoding: [0x71,0x26,0x45,0x67] nor $9, $6, $7 # CHECK: nor $9, $6, $7 # encoding: [0x00,0xe6,0x4a,0xd0] not $7, $8 # CHECK: not $7, $8 # encoding: [0x00,0x08,0x3a,0xd0] +not $7 # CHECK: not $7, $7 # encoding: [0x00,0x07,0x3a,0xd0] mul $9, $6, $7 # CHECK: mul $9, $6, $7 # encoding: [0x00,0xe6,0x4a,0x10] mult $9, $7 # CHECK: mult $9, $7 # encoding: [0x00,0xe9,0x8b,0x3c] multu $9, $7 # CHECK: multu $9, $7 # encoding: [0x00,0xe9,0x9b,0x3c] diff --git a/llvm/test/MC/Mips/micromips32r6/valid.s b/llvm/test/MC/Mips/micromips32r6/valid.s index 3323803..30a3040 100644 --- a/llvm/test/MC/Mips/micromips32r6/valid.s +++ b/llvm/test/MC/Mips/micromips32r6/valid.s @@ -359,6 +359,7 @@ and $3, 5 # CHECK: andi $3, $3, 5 # encoding: [0xd0,0x63,0x00,0x05] and $3, $4, 5 # CHECK: andi $3, $4, 5 # encoding: [0xd0,0x64,0x00,0x05] not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x04,0x1a,0xd0] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x03,0x1a,0xd0] or $3, 5 # CHECK: ori $3, $3, 5 # encoding: [0x50,0x63,0x00,0x05] or $3, $4, 5 # CHECK: ori $3, $4, 5 # encoding: [0x50,0x64,0x00,0x05] xor $3, 5 # CHECK: xori $3, $3, 5 # encoding: [0x70,0x63,0x00,0x05] diff --git a/llvm/test/MC/Mips/micromips64r6/valid.s b/llvm/test/MC/Mips/micromips64r6/valid.s index c07d7fd..c103179 100644 --- a/llvm/test/MC/Mips/micromips64r6/valid.s +++ b/llvm/test/MC/Mips/micromips64r6/valid.s @@ -293,6 +293,7 @@ a: andi $3, $4, 1234 # CHECK: andi $3, $4, 1234 # encoding: [0xd0,0x64,0x04,0xd2] nor $3, $4, $5 # CHECK: nor $3, $4, $5 # encoding: [0x00,0xa4,0x1a,0xd0] not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x04,0x1a,0xd0] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x03,0x1a,0xd0] or $3, 5 # CHECK: ori $3, $3, 5 # encoding: [0x50,0x63,0x00,0x05] or $3, $4, 5 # CHECK: ori $3, $4, 5 # encoding: [0x50,0x64,0x00,0x05] or $3, $4, $5 # CHECK: or $3, $4, $5 # encoding: [0x00,0xa4,0x1a,0x90] diff --git a/llvm/test/MC/Mips/mips1/valid.s b/llvm/test/MC/Mips/mips1/valid.s index 93502cc..77c5c1f 100644 --- a/llvm/test/MC/Mips/mips1/valid.s +++ b/llvm/test/MC/Mips/mips1/valid.s @@ -85,6 +85,8 @@ a: neg.s $f1,$f15 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] sb $s6,-19857($14) diff --git a/llvm/test/MC/Mips/mips2/valid.s b/llvm/test/MC/Mips/mips2/valid.s index 3a5fd1c..c6d4205 100644 --- a/llvm/test/MC/Mips/mips2/valid.s +++ b/llvm/test/MC/Mips/mips2/valid.s @@ -107,6 +107,8 @@ a: neg.s $f1,$f15 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] round.w.d $f6,$f4 diff --git a/llvm/test/MC/Mips/mips3/valid.s b/llvm/test/MC/Mips/mips3/valid.s index 69244e3..1f0e22d 100644 --- a/llvm/test/MC/Mips/mips3/valid.s +++ b/llvm/test/MC/Mips/mips3/valid.s @@ -167,6 +167,8 @@ a: neg.s $f1,$f15 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] round.l.d $f12,$f1 diff --git a/llvm/test/MC/Mips/mips32/valid.s b/llvm/test/MC/Mips/mips32/valid.s index 3a05294..c24abe3 100644 --- a/llvm/test/MC/Mips/mips32/valid.s +++ b/llvm/test/MC/Mips/mips32/valid.s @@ -135,6 +135,8 @@ a: neg.s $f1,$f15 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0xcc,0xa1,0x00,0x08] diff --git a/llvm/test/MC/Mips/mips32r2/valid.s b/llvm/test/MC/Mips/mips32r2/valid.s index 0ffddb0..5fc40d6 100644 --- a/llvm/test/MC/Mips/mips32r2/valid.s +++ b/llvm/test/MC/Mips/mips32r2/valid.s @@ -157,6 +157,8 @@ a: nmsub.s $f1,$f24,$f19,$f4 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pause # CHECK: pause # encoding: [0x00,0x00,0x01,0x40] diff --git a/llvm/test/MC/Mips/mips32r3/valid.s b/llvm/test/MC/Mips/mips32r3/valid.s index a05df83..c9de31a 100644 --- a/llvm/test/MC/Mips/mips32r3/valid.s +++ b/llvm/test/MC/Mips/mips32r3/valid.s @@ -157,6 +157,8 @@ a: nmsub.s $f1,$f24,$f19,$f4 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pause # CHECK: pause # encoding: [0x00,0x00,0x01,0x40] diff --git a/llvm/test/MC/Mips/mips32r5/valid.s b/llvm/test/MC/Mips/mips32r5/valid.s index 3100dd4..31fb743 100644 --- a/llvm/test/MC/Mips/mips32r5/valid.s +++ b/llvm/test/MC/Mips/mips32r5/valid.s @@ -158,6 +158,8 @@ a: nmsub.s $f1,$f24,$f19,$f4 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pause # CHECK: pause # encoding: [0x00,0x00,0x01,0x40] diff --git a/llvm/test/MC/Mips/mips32r6/valid.s b/llvm/test/MC/Mips/mips32r6/valid.s index f127c68..c037baa 100644 --- a/llvm/test/MC/Mips/mips32r6/valid.s +++ b/llvm/test/MC/Mips/mips32r6/valid.s @@ -136,6 +136,8 @@ a: neg $2, $3 # CHECK: neg $2, $3 # encoding: [0x00,0x03,0x10,0x22] negu $2 # CHECK: negu $2, $2 # encoding: [0x00,0x02,0x10,0x23] negu $2,$3 # CHECK: negu $2, $3 # encoding: [0x00,0x03,0x10,0x23] + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0x7c,0xa1,0x04,0x35] # FIXME: Use the code generator in order to print the .set directives # instead of the instruction printer. diff --git a/llvm/test/MC/Mips/mips4/valid.s b/llvm/test/MC/Mips/mips4/valid.s index c8fb99b..62cd390 100644 --- a/llvm/test/MC/Mips/mips4/valid.s +++ b/llvm/test/MC/Mips/mips4/valid.s @@ -193,6 +193,8 @@ a: nmsub.s $f0, $f24, $f20, $f4 # encoding: [0x4f,0x04,0xa0,0x38] nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0xcc,0xa1,0x00,0x08] diff --git a/llvm/test/MC/Mips/mips5/valid.s b/llvm/test/MC/Mips/mips5/valid.s index 50f318d..77204f9 100644 --- a/llvm/test/MC/Mips/mips5/valid.s +++ b/llvm/test/MC/Mips/mips5/valid.s @@ -194,6 +194,8 @@ a: nmsub.s $f0, $f24, $f20, $f4 # encoding: [0x4f,0x04,0xa0,0x38] nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0xcc,0xa1,0x00,0x08] diff --git a/llvm/test/MC/Mips/mips64/valid.s b/llvm/test/MC/Mips/mips64/valid.s index 6235b89..f34bfaf 100644 --- a/llvm/test/MC/Mips/mips64/valid.s +++ b/llvm/test/MC/Mips/mips64/valid.s @@ -210,6 +210,8 @@ a: nmsub.s $f0, $f24, $f20, $f4 # encoding: [0x4f,0x04,0xa0,0x38] nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0xcc,0xa1,0x00,0x08] diff --git a/llvm/test/MC/Mips/mips64r2/valid.s b/llvm/test/MC/Mips/mips64r2/valid.s index 43f6b73..edb157d 100644 --- a/llvm/test/MC/Mips/mips64r2/valid.s +++ b/llvm/test/MC/Mips/mips64r2/valid.s @@ -224,6 +224,8 @@ a: nmsub.s $f1,$f24,$f19,$f4 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pause # CHECK: pause # encoding: [0x00,0x00,0x01,0x40] diff --git a/llvm/test/MC/Mips/mips64r3/valid.s b/llvm/test/MC/Mips/mips64r3/valid.s index e8a65ab..6de7755 100644 --- a/llvm/test/MC/Mips/mips64r3/valid.s +++ b/llvm/test/MC/Mips/mips64r3/valid.s @@ -224,6 +224,8 @@ a: nmsub.s $f1,$f24,$f19,$f4 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pause # CHECK: pause # encoding: [0x00,0x00,0x01,0x40] diff --git a/llvm/test/MC/Mips/mips64r5/valid.s b/llvm/test/MC/Mips/mips64r5/valid.s index 392fe3f..0a3b781 100644 --- a/llvm/test/MC/Mips/mips64r5/valid.s +++ b/llvm/test/MC/Mips/mips64r5/valid.s @@ -225,6 +225,8 @@ a: nmsub.s $f1,$f24,$f19,$f4 nop nor $a3,$zero,$a3 + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $12,$s0,$sp or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pause # CHECK: pause # encoding: [0x00,0x00,0x01,0x40] diff --git a/llvm/test/MC/Mips/mips64r6/valid.s b/llvm/test/MC/Mips/mips64r6/valid.s index 90b066b..0ed51f5 100644 --- a/llvm/test/MC/Mips/mips64r6/valid.s +++ b/llvm/test/MC/Mips/mips64r6/valid.s @@ -190,6 +190,8 @@ a: neg $2, $3 # CHECK: neg $2, $3 # encoding: [0x00,0x03,0x10,0x22] negu $2 # CHECK: negu $2, $2 # encoding: [0x00,0x02,0x10,0x23] negu $2,$3 # CHECK: negu $2, $3 # encoding: [0x00,0x03,0x10,0x23] + not $3, $4 # CHECK: not $3, $4 # encoding: [0x00,0x80,0x18,0x27] + not $3 # CHECK: not $3, $3 # encoding: [0x00,0x60,0x18,0x27] or $2, 4 # CHECK: ori $2, $2, 4 # encoding: [0x34,0x42,0x00,0x04] pref 1, 8($5) # CHECK: pref 1, 8($5) # encoding: [0x7c,0xa1,0x04,0x35] # FIXME: Use the code generator in order to print the .set directives -- 2.7.4