add andn/orn/xorn patterns. This allows us to compile this:
authorChris Lattner <sabre@nondot.org>
Sat, 17 Dec 2005 21:05:49 +0000 (21:05 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 17 Dec 2005 21:05:49 +0000 (21:05 +0000)
long %test(ubyte, short, long %X, long %Y) {
  %A = xor long %X, -1
  %B = and long %Y, %A
  ret long %B
}

to this:

test:
        save -96, %sp, %sp
        andn %i4, %i2, %i0
        andn %i5, %i3, %i1
        restore %g0, %g0, %g0
        retl
        nop

instead of this:

test:
        save -96, %sp, %sp
        xor %i2, -1, %l0
        xor %i3, -1, %l1
        and %i4, %l0, %i0
        and %i5, %l1, %i1
        restore %g0, %g0, %g0
        retl
        nop

The simpleisel emits:  :(

test:
        save -96, %sp, %sp
        or %g0, -1, %l0
        or %g0, -1, %l0
        or %g0, -1, %l0
        or %g0, -1, %l1
        xor %i2, %l0, %l0
        xor %i3, %l1, %l1
        and %i4, %l0, %i0
        and %i5, %l1, %i1
        restore %g0, %g0, %g0
        retl
        nop

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@24793 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/Sparc/SparcInstrInfo.td
lib/Target/SparcV8/SparcV8InstrInfo.td

index efe40531c697223d3cd2fd364b2f03d84ee8eebb..b1ecdde733c449c03c15528b56fc334d99679f7d 100644 (file)
@@ -250,7 +250,8 @@ def ANDCCri : F3_2<2, 0b010001,
                    "andcc $b, $c, $dst", []>;
 def ANDNrr  : F3_1<2, 0b000101,
                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
-                   "andn $b, $c, $dst", []>;
+                   "andn $b, $c, $dst",
+                   [(set IntRegs:$dst, (and IntRegs:$b, (not IntRegs:$c)))]>;
 def ANDNri  : F3_2<2, 0b000101,
                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
                    "andn $b, $c, $dst", []>;
@@ -276,7 +277,8 @@ def ORCCri  : F3_2<2, 0b010010,
                    "orcc $b, $c, $dst", []>;
 def ORNrr   : F3_1<2, 0b000110,
                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
-                   "orn $b, $c, $dst", []>;
+                   "orn $b, $c, $dst",
+                   [(set IntRegs:$dst, (or IntRegs:$b, (not IntRegs:$c)))]>;
 def ORNri   : F3_2<2, 0b000110,
                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
                    "orn $b, $c, $dst", []>;
@@ -302,7 +304,8 @@ def XORCCri : F3_2<2, 0b010011,
                    "xorcc $b, $c, $dst", []>;
 def XNORrr  : F3_1<2, 0b000111,
                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
-                   "xnor $b, $c, $dst", []>;
+                   "xnor $b, $c, $dst",
+                   [(set IntRegs:$dst, (xor IntRegs:$b, (not IntRegs:$c)))]>;
 def XNORri  : F3_2<2, 0b000111,
                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
                    "xnor $b, $c, $dst", []>;
index efe40531c697223d3cd2fd364b2f03d84ee8eebb..b1ecdde733c449c03c15528b56fc334d99679f7d 100644 (file)
@@ -250,7 +250,8 @@ def ANDCCri : F3_2<2, 0b010001,
                    "andcc $b, $c, $dst", []>;
 def ANDNrr  : F3_1<2, 0b000101,
                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
-                   "andn $b, $c, $dst", []>;
+                   "andn $b, $c, $dst",
+                   [(set IntRegs:$dst, (and IntRegs:$b, (not IntRegs:$c)))]>;
 def ANDNri  : F3_2<2, 0b000101,
                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
                    "andn $b, $c, $dst", []>;
@@ -276,7 +277,8 @@ def ORCCri  : F3_2<2, 0b010010,
                    "orcc $b, $c, $dst", []>;
 def ORNrr   : F3_1<2, 0b000110,
                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
-                   "orn $b, $c, $dst", []>;
+                   "orn $b, $c, $dst",
+                   [(set IntRegs:$dst, (or IntRegs:$b, (not IntRegs:$c)))]>;
 def ORNri   : F3_2<2, 0b000110,
                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
                    "orn $b, $c, $dst", []>;
@@ -302,7 +304,8 @@ def XORCCri : F3_2<2, 0b010011,
                    "xorcc $b, $c, $dst", []>;
 def XNORrr  : F3_1<2, 0b000111,
                    (ops IntRegs:$dst, IntRegs:$b, IntRegs:$c),
-                   "xnor $b, $c, $dst", []>;
+                   "xnor $b, $c, $dst",
+                   [(set IntRegs:$dst, (xor IntRegs:$b, (not IntRegs:$c)))]>;
 def XNORri  : F3_2<2, 0b000111,
                    (ops IntRegs:$dst, IntRegs:$b, i32imm:$c),
                    "xnor $b, $c, $dst", []>;